diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-06-14 13:55:25 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-06-14 13:55:25 +0300 |
commit | e073c336539d16e57c73a4620107ecffae70d927 (patch) | |
tree | 349017c55f1d3eb8449ad435966486dfe443e0c9 | |
parent | 6ec5421c044db31546e3a364ba502cf8b5dd6c5f (diff) |
this code wotking...., strange ...., very strange...., maybe i am litle ill ?
-rw-r--r-- | init.cpp | 4 | ||||
-rw-r--r-- | utilities.cpp | 47 | ||||
-rw-r--r-- | utilities.h | 11 |
3 files changed, 56 insertions, 6 deletions
@@ -24,7 +24,9 @@ static HANDLE hAccountsChanges; PLUGINLINK *pluginLink; static int OnModulesLoaded(WPARAM wParam,LPARAM lParam); extern char *date(); -IJabberInterface *JabberInterface[10]; +//IJabberInterface *JabberInterface[10]; +JabberAccount Accounts; +//TCHAR *JabberAccountName int JabberAccountsCount = 0; struct MM_INTERFACE mmi; 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() { diff --git a/utilities.h b/utilities.h index 58374c8..0325f51 100644 --- a/utilities.h +++ b/utilities.h @@ -1,4 +1,15 @@ #ifndef UTILITIES_H #define UTILITIES_H TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef); +class JabberAccount { +public: + JabberAccount(); + ~JabberAccount(); + TCHAR *AccountName; + int AccountNumber; + IJabberInterface *JabberInterface; + class JabberAccount *next; + BOOL operator !(); +}; + #endif |