1 #ifndef ZOIDBERG_MAIL_SETTINGS_H 2 #define ZOIDBERG_MAIL_SETTINGS_H 3 /* Settings - the mail daemon's settings 4 ** 5 ** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. 6 */ 7 8 9 #include <Archivable.h> 10 #include <List.h> 11 #include <Message.h> 12 13 class BPath; 14 15 typedef enum 16 { 17 B_MAIL_SHOW_STATUS_WINDOW_NEVER = 0, 18 B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING = 1, 19 B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE = 2, 20 B_MAIL_SHOW_STATUS_WINDOW_ALWAYS = 3 21 } b_mail_status_window_option; 22 23 typedef enum 24 { 25 B_MAIL_STATUS_LOOK_TITLED = 0, 26 B_MAIL_STATUS_LOOK_NORMAL_BORDER = 1, 27 B_MAIL_STATUS_LOOK_FLOATING = 2, 28 B_MAIL_STATUS_LOOK_THIN_BORDER = 3, 29 B_MAIL_STATUS_LOOK_NO_BORDER = 4 30 } b_mail_status_window_look; 31 32 typedef enum { 33 inbound, 34 outbound 35 } b_mail_chain_direction; 36 37 class BMailStatusWindow; 38 class BMailChain; 39 40 BMailChain* NewMailChain(); 41 BMailChain* GetMailChain(uint32 id); 42 43 status_t GetOutboundMailChains(BList *list); 44 status_t GetInboundMailChains(BList *list); 45 46 class BMailChain : public BArchivable 47 { 48 public: 49 BMailChain(uint32 id); 50 BMailChain(BMessage*); 51 virtual ~BMailChain(); 52 53 virtual status_t Archive(BMessage*,bool) const; 54 static BArchivable* Instantiate(BMessage*); 55 56 status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT); 57 status_t Delete() const; 58 status_t Reload(); 59 status_t InitCheck() const; 60 61 uint32 ID() const; 62 63 b_mail_chain_direction ChainDirection() const; 64 void SetChainDirection(b_mail_chain_direction); 65 66 const char *Name() const; 67 status_t SetName(const char*); 68 69 BMessage *MetaData() const; 70 71 // "Filter" below refers to the settings message for a MailFilter 72 int32 CountFilters() const; 73 status_t GetFilter(int32 index, BMessage* out_settings, entry_ref *addon = NULL) const; 74 status_t SetFilter(int32 index, const BMessage&, const entry_ref&); 75 76 status_t AddFilter(const BMessage&, const entry_ref&); // at end 77 status_t AddFilter(int32 index, const BMessage&, const entry_ref&); 78 status_t RemoveFilter(int32 index); 79 80 void RunChain(BMailStatusWindow *window, 81 bool async = true, 82 bool save_when_done = true, 83 bool delete_when_done = false); 84 85 private: 86 status_t Path(BPath *path) const; 87 status_t Load(BMessage*); 88 89 int32 id; 90 char name[B_FILE_NAME_LENGTH]; 91 BMessage *meta_data; 92 93 status_t _err; 94 95 b_mail_chain_direction direction; 96 97 int32 settings_ct, addons_ct; 98 BList filter_settings; 99 BList filter_addons; 100 101 uint32 _reserved[5]; 102 }; 103 104 class BMailSettings 105 { 106 public: 107 BMailSettings(); 108 ~BMailSettings(); 109 110 status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT); 111 status_t Reload(); 112 status_t InitCheck() const; 113 114 // Global settings 115 int32 WindowFollowsCorner(); 116 void SetWindowFollowsCorner(int32 which_corner); 117 118 uint32 ShowStatusWindow(); 119 void SetShowStatusWindow(uint32 mode); 120 121 bool DaemonAutoStarts(); 122 void SetDaemonAutoStarts(bool does_it); 123 124 void SetConfigWindowFrame(BRect frame); 125 BRect ConfigWindowFrame(); 126 127 void SetStatusWindowFrame(BRect frame); 128 BRect StatusWindowFrame(); 129 130 int32 StatusWindowWorkspaces(); 131 void SetStatusWindowWorkspaces(int32 workspaces); 132 133 int32 StatusWindowLook(); 134 void SetStatusWindowLook(int32 look); 135 136 bigtime_t AutoCheckInterval(); 137 void SetAutoCheckInterval(bigtime_t); 138 139 bool CheckOnlyIfPPPUp(); 140 void SetCheckOnlyIfPPPUp(bool yes); 141 142 bool SendOnlyIfPPPUp(); 143 void SetSendOnlyIfPPPUp(bool yes); 144 145 uint32 DefaultOutboundChainID(); 146 void SetDefaultOutboundChainID(uint32 to); 147 148 private: 149 BMessage data; 150 uint32 _reserved[4]; 151 }; 152 153 #endif /* ZOIDBERG_MAIL_SETTINGS_H */ 154