From 0c508d74bee722c4d0032b33377a1305b484027a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Dec 2018 20:28:13 +0300 Subject: obsolte perversion with PF4_INFOSETTINGSVC removed --- src/core/stduserinfo/src/stdinfo.cpp | 33 +++------------------------------ src/mir_app/src/contacts.cpp | 28 +++++++--------------------- 2 files changed, 10 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 2bea6486fe..41b8e50c7a 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -36,42 +36,16 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP #define SVS_TIMEZONE 7 #define SVS_MARITAL 8 -static int Proto_GetContactInfoSetting(MCONTACT hContact, const char *szProto, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType) -{ - DBCONTACTGETSETTING cgs = { szModule, szSetting, dbv }; - dbv->type = (BYTE)nType; - - return CallProtoService(szProto, PS_GETINFOSETTING, hContact, (LPARAM)&cgs); -} - -static wchar_t* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hContact, const char *szModule, const char *szSetting) -{ - if (!proto_service) - return db_get_wsa(hContact, szModule, szSetting); - - DBVARIANT dbv; - DBCONTACTGETSETTING cgs = { szModule, szSetting, &dbv }; - dbv.type = DBVT_WCHAR; - if (CallProtoService(szModule, PS_GETINFOSETTING, hContact, (LPARAM)&cgs)) - return nullptr; - - return dbv.pwszVal; -} - static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special) { char str[80], *pstr = nullptr; wchar_t *ptstr = nullptr; - char *szProto = GetContactProto(hContact); - bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC); DBVARIANT dbv = { DBVT_DELETED }; int unspecified; if (szModule == nullptr) unspecified = 1; - else if (proto_service) - unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0); else unspecified = db_get_s(hContact, szModule, szSetting, &dbv, 0); @@ -435,7 +409,6 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (szProto == nullptr) break; - bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC; SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "Homepage", SVS_ZEROISUNSPEC); // past @@ -445,7 +418,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem = 0; for (int i = 0;; i++) { mir_snprintf(idstr, "Past%d", i); - ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr)); + ptrW tszColText(db_get_wsa(hContact, szProto, idstr)); if (tszColText == NULL) break; mir_snprintf(idstr, "Past%dText", i); @@ -462,7 +435,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, // affiliation for (int i = 0;; i++) { mir_snprintf(idstr, "Affiliation%d", i); - ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr)); + ptrW tszColText(db_get_wsa(hContact, szProto, idstr)); if (tszColText == NULL) break; mir_snprintf(idstr, "Affiliation%dText", i); @@ -485,7 +458,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem = 0; for (int i = 0;; i++) { mir_snprintf(idstr, "Interest%dCat", i); - ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr)); + ptrW tszColText(db_get_wsa(hContact, szProto, idstr)); if (tszColText == NULL) break; mir_snprintf(idstr, "Interest%dText", i); diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 447af7ea02..320012762c 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -40,24 +40,10 @@ static wchar_t* nameOrderDescr[ NAMEORDERCOUNT ] = BYTE nameOrder[NAMEORDERCOUNT]; -static int GetDatabaseString(MCONTACT hContact, const char *szProto, const char *szSetting, DBVARIANT *dbv) -{ - if (mir_strcmp(szProto, "CList") && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) { - DBCONTACTGETSETTING cgs = { szProto, szSetting, dbv }; - dbv->type = DBVT_WCHAR; - - INT_PTR res = CallProtoService(szProto, PS_GETINFOSETTING, (WPARAM)hContact, (LPARAM)&cgs); - if (res != CALLSERVICE_NOTFOUND) - return res; - } - - return db_get_ws(hContact, szProto, szSetting, dbv); -} - static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto, const char *szSetting) { DBVARIANT dbv; - if (!GetDatabaseString(hContact, szProto, szSetting, &dbv)) { + if (!db_get_ws(hContact, szProto, szSetting, &dbv)) { switch (dbv.type) { case DBVT_ASCIIZ: if (!dbv.pszVal[0]) break; @@ -144,7 +130,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s case CNF_COUNTRY: case CNF_COCOUNTRY: - if (!GetDatabaseString(hContact, szProto, type == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv)) + if (!db_get_ws(hContact, szProto, type == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv)) return dbv.pwszVal; if (!db_get(hContact, szProto, type == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) { @@ -164,9 +150,9 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s break; case CNF_FIRSTLAST: - if (!GetDatabaseString(hContact, szProto, "FirstName", &dbv)) { + if (!db_get_ws(hContact, szProto, "FirstName", &dbv)) { DBVARIANT dbv2; - if (!GetDatabaseString(hContact, szProto, "LastName", &dbv2)) { + if (!db_get_ws(hContact, szProto, "LastName", &dbv2)) { size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2; WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len); if (buf != nullptr) @@ -232,7 +218,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s // protocol must define a PFLAG_UNIQUEIDSETTING uid = Proto_GetUniqueId(szProto); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) { - if (!GetDatabaseString(hContact, szProto, uid, &dbv)) { + if (!db_get_ws(hContact, szProto, uid, &dbv)) { if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) { long value = (dbv.type == DBVT_BYTE) ? dbv.bVal : (dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal); WCHAR buf[40]; @@ -246,9 +232,9 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s case 6: // first + last name case 7: // last + first name - if (!GetDatabaseString(hContact, szProto, nameOrder[i] == 6 ? "FirstName" : "LastName", &dbv)) { + if (!db_get_ws(hContact, szProto, nameOrder[i] == 6 ? "FirstName" : "LastName", &dbv)) { DBVARIANT dbv2; - if (!GetDatabaseString(hContact, szProto, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) { + if (!db_get_ws(hContact, szProto, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) { size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2; WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len); if (buf != nullptr) -- cgit v1.2.3