From 83310365c69bd40365ee0ae0e16c99c28e24cd0b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 14:24:12 +0000 Subject: - all static protocol services replaced with functions; - m_protomod.h removed as useless git-svn-id: http://svn.miranda-ng.org/main/trunk@14260 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/classMAnnivDate.cpp | 6 +-- plugins/UserInfoEx/src/classPsTreeItem.cpp | 26 +++++------ plugins/UserInfoEx/src/commonheaders.h | 3 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 2 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 50 ++++++++++------------ .../src/ex_import/classExImContactBase.cpp | 14 +++--- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 6 +-- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 2 +- plugins/UserInfoEx/src/mir_db.cpp | 24 ++--------- plugins/UserInfoEx/src/mir_db.h | 2 - plugins/UserInfoEx/src/mir_menuitems.cpp | 2 +- plugins/UserInfoEx/src/psp_profile.cpp | 4 +- plugins/UserInfoEx/src/svc_contactinfo.cpp | 2 +- plugins/UserInfoEx/src/svc_email.cpp | 2 +- plugins/UserInfoEx/src/svc_gender.cpp | 2 +- plugins/UserInfoEx/src/svc_homepage.cpp | 2 +- plugins/UserInfoEx/src/svc_phone.cpp | 2 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 19 ++++---- plugins/UserInfoEx/src/svc_timezone_old.cpp | 16 +++---- 21 files changed, 81 insertions(+), 109 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 3b166e29b0..c3a8cee0a6 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -473,7 +473,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) SetFlags(MADF_HASCUSTOM); } // if pszProto is set to NULL, this will be scaned only incase the birthday date has not been found yet - else if (pszProto || (pszProto = DB::Contact::Proto(hContact)) != NULL) + else if (pszProto || (pszProto = Proto_GetBaseAccountName(hContact)) != NULL) { // try to get birthday from basic protocol if (!DBGetDate(hContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) @@ -728,7 +728,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo // A custom birthday was set by user before and is not to be ignored if ((_wFlags & MADF_HASCUSTOM) && (bDontIgnoreAnything || !lastAnswer || (*lastAnswer != IDNONE))) { if (!pszProto) - pszProto = DB::Contact::Proto(hContact); + pszProto = Proto_GetBaseAccountName(hContact); if (pszProto) { BYTE bIsMeta = DB::Module::IsMeta(pszProto); @@ -772,7 +772,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo for (int i = 0; i < nSubContactCount; i++) { MCONTACT hSubContact = db_mc_getSub(hContact, i); if (hSubContact != NULL) { - if (!mdbIgnore.DBGetDate(hSubContact, DB::Contact::Proto(hSubContact), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) + if (!mdbIgnore.DBGetDate(hSubContact, Proto_GetBaseAccountName(hSubContact), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) mdbIgnore.DBWriteDateStamp(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED); DBWriteBirthDate(hSubContact); diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 2231f7c157..f5d6d28d63 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -274,21 +274,21 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) **/ HICON CPsTreeItem::ProtoIcon() { + if (!_pszName) + return NULL; + PROTOACCOUNT **pa; int ProtoCount; - if (!ProtoEnumAccounts(&ProtoCount, &pa)) { - if (_pszName) { - for (int i = 0; i < ProtoCount; i++) { - if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) { - CHAR szIconID[MAX_PATH]; - mir_snprintf(szIconID, SIZEOF(szIconID), "core_status_%s1", pa[i]->szModuleName); - HICON hIco = IcoLib_GetIcon(szIconID); - if (!hIco) - hIco = (HICON)CallProtoService(pa[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL, NULL); - - return hIco; - } - } + Proto_EnumAccounts(&ProtoCount, &pa); + for (int i = 0; i < ProtoCount; i++) { + if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) { + CHAR szIconID[MAX_PATH]; + mir_snprintf(szIconID, SIZEOF(szIconID), "core_status_%s1", pa[i]->szModuleName); + HICON hIco = IcoLib_GetIcon(szIconID); + if (!hIco) + hIco = (HICON)CallProtoService(pa[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL, NULL); + + return hIco; } } return NULL; diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h index d16a2d558f..d8df6855c7 100644 --- a/plugins/UserInfoEx/src/commonheaders.h +++ b/plugins/UserInfoEx/src/commonheaders.h @@ -56,7 +56,6 @@ using namespace std; #include #include #include -#include #include #include #include @@ -222,7 +221,7 @@ static FORCEINLINE BOOL IsProtoOnline(LPSTR pszProto) static FORCEINLINE BOOL IsProtoAccountEnabled(PROTOACCOUNT *pAcc) { - return (pAcc->bIsEnabled && ProtoGetAccount(pAcc->szModuleName)); + return (pAcc->bIsEnabled && Proto_GetAccount(pAcc->szModuleName)); } typedef HRESULT (STDAPICALLTYPE *pfnDwmIsCompositionEnabled)(BOOL *); diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 2c698d806b..23ef5396dd 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -746,7 +746,7 @@ class CAnnivList // ignore meta subcontacts here, as they are not interesting. if (!db_mc_isSub(hContact)) { // filter protocol - pszProto = DB::Contact::Proto(hContact); + pszProto = Proto_GetBaseAccountName(hContact); if (pszProto) { numContacts++; switch (GenderOf(hContact, pszProto)) { diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 0828884142..e43577998e 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -167,8 +167,7 @@ public: int UploadFirst() { // create a list of all protocols which support uploading contact information - if ( ProtoEnumAccounts(&_numProto, &_pPd)) - return _bExitAfterUploading ? UPLOAD_FINISH_CLOSE : UPLOAD_FINISH; + Proto_EnumAccounts(&_numProto, &_pPd); return UploadNext(); } @@ -290,7 +289,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) } else { // get contact's protocol - psh._pszPrefix = psh._pszProto = DB::Contact::Proto(wParam); + psh._pszPrefix = psh._pszProto = Proto_GetBaseAccountName(wParam); if (psh._pszProto == NULL) { MsgErr(NULL, LPGENT("Could not find contact's protocol. Maybe it is not active!")); return 1; @@ -317,7 +316,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) psh._hContact = db_mc_getSub(wParam, i); psh._nSubContact = i; if (psh._hContact) { - psh._pszProto = DB::Contact::Proto(psh._hContact); + psh._pszProto = Proto_GetBaseAccountName(psh._hContact); if ((INT_PTR)psh._pszProto != CALLSERVICE_NOTFOUND) NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); } @@ -561,28 +560,25 @@ void DlgContactInfoInitTreeIcons() // avoid pages from loading doubled if (!(bInitIcons & INIT_ICONS_CONTACT)) { - LPCSTR pszContactProto = NULL; - PROTOACCOUNT **pd; - int ProtoCount = 0; - psh._dwFlags |= PSF_PROTOPAGESONLY_INIT; // enumerate all protocols - if (!ProtoEnumAccounts(&ProtoCount, &pd)) { - for (i = 0; i < ProtoCount; i++) { - // enumerate all contacts - for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) { - // compare contact's protocol to the current one, to add - pszContactProto = DB::Contact::Proto(psh._hContact); - if ((INT_PTR)pszContactProto != CALLSERVICE_NOTFOUND && !mir_strcmp(pd[i]->szModuleName, pszContactProto)) { - // call a notification for the contact to retrieve all protocol specific tree items - NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); - if (psh._pPages) { - psh.Free_pPages(); - psh._dwFlags = PSTVF_INITICONS | PSF_PROTOPAGESONLY; - } - break; + PROTOACCOUNT **pd; + int ProtoCount = 0; + Proto_EnumAccounts(&ProtoCount, &pd); + for (i = 0; i < ProtoCount; i++) { + // enumerate all contacts + for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) { + // compare contact's protocol to the current one, to add + LPCSTR pszContactProto = Proto_GetBaseAccountName(psh._hContact); + if ((INT_PTR)pszContactProto != CALLSERVICE_NOTFOUND && !mir_strcmp(pd[i]->szModuleName, pszContactProto)) { + // call a notification for the contact to retrieve all protocol specific tree items + NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); + if (psh._pPages) { + psh.Free_pPages(); + psh._dwFlags = PSTVF_INITICONS | PSF_PROTOPAGESONLY; } + break; } } } @@ -637,10 +633,10 @@ void DlgContactInfoLoadModule() PROTOACCOUNT **pAcc; int nAccCount; - if (MIRSUCCEEDED(ProtoEnumAccounts(&nAccCount, &pAcc))) - for (int i = 0; (i < nAccCount) && !myGlobals.CanChangeDetails; i++) - if (IsProtoAccountEnabled(pAcc[i])) // update my contact information on icq server - myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, NULL, NULL)); + Proto_EnumAccounts(&nAccCount, &pAcc); + for (int i = 0; (i < nAccCount) && !myGlobals.CanChangeDetails; i++) + if (IsProtoAccountEnabled(pAcc[i])) // update my contact information on icq server + myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, NULL, NULL)); } static void ResetUpdateInfo(LPPS pPs) @@ -1554,7 +1550,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar for (int i = 0; i < numSubs; i++) { MCONTACT hSubContact = db_mc_getSub(pPs->hContact, i); if (hSubContact != NULL) { - if (ProtoServiceExists(DB::Contact::Proto(hSubContact), PSS_GETINFO)) { + if (ProtoServiceExists(Proto_GetBaseAccountName(hSubContact), PSS_GETINFO)) { pPs->infosUpdated = (TAckInfo *)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1)); pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact; pPs->infosUpdated[pPs->nSubContacts].acks = NULL; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index a85bff5d88..0951d07ace 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -94,7 +94,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) if (!_hContact) return TRUE; // Proto - if (!(pszProto = DB::Contact::Proto(_hContact))) return FALSE; + if (!(pszProto = Proto_GetBaseAccountName(_hContact))) return FALSE; _pszProto = mir_strdup(pszProto); // AM_BaseProto @@ -229,21 +229,19 @@ MCONTACT CExImContactBase::toDB() { // create new contact if none exists if (_hContact == INVALID_CONTACT_ID && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { - PROTOACCOUNT* pszAccount = 0; - if (NULL == (pszAccount = ProtoGetAccount( _pszProto ))) { + PROTOACCOUNT *pszAccount = Proto_GetAccount(_pszProto); + if (pszAccount == NULL) { //account does not exist return _hContact = INVALID_CONTACT_ID; } - if (!IsAccountEnabled(pszAccount)) { - ; - } + // create new contact _hContact = DB::Contact::Add(); if (!_hContact) { return _hContact = INVALID_CONTACT_ID; } // Add the protocol to the new contact - if (CallService(MS_PROTO_ADDTOCONTACT, _hContact, (LPARAM)_pszProto)) { + if (Proto_AddToContact(_hContact, _pszProto)) { DB::Contact::Delete(_hContact); return _hContact = INVALID_CONTACT_ID; } @@ -484,7 +482,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) if (!_pszProto) return hContact == NULL; // compare protocols - pszProto = DB::Contact::Proto(hContact); + pszProto = Proto_GetBaseAccountName(hContact); if (pszProto == NULL || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) return FALSE; diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 682110ae8a..374f296123 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -220,7 +220,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar name = (LPCTSTR) pDat->ExImContact->ptszName; break; case EXIM_ACCOUNT: - PROTOACCOUNT* acc = ProtoGetAccount(pDat->ExImContact->pszName); + PROTOACCOUNT* acc = Proto_GetAccount(pDat->ExImContact->pszName); name = (LPCTSTR) acc->tszAccountName; break; } @@ -240,7 +240,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar TreeView_SetItemHeight(hTree, 18); pszProto = (pDat->ExImContact->Typ == EXIM_CONTACT && pDat->ExImContact->hContact != NULL) - ? (LPSTR)DB::Contact::Proto(pDat->ExImContact->hContact) + ? (LPSTR)Proto_GetBaseAccountName(pDat->ExImContact->hContact) : NULL; // add items that are always exported @@ -298,7 +298,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar { // ignore empty modules if (!DB::Module::IsEmpty(hContact, p)) { - pszProto = DB::Contact::Proto(hContact); + pszProto = Proto_GetBaseAccountName(hContact); // Filter by mode switch (pDat->ExImContact->Typ) { diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index 8dff63f5d4..fb0a8ad16e 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -856,7 +856,7 @@ BYTE CVCardFileVCF::Open(MCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode) return FALSE; if ((_hContact = hContact) == INVALID_CONTACT_ID) return FALSE; - if (!(_pszBaseProto = DB::Contact::Proto(_hContact))) + if (!(_pszBaseProto = Proto_GetBaseAccountName(_hContact))) return FALSE; return TRUE; } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 6f5158a941..b2a0a1676f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -177,7 +177,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) break; case EXIM_ACCOUNT: // export only contact with selectet account name - if (!mir_strncmp(ExImContact->pszName, DB::Contact::Proto(hContact), mir_strlen(ExImContact->pszName))) { + if (!mir_strncmp(ExImContact->pszName, Proto_GetBaseAccountName(hContact), mir_strlen(ExImContact->pszName))) { if (vContact.fromDB(hContact)) { vContact.Export(xmlfile, &Modules); } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index b67b99b966..3b7fea78fe 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -60,7 +60,7 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO disp = temp; break; case EXIM_ACCOUNT: - PROTOACCOUNT* acc = ProtoGetAccount(ExImContact->pszName); + PROTOACCOUNT* acc = Proto_GetAccount(ExImContact->pszName); temp = mir_t2a(acc->tszAccountName); disp = temp; break; diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index e54be73d85..17fd80aa2e 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -29,22 +29,6 @@ namespace DB { namespace Contact { -/** -* This function is used to retrieve a contact's basic protocol -* @param hContact - handle to the contact -* @return This function returns the basic protocol of a contact. -**/ - -LPSTR Proto(MCONTACT hContact) -{ - if (hContact) { - INT_PTR result; - result = CallService(MS_PROTO_GETCONTACTBASEACCOUNT, hContact, NULL); - return (LPSTR) ((result == CALLSERVICE_NOTFOUND) ? NULL : result); - } - return NULL; -} - /** * Gets the number of contacts in the database, which does not count the user * @param hContact - handle to the contact @@ -262,7 +246,7 @@ BYTE GetEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetti if (def > -1 && def < INT_MAX) { hSubContact = db_mc_getSub(hContact, def); if (hSubContact != NULL) - result = DB::Setting::GetEx(hSubContact, pszModule, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType) != 0; + result = DB::Setting::GetEx(hSubContact, pszModule, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType) != 0; } // scan all subcontacts for the setting if (result) { @@ -273,7 +257,7 @@ BYTE GetEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetti if (i != def) { hSubContact = db_mc_getSub(hContact, i); if (hSubContact != NULL) - result = DB::Setting::GetEx(hSubContact, pszModule, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType) != 0; + result = DB::Setting::GetEx(hSubContact, pszModule, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType) != 0; } } } } } } return result; @@ -317,7 +301,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps if (def > -1 && def < INT_MAX) { hSubContact = db_mc_getSub(hContact, def); if (hSubContact != NULL) { - wFlags = GetCtrl(hSubContact, pszSubModule, NULL, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType); + wFlags = GetCtrl(hSubContact, pszSubModule, NULL, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); if (wFlags != 0) { wFlags &= ~CTRLF_HASCUSTOM; wFlags |= CTRLF_HASMETA; @@ -332,7 +316,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps if (i != def) { hSubContact = db_mc_getSub(hContact, i); if (hSubContact != NULL) { - wFlags = GetCtrl(hSubContact, pszSubModule, NULL, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType); + wFlags = GetCtrl(hSubContact, pszSubModule, NULL, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); if (wFlags != 0) { wFlags &= ~CTRLF_HASCUSTOM; wFlags |= CTRLF_HASMETA; diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index adb8ef8927..6b83a4e3a5 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -32,8 +32,6 @@ namespace Contact { { return pcli->pfnGetContactDisplayName(hContact, 0); } - LPSTR Proto(MCONTACT hContact); - INT_PTR GetCount(); MCONTACT Add(); diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 08b486726b..29ddc0cea9 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -543,7 +543,7 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) mhRoot = pcli->menuProtos[i].pMenu; if ( mhRoot == NULL ) break; - pAccountName = ProtoGetAccount(pcli->menuProtos[i].szProto); + pAccountName = Proto_GetAccount(pcli->menuProtos[i].szProto); // create service name main (account module name) and set pointer to end it char text[ 200 ]; diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index b65f24b7f9..9ce4fd36ee 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -1140,7 +1140,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR MCONTACT hSubContact, hDefContact; LPCSTR pszSubBaseProto; - if ((hDefContact = db_mc_getSub(hContact, iDefault)) && (pszSubBaseProto = DB::Contact::Proto(hDefContact))) { + if ((hDefContact = db_mc_getSub(hContact, iDefault)) && (pszSubBaseProto = Proto_GetBaseAccountName(hDefContact))) { if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA | CTRLF_HASPROTO)) < 0) return FALSE; @@ -1151,7 +1151,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR continue; if (!(hSubContact = db_mc_getSub(hContact, j))) continue; - if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) + if (!(pszSubBaseProto = Proto_GetBaseAccountName(hSubContact))) continue; if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA | CTRLF_HASPROTO)) < 0) return FALSE; diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index 1219e9ec17..3c53c8e23e 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -343,7 +343,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) CONTACTINFO *ci = (CONTACTINFO*) lParam; INT_PTR result; - if (ci && ci->cbSize == sizeof(CONTACTINFO) && (ci->szProto != NULL || (ci->szProto = DB::Contact::Proto(ci->hContact)) != NULL)) { + if (ci && ci->cbSize == sizeof(CONTACTINFO) && (ci->szProto != NULL || (ci->szProto = Proto_GetBaseAccountName(ci->hContact)) != NULL)) { switch (ci->dwFlag & 0x7F) { // diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 351e36c9f2..d5890f52e6 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -43,7 +43,7 @@ static LPSTR Get(MCONTACT hContact) { // ignore owner if (hContact != NULL) { - LPCSTR pszProto = DB::Contact::Proto(hContact); + LPCSTR pszProto = Proto_GetBaseAccountName(hContact); if (pszProto != NULL) { LPCSTR e[2][4] = { diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index c440d15f3a..71f0f5eee5 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -55,7 +55,7 @@ BYTE GenderOf(MCONTACT hContact, LPCSTR pszProto) BYTE GenderOf(MCONTACT hContact) { - return GenderOf(hContact, DB::Contact::Proto(hContact)); + return GenderOf(hContact, Proto_GetBaseAccountName(hContact)); } /*********************************************************************************************************** diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 33b847f650..e1dede08d9 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -43,7 +43,7 @@ static LPSTR Get(MCONTACT hContact) { // ignore owner if (hContact != NULL) { - LPCSTR pszProto = DB::Contact::Proto(hContact); + LPCSTR pszProto = Proto_GetBaseAccountName(hContact); if (pszProto != NULL) { LPCSTR e[2] = { SET_CONTACT_HOMEPAGE, SET_CONTACT_COMPANY_HOMEPAGE }; for (int i = 0; i < 2; i++) { diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 130976526b..d236757f2c 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -53,7 +53,7 @@ static INT_PTR Get(MCONTACT hContact) // ignore owner if (hContact != NULL) { - LPCSTR pszProto = DB::Contact::Proto(hContact); + LPCSTR pszProto = Proto_GetBaseAccountName(hContact); if (pszProto != NULL) { LPCSTR e[2][4] = { { SET_CONTACT_CELLULAR, SET_CONTACT_PHONE, "MyPhone0" }, diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index ddf2672909..6a99a2ac44 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -629,7 +629,7 @@ class CContactUpdater : public CContactQueue **/ virtual void Callback(MCONTACT hContact, PVOID param) { - LPSTR pszProto = DB::Contact::Proto(hContact); + LPSTR pszProto = Proto_GetBaseAccountName(hContact); if (pszProto && pszProto[0]) { @@ -689,7 +689,7 @@ public: **/ BOOL QueueAddRefreshContact(MCONTACT hContact, int iWait) { - LPSTR pszProto = DB::Contact::Proto(hContact); + LPSTR pszProto = Proto_GetBaseAccountName(hContact); if ((mir_strcmp(pszProto, "Weather") != 0) && (mir_strcmp(pszProto, META_PROTO) != 0) && IsProtoOnline(pszProto)) return Add(iWait, hContact); @@ -763,17 +763,14 @@ static CContactUpdater *ContactUpdater = NULL; **/ static BOOL IsMirandaOnline() { - PROTOACCOUNT **pAcc; - int i, nAccCount; BOOL bIsOnline = FALSE; + PROTOACCOUNT **pAcc; + int nAccCount; + Proto_EnumAccounts(&nAccCount, &pAcc); + + for (int i = 0; (i < nAccCount) && !bIsOnline; i++) + bIsOnline |= (IsProtoAccountEnabled(pAcc[i]) && IsProtoOnline(pAcc[i]->szModuleName)); - if (MIRSUCCEEDED(ProtoEnumAccounts(&nAccCount, &pAcc))) - { - for (i = 0; (i < nAccCount) && !bIsOnline; i++) - { - bIsOnline |= (IsProtoAccountEnabled(pAcc[i]) && IsProtoOnline(pAcc[i]->szModuleName)); - } - } return bIsOnline; } diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index 4056bcb15b..b859507240 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -412,7 +412,7 @@ CTimeZone* GetContactTimeZone(MCONTACT hContact, LPCSTR pszProto) CTimeZone* GetContactTimeZone(MCONTACT hContact) { - return GetContactTimeZone(hContact, DB::Contact::Proto(hContact)); + return GetContactTimeZone(hContact, Proto_GetBaseAccountName(hContact)); } /** @@ -531,13 +531,13 @@ void SvcTimezoneSyncWithWindows() PROTOACCOUNT **pAcc; int nAccCount; - if (MIRSUCCEEDED(ProtoEnumAccounts(&nAccCount, &pAcc))) { - for (int i = 0; i < nAccCount; i++) { - // update local timezone as database setting - if (IsProtoAccountEnabled(pAcc[i]) && SvcTimezoneSyncWithWindowsProc(pAcc[i]->szModuleName, tzi.Bias)) - // update my contact information on icq server - CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, CIXT_LOCATION, NULL); - } + Proto_EnumAccounts(&nAccCount, &pAcc); + + for (int i = 0; i < nAccCount; i++) { + // update local timezone as database setting + if (IsProtoAccountEnabled(pAcc[i]) && SvcTimezoneSyncWithWindowsProc(pAcc[i]->szModuleName, tzi.Bias)) + // update my contact information on icq server + CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, CIXT_LOCATION, NULL); } } -- cgit v1.2.3