00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef INCL_MAIL_ACCOUNT_MANAGER
00038 #define INCL_MAIL_ACCOUNT_MANAGER
00039
00041 #include "base/util/utils.h"
00042 #include "base/util/ArrayElement.h"
00043 #include "base/util/StringBuffer.h"
00044 #include "mail/MailSyncSourceConfig.h"
00045 #include "mail/MailAccount.h"
00046 #include "spds/FolderData.h"
00047 #include "base/globalsdef.h"
00048
00049 BEGIN_NAMESPACE
00050
00051
00052 class AccountProvisioner;
00053
00062 class MailAccountManager {
00063
00064 public:
00065
00066 MailAccountManager(MailSyncSourceConfig& ssc);
00067 virtual ~MailAccountManager();
00068
00069
00077 int createAccount(MailAccount& account);
00078
00085 int updateAccount(const MailAccount& account);
00086
00093 int deleteAccount(const WCHAR* accountID);
00094
00101 int markDeleteAccountOnConfig(const WCHAR* accountID);
00102
00103
00112 int createFolder(FolderData& folder);
00113
00121 int updateFolder(const FolderData& folder);
00122
00129 int deleteFolder(const WCHAR* folderID);
00130
00131
00138 StringBuffer getIdOfAccount(const int index);
00139
00146 StringBuffer getIdOfAccount(const StringBuffer& accountName);
00147
00151 MailAccount* getAccountByName(const WCHAR* accountName);
00152
00156 MailAccount* getAccountFromMailAddr(const char* mailAddr);
00157
00161 MailAccount* getAccountById(const WCHAR* accountId);
00162
00163
00165 int getAccountNumber();
00166
00167
00173
00174
00180
00181
00187 MailSyncSourceConfig& getMailSyncSourceConfig(){return config;}
00188 void setMailSyncSourceConfig(MailSyncSourceConfig& mssc){config.assign(mssc);}
00189 protected:
00197 virtual int createClientAccount(MailAccount& account) = 0;
00198
00205 virtual int updateClientAccount(const MailAccount& account) = 0;
00206
00213 virtual int deleteClientAccount(const WCHAR* accountID) = 0;
00214
00224 virtual int createClientFolder(FolderData& folder) = 0;
00225
00234 virtual int updateClientFolder(const FolderData& folder) = 0;
00235
00244 virtual int deleteClientFolder(const WCHAR* folderID) = 0;
00245
00246
00248
00249
00251 bool accountExists(const StringBuffer& accountID);
00252
00253
00259 StringBuffer getIdOfFirstAccount();
00260
00262 MailSyncSourceConfig& config;
00263
00264
00265 };
00266
00267
00268 END_NAMESPACE
00269
00271 #endif
00272