From dcfea2fd7445ce4e28e9973403aeffb8e7675d6a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Dec 2023 17:07:11 +0300 Subject: CallContactService - useful helper exported from mir_app --- include/m_core.h | 1 + libs/win32/mir_app.lib | Bin 276564 -> 276800 bytes libs/win64/mir_app.lib | Bin 275870 -> 276086 bytes src/core/stduserinfo/src/userinfo.cpp | 4 ++-- src/mir_app/src/addcontact.cpp | 10 +++++----- src/mir_app/src/clc.cpp | 2 +- src/mir_app/src/clcfiledrop.cpp | 2 +- src/mir_app/src/clisttray.cpp | 2 +- src/mir_app/src/clui.cpp | 4 ++-- src/mir_app/src/findadd.cpp | 20 ++++++++++---------- src/mir_app/src/ignore.cpp | 4 ++-- src/mir_app/src/menu_clist.cpp | 6 +++--- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_app/src/miranda.h | 2 -- src/mir_app/src/proto_chains.cpp | 12 ++++++------ src/mir_app/src/protocols.cpp | 14 +++++++------- src/mir_app/src/searchresults.cpp | 12 ++++++------ src/mir_app/src/skinicons.cpp | 2 +- src/mir_app/src/visibility.cpp | 2 +- 20 files changed, 51 insertions(+), 50 deletions(-) diff --git a/include/m_core.h b/include/m_core.h index d4fd0f197a..26dc016dae 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -147,6 +147,7 @@ MIR_CORE_DLL(void) KillObjectServices(void* pObject); MIR_APP_DLL(int) ProtoServiceExists(const char *szModule, const char *szService); MIR_APP_DLL(INT_PTR) CallProtoService(const char *szModule, const char *szService, WPARAM wParam = 0, LPARAM lParam = 0); +MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam = 0, LPARAM lParam = 0); /////////////////////////////////////////////////////////////////////////////// // exceptions diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index a348e78163..2325f93e40 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 0b3f8fe898..df4aa97f0b 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 457cd949a5..7782eab3fb 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -555,8 +555,8 @@ public: m_infosUpdated = NULL; } - if (m_hContact != NULL) - if (!ProtoChainSend(m_hContact, PSS_GETINFO, 0, 0)) { + if (const char *szProto = GetProto()) + if (!CallContactService(m_hContact, szProto, PSS_GETINFO)) { btnUpdate.Disable(); ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_SHOW); updateTimer.Start(100); diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index ad55172acc..1b1bb77f21 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -89,7 +89,7 @@ public: if (db_get_b(0, "Miranda", "AuthOpenWindow", 1)) m_chkOpen.SetState(true); - uint32_t flags = (m_szProto) ? CallProtoServiceInt(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0; + uint32_t flags = (m_szProto) ? CallContactService(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0; if (flags & PF4_FORCEAUTH) // force auth requests for this protocol m_chkAuth.Disable(); @@ -108,7 +108,7 @@ public: MCONTACT hContact = 0; if (m_hDbEvent) - hContact = (MCONTACT)CallProtoServiceInt(0, m_szProto, PS_ADDTOLISTBYEVENT, 0, m_hDbEvent); + hContact = (MCONTACT)CallContactService(0, m_szProto, PS_ADDTOLISTBYEVENT, 0, m_hDbEvent); else if (m_psr) { if (!wszHandle.IsEmpty()) { CMStringW wszFirstName, wszLastName; @@ -126,7 +126,7 @@ public: replaceStrW(m_psr->lastName.w, wszLastName.Detach()); } - hContact = (MCONTACT)CallProtoServiceInt(0, m_szProto, PS_ADDTOLIST, 0, (LPARAM)m_psr); + hContact = (MCONTACT)CallContactService(0, m_szProto, PS_ADDTOLIST, 0, (LPARAM)m_psr); } else hContact = m_hContact; @@ -143,7 +143,7 @@ public: Contact::PutOnList(hContact); if (m_chkAuth.GetState()) { - uint32_t flags = CallProtoServiceInt(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0); + uint32_t flags = CallContactService(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0); if (flags & PF4_NOCUSTOMAUTH) ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, 0); else @@ -162,7 +162,7 @@ public: void OnAuthClicked(CCtrlButton*) { - uint32_t flags = CallProtoServiceInt(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0); + uint32_t flags = CallContactService(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0); if (flags & PF4_NOCUSTOMAUTH) m_authReq.Enable(false); else diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index ecc1409a75..eac546954e 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -139,7 +139,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) if ((INT_PTR)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) { // if we're going offline, kill all contacts scheduled for deletion - uint32_t caps = (uint32_t)CallProtoServiceInt(0, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t caps = (uint32_t)CallContactService(0, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_SERVERCLIST) { for (MCONTACT hContact = db_find_first(ack->szModule); hContact; ) { MCONTACT hNext = db_find_next(hContact, ack->szModule); diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp index 840a046eae..6863a4e8d9 100644 --- a/src/mir_app/src/clcfiledrop.cpp +++ b/src/mir_app/src/clcfiledrop.cpp @@ -82,7 +82,7 @@ static MCONTACT HContactFromPoint(HWND hwnd, ClcData *dat, int x, int y, int *hi if (szProto == nullptr) return 0; - uint32_t protoCaps = CallProtoServiceInt(0,szProto, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t protoCaps = CallContactService(0,szProto, PS_GETCAPS, PFLAGNUM_1, 0); if (!(protoCaps & PF1_FILESEND)) return 0; if (ID_STATUS_OFFLINE == db_get_w(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE)) diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 454c15fbff..335c9b2016 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -52,7 +52,7 @@ static wchar_t* sttGetXStatus(const char *szProto) CUSTOM_STATUS cs = { sizeof(cs) }; cs.flags = CSSF_MASK_MESSAGE | CSSF_UNICODE; cs.ptszMessage = tszStatus; - if (CallProtoServiceInt(0, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) + if (CallContactService(0, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) return mir_wstrdup(tszStatus); } diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 39015a1819..39e41e41b3 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -62,7 +62,7 @@ void fnLoadCluiGlobalOpts() static void DisconnectAll() { for (auto &it : g_arAccounts) - CallProtoServiceInt(0, it->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0); + CallContactService(0, it->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0); } static int CluiIconsChanged(WPARAM, LPARAM) @@ -194,7 +194,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) char *szProto = Proto_GetBaseAccountName(wParam); if (szProto != nullptr) { // Check if protocol uses server side lists - uint32_t caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t caps = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_SERVERCLIST) { int status = Proto_GetStatus(szProto); if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status)) { diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 4830a35cd3..0289b5befd 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -220,7 +220,7 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) if (dat->hwndAdvSearch == nullptr) { RECT rc; - dat->hwndAdvSearch = (HWND)CallProtoServiceInt(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); + dat->hwndAdvSearch = (HWND)CallContactService(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); if (dat->hwndAdvSearch != nullptr) mir_subclassWindow(dat->hwndAdvSearch, AdvancedSearchDlgSubclassProc); GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc); @@ -256,7 +256,7 @@ static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) return; if (dat->hwndTinySearch == nullptr) { - dat->hwndTinySearch = (HWND)CallProtoServiceInt(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); + dat->hwndTinySearch = (HWND)CallContactService(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); if (dat->hwndTinySearch) ReposTinySearchDlg(hwndDlg, dat); else @@ -373,7 +373,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!pa->IsEnabled()) continue; - uint32_t caps = (uint32_t)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t caps = (uint32_t)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_ANYSEARCH) netProtoCount++; } @@ -400,7 +400,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!pa->IsEnabled()) continue; - uint32_t caps = (uint32_t)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t caps = (uint32_t)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps & PF1_ANYSEARCH)) continue; @@ -409,7 +409,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (textSize.cx > cbwidth) cbwidth = textSize.cx; - HICON hIcon = (HICON)CallProtoServiceInt(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); + HICON hIcon = (HICON)CallContactService(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(dat->himlComboIcons, hIcon); DestroyIcon(hIcon); cbei.lParam = (LPARAM)pa->szModuleName; @@ -474,14 +474,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (szProto == nullptr) { for (auto &pa : g_arAccounts) { if (pa->IsEnabled()) { - uint32_t protoCaps = (uint32_t)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t protoCaps = (uint32_t)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1; } } } else { - uint32_t protoCaps = (uint32_t)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t protoCaps = (uint32_t)CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_BASICSEARCH) dat->showProtoId = 1; if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1; @@ -491,7 +491,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; } if (dat->showProtoId) { - wchar_t *wszUniqueId = (wchar_t *)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + wchar_t *wszUniqueId = (wchar_t *)CallContactService(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (wszUniqueId) SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, wszUniqueId); else @@ -986,7 +986,7 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) if (!pa->IsEnabled()) continue; - int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int protoCaps = CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; } @@ -1028,7 +1028,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) // Make sure we have some networks to search on. for (auto &pa : g_arAccounts) { - int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int protoCaps = CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; } diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index df84141dfc..363ce9d420 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -187,8 +187,8 @@ static void SetAllContactIcons(HWND hwndList) uint32_t proto1Caps, proto4Caps; char *szProto = Proto_GetBaseAccountName(hContact); if (szProto) { - proto1Caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); - proto4Caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0); + proto1Caps = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + proto4Caps = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0); } else proto1Caps = proto4Caps = 0; InitialiseItem(hwndList, hContact, hItem, proto1Caps, proto4Caps); diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index bf94b21017..82eb9230df 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -407,7 +407,7 @@ static INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) CUSTOM_STATUS cs = { sizeof(cs) }; cs.flags = CSSF_MASK_STATUS; cs.status = &XStatus; - if (CallProtoServiceInt(0, smep->szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0) + if (CallContactService(0, smep->szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0) XStatus = 0; char buf[255]; @@ -517,7 +517,7 @@ static INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) acc->bIsLocked = !acc->bIsLocked; db_set_b(0, prot, "LockMainStatus", acc->bIsLocked); - CallProtoServiceInt(0, smep->szProto, PS_GETNAME, _countof(szHumanName), (LPARAM)szHumanName); + CallContactService(0, smep->szProto, PS_GETNAME, _countof(szHumanName), (LPARAM)szHumanName); TMO_IntMenuItem *pimi = MO_GetIntMenuItem(smep->pimi); if (pimi == nullptr) @@ -711,7 +711,7 @@ void RebuildMenuOrder(void) CMenuItem mi(&g_plugin); mi.flags = CMIF_UNICODE | CMIF_KEEPUNTRANSLATED; mi.position = pos++; - mi.hIcon = ic = (HICON)CallProtoServiceInt(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); + mi.hIcon = ic = (HICON)CallContactService(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); if (pa->IsLocked()) { mir_snwprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 889d6acbf5..705e7ba2ea 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -921,3 +921,4 @@ Clist_GroupSaveExpanded @1003 NONAME ?GetReceivedFolder@File@@YGPA_WIPA_WI_N@Z @1039 NONAME ?DlgProc@CUserInfoPageDlg@@UAEHIIJ@Z @1040 NONAME ?wipeNotify@EventInfo@DB@@QAEXI@Z @1047 NONAME +_CallContactService@20 @1048 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 6ec4da466d..6e06ba8f4a 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -921,3 +921,4 @@ Clist_GroupSaveExpanded @1003 NONAME ?GetReceivedFolder@File@@YAPEA_WIPEA_W_K_N@Z @1039 NONAME ?DlgProc@CUserInfoPageDlg@@UEAA_JI_K_J@Z @1040 NONAME ?wipeNotify@EventInfo@DB@@QEAAXI@Z @1041 NONAME +CallContactService @1042 NONAME diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index b5c52dbdac..8aa06c8627 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -187,8 +187,6 @@ void WriteDbAccounts(void); void InitStaticAccounts(); -INT_PTR CallProtoServiceInt(MCONTACT hContact, const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam); - INT_PTR stubChainRecv(WPARAM, LPARAM); #define MS_PROTO_HIDDENSTUB "Proto/stubChainRecv" diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index 69b5adc285..df6dee8c0d 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -61,7 +61,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs) return 1; for (int i = iOrder; i < g_arFilters.getCount(); i++) { - if ((ret = CallProtoServiceInt(0, g_arFilters[i]->szName, ccs->szProtoService, i + 1, LPARAM(ccs))) != CALLSERVICE_NOTFOUND) { + if ((ret = CallContactService(0, g_arFilters[i]->szName, ccs->szProtoService, i + 1, LPARAM(ccs))) != CALLSERVICE_NOTFOUND) { //chain was started, exit return ret; } @@ -76,9 +76,9 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs) return 1; if (pa->bOldProto) - ret = CallProtoServiceInt(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs); + ret = CallContactService(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs); else - ret = CallProtoServiceInt(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam); + ret = CallContactService(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam); if (ret == CALLSERVICE_NOTFOUND) ret = 1; @@ -111,7 +111,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs) else iOrder--; for (int i = iOrder - 1; i >= 0; i--) - if ((ret = CallProtoServiceInt(0, g_arFilters[i]->szName, ccs->szProtoService, i + 1, (LPARAM)ccs)) != CALLSERVICE_NOTFOUND) + if ((ret = CallContactService(0, g_arFilters[i]->szName, ccs->szProtoService, i + 1, (LPARAM)ccs)) != CALLSERVICE_NOTFOUND) //chain was started, exit return ret; @@ -125,9 +125,9 @@ MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs) return 1; if (pa->bOldProto) - ret = CallProtoServiceInt(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs); + ret = CallContactService(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs); else - ret = CallProtoServiceInt(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam); + ret = CallContactService(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam); if (ret == CALLSERVICE_NOTFOUND) ret = 1; diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 5ce2306a5f..3da908709c 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -195,7 +195,7 @@ static int Proto_ValidTypingContact(MCONTACT hContact, char *szProto) if (!hContact || !szProto) return 0; - return (CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0; + return (CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0; } static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) @@ -206,7 +206,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) return 0; if (Proto_ValidTypingContact(wParam, szProto)) - CallProtoServiceInt(0, szProto, PSS_USERISTYPING, wParam, lParam); + CallContactService(0, szProto, PSS_USERISTYPING, wParam, lParam); } return 0; @@ -233,11 +233,11 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) void Proto_SetStatus(const char *szProto, unsigned status) { - if (CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) { + if (CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) { ptrW tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto)); - CallProtoServiceInt(0, szProto, PS_SETAWAYMSG, status, tszAwayMsg); + CallContactService(0, szProto, PS_SETAWAYMSG, status, tszAwayMsg); } - CallProtoServiceInt(0, szProto, PS_SETSTATUS, status, 0); + CallContactService(0, szProto, PS_SETSTATUS, status, 0); } char** __fastcall Proto_FilesMatrixA(wchar_t **files) @@ -384,10 +384,10 @@ MIR_APP_DLL(int) ProtoServiceExists(const char *szModule, const char *szService) MIR_APP_DLL(INT_PTR) CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam) { - return CallProtoServiceInt(0, szModule, szService, wParam, lParam); + return CallContactService(0, szModule, szService, wParam, lParam); } -INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam) { auto *ppi = Proto_GetInstance(szModule); if (ppi != nullptr) { diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 892ec2c7dd..9968333c6e 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -73,7 +73,7 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) if (i == COLUMNID_HANDLE) { lvc.pszText = L"ID"; if (szProto) { - INT_PTR ret = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + INT_PTR ret = CallContactService(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (ret != CALLSERVICE_NOTFOUND) lvc.pszText = (wchar_t*)ret; } @@ -195,11 +195,11 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (!pa->IsEnabled()) continue; - uint32_t caps = (uint32_t)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + uint32_t caps = (uint32_t)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps & requiredCapability)) continue; - dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(0, pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); + dat->search[dat->searchCount].hProcess = (HANDLE)CallContactService(0, pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[dat->searchCount].szProto = pa->szModuleName; if (dat->search[dat->searchCount].hProcess == nullptr) failures++; else dat->searchCount++; @@ -217,7 +217,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha else { dat->search = (struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo)); dat->searchCount = 1; - dat->search[0].hProcess = (HANDLE)CallProtoServiceInt(0, szProto, szSearchService, 0, (LPARAM)pvSearchParams); + dat->search[0].hProcess = (HANDLE)CallContactService(0, szProto, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[0].szProto = szProto; if (dat->search[0].hProcess == nullptr) { // infuriatingly vague error message. fixme. @@ -349,13 +349,13 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) case IDC_DETAILS: { - MCONTACT hContact = (MCONTACT)CallProtoServiceInt(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); + MCONTACT hContact = (MCONTACT)CallContactService(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); CallService(MS_USERINFO_SHOWDIALOG, hContact, 0); } break; case IDM_SENDMESSAGE: { - MCONTACT hContact = (MCONTACT)CallProtoServiceInt(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); + MCONTACT hContact = (MCONTACT)CallContactService(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); CallService(MS_MSG_SENDMESSAGE, hContact, 0); } break; diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index f6ce8e8b5d..4dd72b5a83 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -241,7 +241,7 @@ MIR_APP_DLL(HANDLE) Skin_GetProtoIcon(const char *szProto, int status) INT_PTR caps2; if (szProto == nullptr) caps2 = -1; - else if ((caps2 = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_2, 0)) == CALLSERVICE_NOTFOUND) + else if ((caps2 = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_2, 0)) == CALLSERVICE_NOTFOUND) caps2 = 0; if (IsStatusConnecting(status)) { diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp index 8c116a2497..8dab94d294 100644 --- a/src/mir_app/src/visibility.cpp +++ b/src/mir_app/src/visibility.cpp @@ -113,7 +113,7 @@ static void SetAllContactIcons(HWND hwndList) status = 0; } else { - flags = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + flags = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); status = db_get_w(hContact, szProto, "ApparentMode", 0); } -- cgit v1.2.3