From e7b69721b0d390cec3f81f97134a51bfef228cf8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Mar 2018 20:01:30 +0300 Subject: PFLAG_UNIQUEIDSETTING removed, its functionality transferred to Proto_SetUniqueId / Proto_GetUniqueId --- plugins/Actman/iac_contact.pas | 2 +- plugins/CSList/src/cslist.cpp | 8 ++++---- plugins/Clist_nicer/src/extBackg.cpp | 2 +- plugins/ContactsPlus/src/utils.cpp | 4 ++-- plugins/DbEditorPP/src/exportimport.cpp | 12 +++-------- plugins/DbEditorPP/src/main.cpp | 4 ++-- plugins/HistoryPlusPlus/hpp_contacts.pas | 4 ++-- plugins/Import/src/import.cpp | 16 +++++++-------- plugins/ImportTXT/General.pas | 4 ++-- plugins/MenuItemEx/src/main.cpp | 4 +--- plugins/New_GPG/src/utilities.cpp | 8 ++++---- plugins/NewsAggregator/Src/NewsAggregator.cpp | 1 + plugins/NewsAggregator/Src/Services.cpp | 2 -- plugins/Quotes/src/Forex.cpp | 3 +-- plugins/SecureIM/src/crypt_lists.cpp | 3 +-- plugins/SeenPlugin/src/utils.cpp | 8 ++++---- plugins/TipperYM/src/subst.cpp | 4 ++-- .../src/ex_import/classExImContactBase.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 23 ++++++++-------------- plugins/Utils.pas/mircontacts.pas | 16 +++++++-------- plugins/Variables/src/contact.cpp | 2 +- plugins/Variables/src/parse_miranda.cpp | 10 +++++----- plugins/Weather/src/weather.cpp | 1 + plugins/Weather/src/weather_svcs.cpp | 4 ---- plugins/WebView/src/main.cpp | 1 + plugins/WebView/src/webview_services.cpp | 2 -- plugins/XSoundNotify/src/dialog.cpp | 4 ++-- plugins/XSoundNotify/src/options.cpp | 6 +++--- plugins/YAMN/src/main.cpp | 1 + plugins/YAMN/src/services.cpp | 2 -- plugins/mRadio/i_service.inc | 2 -- plugins/mRadio/mradio.dpr | 2 ++ 32 files changed, 72 insertions(+), 95 deletions(-) (limited to 'plugins') diff --git a/plugins/Actman/iac_contact.pas b/plugins/Actman/iac_contact.pas index 02931f7ae9..ffcfd47bd5 100644 --- a/plugins/Actman/iac_contact.pas +++ b/plugins/Actman/iac_contact.pas @@ -115,7 +115,7 @@ begin end else begin - uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0)); + uid:=Proto_GetUniqueId(proto); if DBReadSetting(hContact,proto,uid,@cws)=0 then begin result:=1; diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 2bc27345bb..a63999c415 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -70,8 +70,8 @@ static int OnDbChanged(WPARAM hContact, LPARAM lparam) // if user changes his UIN or JID on any account if (hContact == NULL) { - INT_PTR szUniqueID = CallProtoService(cws->szModule, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (szUniqueID != CALLSERVICE_NOTFOUND && !mir_strcmp(cws->szSetting, (char*)szUniqueID)) + const char *szUniqueID = Proto_GetUniqueId(cws->szModule); + if (!mir_strcmp(cws->szSetting, szUniqueID)) pcli->pfnReloadProtoMenus(); } return 0; @@ -322,7 +322,7 @@ void CSWindow::initIcons() if (pdescr == nullptr) return; - char *szUniqueID = (char*)CallProtoService(m_protoName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *szUniqueID = Proto_GetUniqueId(m_protoName); if (szUniqueID == nullptr) return; @@ -472,7 +472,7 @@ void CSAMWindow::setCombo() if (pdescr == nullptr) return; - char *szUniqueID = (char*)CallProtoService(pdescr->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *szUniqueID = Proto_GetUniqueId(pdescr->szModuleName); if (szUniqueID == nullptr) return; diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 57a70373d5..7b8ff8a8ff 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1286,7 +1286,7 @@ void LoadPerContactSkins(wchar_t *tszFileName) if (szProto == nullptr) continue; - char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *uid = Proto_GetUniqueId(szProto); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != nullptr) { DBVARIANT dbv = { 0 }; if (db_get(hContact, szProto, uid, &dbv)) diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index acc2c47a16..35608b4b86 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -58,8 +58,8 @@ char* __fastcall null_strdup(const char *string) wchar_t* GetContactUID(MCONTACT hContact) { char *szProto = GetContactProto(hContact); - char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == nullptr) + const char *uid = Proto_GetUniqueId(szProto); + if (uid == nullptr) return nullptr; DBVARIANT vrUid; diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 6ae2f27626..b7a404c980 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -124,8 +124,8 @@ char* NickFromHContact(MCONTACT hContact) mir_strncpy(nick, name, _countof(nick)); } else { - char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) { + const char *uid = Proto_GetUniqueId(szProto); + if (uid) { char szUID[FLD_SIZE]; GetValueA(hContact, szProto, uid, szUID, _countof(szUID)); mir_snprintf(nick, "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID); @@ -316,13 +316,7 @@ void importSettings(MCONTACT hContact, char *utf8) if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < _countof(szProto)) { strncpy(szProto, p1 + 1, p2 - p1 - 3); - - char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)protouid != CALLSERVICE_NOTFOUND) { - if (!mir_strcmp(protouid, uid)) - hContact = CheckNewContact(szProto, uid, szUID); - } - else hContact = CheckNewContact(szProto, uid, szUID); + hContact = CheckNewContact(szProto, uid, szUID); } } } diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 9974bcc60c..f72c886360 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -458,8 +458,8 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max case 5: // Unique id if (szProto) { // protocol must define a PFLAG_UNIQUEIDSETTING - char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) + const char *uid = Proto_GetUniqueId(szProto); + if (uid) GetValue(hContact, szProto, uid, name, _countof(name)); } break; diff --git a/plugins/HistoryPlusPlus/hpp_contacts.pas b/plugins/HistoryPlusPlus/hpp_contacts.pas index 331efce404..58386f658a 100644 --- a/plugins/HistoryPlusPlus/hpp_contacts.pas +++ b/plugins/HistoryPlusPlus/hpp_contacts.pas @@ -129,8 +129,8 @@ begin begin if Proto = '' then Proto := GetContactProto(hContact); - uid := PAnsiChar(CallProtoService(PAnsiChar(Proto), PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0)); - if (uid <> pAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then + uid := Proto_GetUniqueId(PAnsiChar(Proto)); + if uid <> nil then begin if db_get(hContact, PAnsiChar(Proto), uid, @dbv) = 0 then begin diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 84a02428d1..6ca7d031bb 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -146,7 +146,7 @@ static MCONTACT HContactFromChatID(char *pszProtoName, const wchar_t *pszChatID) return INVALID_CONTACT_ID; } -static MCONTACT HContactFromNumericID(char *pszProtoName, char *pszSetting, DWORD dwID) +static MCONTACT HContactFromNumericID(char *pszProtoName, const char *pszSetting, DWORD dwID) { for (MCONTACT hContact = dstDb->FindFirstContact(pszProtoName); hContact; hContact = dstDb->FindNextContact(hContact, pszProtoName)) if (db_get_dw(hContact, pszProtoName, pszSetting, 0) == dwID) @@ -155,7 +155,7 @@ static MCONTACT HContactFromNumericID(char *pszProtoName, char *pszSetting, DWOR return INVALID_CONTACT_ID; } -static MCONTACT HContactFromID(char *pszProtoName, char *pszSetting, wchar_t *pwszID) +static MCONTACT HContactFromID(char *pszProtoName, const char *pszSetting, wchar_t *pwszID) { for (MCONTACT hContact = dstDb->FindFirstContact(pszProtoName); hContact; hContact = dstDb->FindNextContact(hContact, pszProtoName)) { ptrW id(db_get_wsa(hContact, pszProtoName, pszSetting)); @@ -401,8 +401,8 @@ static PROTOACCOUNT* FindMyAccount(const char *szProto, const char *szBaseProto, if (ptszName && !mir_wstrcmp(pa->tszAccountName, ptszName)) return pa; - char *pszUniqueSetting = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (!pszUniqueSetting || INT_PTR(pszUniqueSetting) == CALLSERVICE_NOTFOUND) { + const char *pszUniqueSetting = Proto_GetUniqueId(pa->szModuleName); + if (!pszUniqueSetting) { pProto = pa; continue; } @@ -542,7 +542,7 @@ static MCONTACT MapContact(MCONTACT hSrc) return (pDestContact == nullptr) ? INVALID_CONTACT_ID : pDestContact->dstID; } -static MCONTACT AddContact(char *szProto, char *pszUniqueSetting, DBVARIANT *id, const wchar_t *pszUserID, wchar_t *nick, wchar_t *group) +static MCONTACT AddContact(char *szProto, const char *pszUniqueSetting, DBVARIANT *id, const wchar_t *pszUserID, wchar_t *nick, wchar_t *group) { MCONTACT hContact = db_add_contact(); if (Proto_AddToContact(hContact, szProto) != 0) { @@ -798,14 +798,14 @@ static MCONTACT ImportContact(MCONTACT hSrc) } // group chat? - char *pszUniqueSetting; + const char *pszUniqueSetting; bool bIsChat = myGetD(hSrc, cc->szProto, "ChatRoom", 0) != 0; if (bIsChat) pszUniqueSetting = "ChatRoomID"; else { // Skip protocols with no unique id setting (some non IM protocols return NULL) - pszUniqueSetting = (char*)CallProtoService(pda->pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (!pszUniqueSetting || (INT_PTR)pszUniqueSetting == CALLSERVICE_NOTFOUND) { + pszUniqueSetting = Proto_GetUniqueId(pda->pa->szModuleName); + if (!pszUniqueSetting) { AddMessage(LPGENW("Skipping non-IM contact (%S)"), cc->szProto); return NULL; } diff --git a/plugins/ImportTXT/General.pas b/plugins/ImportTXT/General.pas index 0a53d03ffc..76a25be9ae 100644 --- a/plugins/ImportTXT/General.pas +++ b/plugins/ImportTXT/General.pas @@ -354,8 +354,8 @@ begin begin if proto = '' then proto := GetContactProto(hContact); - uid := PAnsiChar(CallProtoService(PAnsiChar(proto), PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0)); - if (uid <> pAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then + uid := Proto_GetUniqueId(PAnsiChar(proto)); + if uid <> nil then begin if db_get(hContact, PAnsiChar(proto), uid, @dbv) = 0 then begin diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index f6238d5cfb..067857dd7b 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -260,9 +260,7 @@ BOOL isMetaContact(MCONTACT hContact) void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID, size_t dwIDSize) { DBVARIANT dbv_uniqueid; - LPSTR uID = (LPSTR)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (uID == (LPSTR)CALLSERVICE_NOTFOUND) - uID = nullptr; + LPCSTR uID = Proto_GetUniqueId(szProto); szID[0] = 0; if (uID && db_get(hContact, szProto, uID, &dbv_uniqueid) == 0) { diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 7ec25605b9..27eef26991 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -1263,9 +1263,9 @@ void ExportGpGKeysFunc(int type) mir_free(k); } - const char* proto = (const char*)GetContactProto(hContact); + const char *proto = GetContactProto(hContact); std::string id = "Comment: login "; - const char * uid = (const char*)CallProtoService(proto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); + const char *uid = Proto_GetUniqueId(proto); DBVARIANT dbv = { 0 }; db_get(0, proto, uid, &dbv); switch (dbv.type) { @@ -1467,7 +1467,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) for (int i = 0; i < acc_count; i++) { if (acc.length()) break; - const char * uid = (const char*)CallProtoService(accs[i]->szModuleName, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); + const char *uid = Proto_GetUniqueId(accs[i]->szModuleName); DBVARIANT dbv = { 0 }; db_get(0, accs[i]->szModuleName, uid, &dbv); std::string id; @@ -1532,7 +1532,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) } } if (acc.length()) { - const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); + const char *uid = Proto_GetUniqueId(acc.c_str()); for (auto &hContact : Contacts(acc.c_str())) { DBVARIANT dbv = { 0 }; db_get(hContact, acc.c_str(), uid, &dbv); diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index 421fe9666b..d0b1547f22 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -112,6 +112,7 @@ struct CMPlugin : public CMPluginBase CMPluginBase(MODULE) { RegisterProtocol(PROTOTYPE_VIRTUAL); + SetUniqueId("URL"); } } g_plugin; diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 36e25ba073..bf9030bb6f 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -83,8 +83,6 @@ INT_PTR NewsAggrGetCaps(WPARAM wp, LPARAM) return PF4_AVATARS; case PFLAG_UNIQUEIDTEXT: return (INT_PTR) "News Feed"; - case PFLAG_UNIQUEIDSETTING: - return (INT_PTR) "URL"; default: return 0; } diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 7a99cd754d..55c5e6379b 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -241,8 +241,6 @@ INT_PTR QuoteProtoFunc_GetCaps(WPARAM wParam, LPARAM) switch (wParam) { case PFLAG_UNIQUEIDTEXT: return (INT_PTR)Translate("Quote Symbol"); - case PFLAG_UNIQUEIDSETTING: - return (INT_PTR)DB_STR_QUOTE_SYMBOL; } return 0; @@ -346,6 +344,7 @@ struct CMPlugin : public CMPluginBase CMPluginBase(QUOTES_PROTOCOL_NAME) { RegisterProtocol(PROTOTYPE_VIRTUAL); + SetUniqueId(DB_STR_QUOTE_SYMBOL); } } g_plugin; diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 29bc80c0b9..5844557134 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -208,8 +208,7 @@ void getContactUinA(MCONTACT hContact, LPSTR szUIN) return; DBVARIANT dbv_uniqueid; - LPSTR uID = (LPSTR)CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = nullptr; // Billy_Bons + LPCSTR uID = Proto_GetUniqueId(ptr->name); if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) { if (dbv_uniqueid.type == DBVT_WORD) sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name); //!!!!!!!!!!! diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 5537de86dc..22af9a35b4 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -70,7 +70,7 @@ int IsWatchedProtocol(const char* szProto) BOOL isYahoo(char *protoname) { if (protoname) { - char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *pszUniqueSetting = Proto_GetUniqueId(protoname); if (pszUniqueSetting) return !mir_strcmp(pszUniqueSetting, "yahoo_id"); } @@ -80,7 +80,7 @@ BOOL isYahoo(char *protoname) BOOL isJabber(char *protoname) { if (protoname) { - char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *pszUniqueSetting = Proto_GetUniqueId(protoname); if (pszUniqueSetting) return !mir_strcmp(pszUniqueSetting, "jid"); } @@ -90,7 +90,7 @@ BOOL isJabber(char *protoname) BOOL isICQ(char *protoname) { if (protoname) { - char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *pszUniqueSetting = Proto_GetUniqueId(protoname); if (pszUniqueSetting) return !mir_strcmp(pszUniqueSetting, "UIN"); } @@ -100,7 +100,7 @@ BOOL isICQ(char *protoname) BOOL isMSN(char *protoname) { if (protoname) { - char *pszUniqueSetting = (char*)CallProtoService(protoname, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *pszUniqueSetting = Proto_GetUniqueId(protoname); if (pszUniqueSetting) return !mir_strcmp(pszUniqueSetting, "e-mail"); } diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index bc153af624..e50a1c808a 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -142,8 +142,8 @@ bool Uid(MCONTACT hContact, char *szProto, wchar_t *buff, int bufflen) { char *tmpProto = (hContact ? GetContactProto(hContact) : szProto); if (tmpProto) { - char *szUid = (char*)CallProtoService(tmpProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (szUid && (INT_PTR)szUid != CALLSERVICE_NOTFOUND) + const char *szUid = Proto_GetUniqueId(tmpProto); + if (szUid) return DBGetContactSettingAsString(hContact, tmpProto, szUid, buff, bufflen); } diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 23c19e0e3d..bd1829e228 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -113,7 +113,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) } // unique id (normal) else { - uidSetting = (LPCSTR)CallProtoService(pszProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + uidSetting = Proto_GetUniqueId(pszProto); // valid if (uidSetting != nullptr && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { _pszUIDKey = mir_strdup(uidSetting); diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index 38e55fceec..eab2949fe4 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -1074,26 +1074,19 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) // // contacts protocol, uin setting, uin value // - { + LPCSTR uid = Proto_GetUniqueId(_pszBaseProto); + if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) { CHAR szUID[MAXUID]; - LPCSTR uid; - - uid = (LPCSTR)CallProtoService(_pszBaseProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) { - if (!db_get_static(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID))) - fprintf(_pFile, "IM;%s;%s:%s\n", _pszBaseProto, uid, szUID); - } + if (!db_get_static(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID))) + fprintf(_pFile, "IM;%s;%s:%s\n", _pszBaseProto, uid, szUID); } - + // // time of creation // - { - SYSTEMTIME st; - - GetLocalTime(&st); - fprintf(_pFile, "REV:%04d%02d%02dD%02d%02d%02dT\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - } + SYSTEMTIME st; + GetLocalTime(&st); + fprintf(_pFile, "REV:%04d%02d%02dD%02d%02d%02dT\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); fputs("END:VCARD", _pFile); return 0; diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index 8847ea96f0..44a8441857 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -127,8 +127,8 @@ begin begin if Proto = nil then Proto := GetContactProto(hContact); - uid := PAnsiChar(CallProtoService(Proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0)); - if (uid <> PAnsiChar(CALLSERVICE_NOTFOUND)) and (uid <> nil) then + uid := Proto_GetUniqueId(Proto); + if (uid <> nil) then begin // db_get_s comparing to DBGetContactSetting don't translate strings // when uType=0 (DBVT_ASIS) @@ -275,8 +275,8 @@ begin uid:=nil; if not is_chat then begin - uid:=PAnsiChar(CallProtoService(Proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0)); - if uid=PAnsiChar(CALLSERVICE_NOTFOUND) then exit; + uid:=Proto_GetUniqueId(Proto); + if uid=nil then exit; end; hContact:=db_find_first(); @@ -371,8 +371,8 @@ begin end else begin - uid:=PAnsiChar(CallProtoService(Proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0)); - if uid<>PAnsiChar(CALLSERVICE_NOTFOUND) then + uid:=Proto_GetUniqueId(Proto); + if uid<>nil then begin if DBReadSetting(hContact,Proto,uid,@cws)=0 then begin @@ -540,8 +540,8 @@ begin end else begin - uid:=PAnsiChar(CallProtoService(acc,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0)); - if uid<>PAnsiChar(CALLSERVICE_NOTFOUND) then + uid:=Proto_GetUniqueId(acc); + if uid<>nil then begin if DBReadSetting(hContact,acc,uid,@ldbv)=0 then begin diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 52ecf66950..6a49e0b4f5 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -309,7 +309,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam) if (szProto == nullptr) return 0; - char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + const char *uid = Proto_GetUniqueId(szProto); bool isNick = !strcmp(dbw->szSetting, "Nick"); bool isFirstName = !strcmp(dbw->szSetting, "FirstName"); diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 0dad8e92a0..43610db3fc 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -343,20 +343,20 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai) if (ai->argc != 3) return nullptr; - char *szRes = nullptr; + const char *szRes = nullptr; wchar_t *tszRes = nullptr; ptrA szProto(mir_u2a(ai->targv[1])); if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME))) tszRes = Hlp_GetProtocolName(szProto); else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) { - szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0); - if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND) + szRes = (const char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0); + if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND || szRes == nullptr) return nullptr; } else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) { - szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); - if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND) + szRes = Proto_GetUniqueId(szProto); + if (szRes == nullptr) return nullptr; } else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK))) diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 1a01b18802..00ceba9e93 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -241,6 +241,7 @@ struct CMPlugin : public CMPluginBase { opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true); RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL); + SetUniqueId("ID"); } } g_plugin; diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index 83521bb0d5..194975bd4a 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -79,10 +79,6 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM) case PFLAG_UNIQUEIDTEXT: ret = (INT_PTR)Translate("Station ID"); break; - - case PFLAG_UNIQUEIDSETTING: - ret = (INT_PTR)"ID"; - break; } return ret; } diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 712dc64f0c..ae13134832 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -292,6 +292,7 @@ struct CMPlugin : public CMPluginBase CMPluginBase(MODULENAME) { RegisterProtocol(PROTOTYPE_PROTOCOL); + SetUniqueId("PreserveName"); } } g_plugin; diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 6a3197e425..3d0f27c556 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -211,8 +211,6 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM) return PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT|PF2_OUTTOLUNCH|PF2_ONTHEPHONE; case PFLAG_UNIQUEIDTEXT: return (INT_PTR)Translate("Site URL"); - case PFLAG_UNIQUEIDSETTING: - return (INT_PTR)"PreserveName"; default: return 0; } diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 8c1dafa8de..6d96d971e1 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -24,8 +24,8 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg"); char* szProto = GetContactProto(hContact); PROTOACCOUNT *pa = Proto_GetAccount(szProto); - char* szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != nullptr) { + const char* szUniqueId = Proto_GetUniqueId(pa->szModuleName); + if (szUniqueId != nullptr) { DBVARIANT dbvuid = { 0 }; if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) { wchar_t uid[MAX_PATH]; diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index ef8eb7c084..cc8f91796b 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -52,12 +52,12 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)TranslateT("All contacts")), cursel); for (auto &hContact : Contacts()) { - char *szUniqueId = nullptr; + const char *szUniqueId; if (db_get_b(hContact, pa->szModuleName, "ChatRoom", 0)) szUniqueId = "ChatRoomID"; else - szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ((INT_PTR)szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != nullptr) { + szUniqueId = Proto_GetUniqueId(pa->szModuleName); + if (szUniqueId != nullptr) { DBVARIANT dbvuid = { 0 }; if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) { wchar_t uid[MAX_PATH]; diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 1e5a26ecb9..edfbf9c6ec 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -368,6 +368,7 @@ struct CMPlugin : public CMPluginBase CMPluginBase(YAMN_DBMODULE) { RegisterProtocol(PROTOTYPE_VIRTUAL); + SetUniqueId("Id"); } } g_plugin; diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index c667d3df4a..d6d4cb6a9e 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -8,8 +8,6 @@ static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM) return (INT_PTR) Translate("Nick"); if (wParam == PFLAG_MAXLENOFMESSAGE) return 400; - if (wParam == PFLAG_UNIQUEIDSETTING) - return (INT_PTR) "Id"; if (wParam == PFLAGNUM_2) return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND; if (wParam == PFLAGNUM_5) { diff --git a/plugins/mRadio/i_service.inc b/plugins/mRadio/i_service.inc index 9b953c40e7..894392716d 100644 --- a/plugins/mRadio/i_service.inc +++ b/plugins/mRadio/i_service.inc @@ -13,8 +13,6 @@ begin result:=PF4_NOCUSTOMAUTH or PF4_AVATARS; PFLAG_UNIQUEIDTEXT: result:=int_ptr(Translate('Radio station URL')); - PFLAG_UNIQUEIDSETTING: - result:=int_ptr(optStationURL) else result:=0; end diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr index 9f55ee4f2b..a61dae29c5 100644 --- a/plugins/mRadio/mradio.dpr +++ b/plugins/mRadio/mradio.dpr @@ -211,5 +211,7 @@ begin desc._type :=PROTOTYPE_VIRTUAL; Proto_RegisterModule(@desc); + Proto_SetUniqueId(PluginName,optStationURL); + DisableThreadLibraryCalls(hInstance); end. -- cgit v1.2.3