diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/utilities.cpp b/utilities.cpp index b2c28f0..10349f4 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -30,30 +30,67 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,c return szRes; } -extern IJabberInterface *JabberInterface[10]; -extern int JabberAccountsCount; +extern JabberAccount Accounts; + +int GetAccountsCount(); int GetJabberInterface(WPARAM, LPARAM) //get interface for all jabber accounts, options later { IJabberInterface *JIftmp[50]; //should it be dynamic ? int count = 0; PROTOACCOUNT **accounts; + JabberAccount *acc = &Accounts; + if(!acc) + acc = new(JabberAccount); ProtoEnumAccounts(&count, &accounts); - JabberAccountsCount = 0; + acc->AccountNumber = 0; for(int i = 0; i < count; i++) { char *tmp = mir_u2a(accounts[i]->tszAccountName); JIftmp[i] = getJabberApi(tmp); + if(!acc) + acc = new(JabberAccount); if(JIftmp[i]) { - JabberInterface[JabberAccountsCount] = JIftmp[i]; - JabberAccountsCount++; + acc->JabberInterface = JIftmp[i]; + acc->AccountName = accounts[i]->tszAccountName; + acc->AccountNumber = i; + acc = acc->next; + acc = new(JabberAccount); } mir_free(tmp); } + if(!GetAccountsCount()) + return 1; //no jabber accounts found return 0; } +BOOL JabberAccount::operator!() +{ + if(!this) + return TRUE; + return FALSE; +} +JabberAccount::JabberAccount() +{ + AccountName = _T(""); + AccountNumber = 0; + +} + +JabberAccount::~JabberAccount() +{ + delete this; +} +int GetAccountsCount() +{ + int i; + JabberAccount *tmp = &Accounts; + for(i = 0; tmp; tmp=tmp->next, i++) + ; + return i; +} + char *date() { |