summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdaway/src/awaymsg.cpp2
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp17
-rw-r--r--src/mir_app/src/addcontact.cpp10
-rw-r--r--src/mir_app/src/clc.cpp2
-rw-r--r--src/mir_app/src/clcfiledrop.cpp2
-rw-r--r--src/mir_app/src/clistsettings.cpp2
-rw-r--r--src/mir_app/src/clisttray.cpp2
-rw-r--r--src/mir_app/src/clui.cpp4
-rw-r--r--src/mir_app/src/filerecvdlg.cpp2
-rw-r--r--src/mir_app/src/filexferdlg.cpp6
-rw-r--r--src/mir_app/src/findadd.cpp20
-rw-r--r--src/mir_app/src/ignore.cpp4
-rw-r--r--src/mir_app/src/menu_clist.cpp6
-rw-r--r--src/mir_app/src/meta_services.cpp10
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/miranda.h4
-rw-r--r--src/mir_app/src/proto_chains.cpp12
-rw-r--r--src/mir_app/src/proto_interface.cpp5
-rw-r--r--src/mir_app/src/proto_internal.cpp30
-rw-r--r--src/mir_app/src/protocols.cpp93
-rw-r--r--src/mir_app/src/searchresults.cpp12
-rw-r--r--src/mir_app/src/skinicons.cpp2
23 files changed, 122 insertions, 129 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index d65ee88b31..d7eb3ae8de 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -75,7 +75,7 @@ public:
bool OnInitDialog() override
{
- m_hSeq = (HANDLE)ProtoChainSend(m_hContact, PSS_GETAWAYMSG, 0, 0);
+ m_hSeq = (HANDLE)CallContactService(m_hContact, PS_GETAWAYMSG);
if (m_hSeq == nullptr) {
ACKDATA ack = {};
ack.hContact = m_hContact;
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index d7357be8b1..4126dd5974 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -227,7 +227,7 @@ class CUserInfoDlg : public CDlgBase
void CheckOnline()
{
- const char *szProto = GetProto();
+ const char *szProto = (m_pCurrent && m_pCurrent->szProto) ? m_pCurrent->szProto : Proto_GetBaseAccountName(m_hContact);
if (szProto == nullptr || m_bIsMeta)
btnUpdate.Disable();
else {
@@ -238,14 +238,6 @@ class CUserInfoDlg : public CDlgBase
}
}
- const char *GetProto() const
- {
- if (m_pCurrent && m_pCurrent->szProto)
- return m_pCurrent->szProto;
-
- return (m_hContact) ? Proto_GetBaseAccountName(m_hContact) : nullptr;
- }
-
void ResizeCurrent()
{
RECT rc;
@@ -323,7 +315,7 @@ public:
m_updateAnimFrame = 0;
GetDlgItemText(m_hwnd, IDC_UPDATING, m_szUpdating, _countof(m_szUpdating));
CheckOnline();
- if (!ProtoChainSend(m_hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) {
+ if (!CallContactService(m_hContact, PS_GETINFO, SGIF_ONOPEN)) {
btnUpdate.Disable();
SetTimer(m_hwnd, 1, 100, nullptr);
}
@@ -555,8 +547,9 @@ public:
m_infosUpdated = NULL;
}
- if (const char *szProto = GetProto())
- if (!CallContactService(m_hContact, szProto, PSS_GETINFO)) {
+ MCONTACT hContact = (m_pCurrent && m_pCurrent->szProto) ? m_pCurrent->hContact : m_hContact;
+ if (hContact)
+ if (!CallContactService(hContact, PS_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 312218c76d..958a078590 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) ? CallContactService(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0;
+ uint32_t flags = (m_szProto) ? CallProtoService(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)CallContactService(0, m_szProto, PS_ADDTOLISTBYEVENT, 0, m_hDbEvent);
+ hContact = (MCONTACT)CallProtoService(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)CallContactService(0, m_szProto, PS_ADDTOLIST, 0, (LPARAM)m_psr);
+ hContact = (MCONTACT)CallProtoService(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 = CallContactService(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ uint32_t flags = CallProtoService(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 = CallContactService(0, m_szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ uint32_t flags = CallProtoService(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 5ad5946367..458aae07a0 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)CallContactService(0, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t caps = (uint32_t)CallProtoService(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 6c9487cf2e..574fc094e7 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 = CallContactService(0,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t protoCaps = CallProtoService(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/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp
index db737edd87..42491585a0 100644
--- a/src/mir_app/src/clistsettings.cpp
+++ b/src/mir_app/src/clistsettings.cpp
@@ -135,7 +135,7 @@ MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode)
if (mode & GCDNF_NOUNKNOWN)
return nullptr;
- ProtoChainSend(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
+ CallContactService(hContact, PS_GETINFO, SGIF_MINIMAL);
wchar_t *buffer = TranslateT("(Unknown contact)");
return (cacheEntry == nullptr) ? mir_wstrdup(buffer) : buffer;
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp
index c376f34ef0..db28de042a 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 (CallContactService(0, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
+ if (CallProtoService(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 fa4060f052..0eb4596e70 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)
- CallContactService(0, it->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
+ CallProtoService(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 = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t caps = CallProtoService(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/filerecvdlg.cpp b/src/mir_app/src/filerecvdlg.cpp
index 4a94cf8ed9..1ed429623c 100644
--- a/src/mir_app/src/filerecvdlg.cpp
+++ b/src/mir_app/src/filerecvdlg.cpp
@@ -372,7 +372,7 @@ public:
void onClick_Cancel(CCtrlButton *)
{
if (dat->fs) {
- ProtoChainSend(dat->hContact, PSS_FILEDENY, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
+ CallContactService(dat->hContact, PS_FILEDENY, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
dat->fs = nullptr; /* the protocol will free the handle */
}
}
diff --git a/src/mir_app/src/filexferdlg.cpp b/src/mir_app/src/filexferdlg.cpp
index 8e69fc03a0..a5396da239 100644
--- a/src/mir_app/src/filexferdlg.cpp
+++ b/src/mir_app/src/filexferdlg.cpp
@@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
else { //recv
CreateDirectoryTreeW(dat->szSavePath);
- dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
+ dat->fs = (HANDLE)CallContactService(dat->hContact, PS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.szWorkingDir.w = mir_wstrdup(dat->szSavePath);
if (!Contact::OnList(dat->hContact))
dat->resumeBehaviour = FILERESUME_ASK;
@@ -428,7 +428,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
switch (pfr->action) {
case FILERESUME_CANCEL:
if (dat->fs) {
- ProtoChainSend(dat->hContact, PSS_FILECANCEL, (WPARAM)dat->fs, 0);
+ CallContactService(dat->hContact, PS_FILECANCEL, (WPARAM)dat->fs, 0);
dat->fs = nullptr;
}
delete pfr;
@@ -698,7 +698,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
FileDlgData::~FileDlgData()
{
if (fs)
- ProtoChainSend(hContact, PSS_FILECANCEL, (WPARAM)fs, 0);
+ CallContactService(hContact, PS_FILECANCEL, (WPARAM)fs, 0);
UnhookEvent(hNotifyEvent);
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp
index 6d4a3ac2fd..f9f4ac47ac 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)CallContactService(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
+ dat->hwndAdvSearch = (HWND)CallProtoService(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)CallContactService(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/);
+ dat->hwndTinySearch = (HWND)CallProtoService(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)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t caps = (uint32_t)CallProtoService(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)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t caps = (uint32_t)CallProtoService(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)CallContactService(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ HICON hIcon = (HICON)CallProtoService(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)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t protoCaps = (uint32_t)CallProtoService(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)CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t protoCaps = (uint32_t)CallProtoService(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 *)CallContactService(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ wchar_t *wszUniqueId = (wchar_t *)CallProtoService(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 = CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ int protoCaps = CallProtoService(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 = CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ int protoCaps = CallProtoService(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 befa07dc2c..07f49f9e3e 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 = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- proto4Caps = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ proto1Caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ proto4Caps = CallProtoService(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 d6f8ef2a36..49b7e3a074 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 (CallContactService(0, smep->szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0)
+ if (CallProtoService(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);
- CallContactService(0, smep->szProto, PS_GETNAME, _countof(szHumanName), (LPARAM)szHumanName);
+ CallProtoService(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)CallContactService(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ mi.hIcon = ic = (HICON)CallProtoService(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/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 25fe1c2ca3..54ebf95f07 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -700,7 +700,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM, LPARAM lParam)
return 0;
ccs->hContact = hMostOnline;
- return ProtoChainSend(ccs->hContact, PSS_GETAWAYMSG, ccs->wParam, ccs->lParam);
+ return CallContactService(ccs->hContact, PS_GETAWAYMSG, ccs->wParam, ccs->lParam);
}
INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam)
@@ -762,10 +762,10 @@ INT_PTR Meta_GetInfo(WPARAM, LPARAM lParam)
return 0;
ccs->hContact = hMostOnline;
- if (!ProtoServiceExists(proto, PSS_GETINFO))
+ if (!ProtoServiceExists(proto, PS_GETINFO))
return 0; // fail
- return ProtoChainSend(ccs->hContact, PSS_GETINFO, ccs->wParam, ccs->lParam);
+ return CallContactService(ccs->hContact, PS_GETINFO, ccs->wParam, ccs->lParam);
}
int Meta_CallMostOnline(WPARAM hContact, LPARAM)
@@ -827,9 +827,9 @@ void Meta_InitServices()
// file recv is done by subcontacts
CreateProtoServiceFunction(META_PROTO, PSS_FILE, Meta_FileSend);
- CreateProtoServiceFunction(META_PROTO, PSS_GETAWAYMSG, Meta_GetAwayMsg);
+ CreateProtoServiceFunction(META_PROTO, PS_GETAWAYMSG, Meta_GetAwayMsg);
CreateProtoServiceFunction(META_PROTO, PS_GETAVATARINFO, Meta_GetAvatarInfo);
- CreateProtoServiceFunction(META_PROTO, PSS_GETINFO, Meta_GetInfo);
+ CreateProtoServiceFunction(META_PROTO, PS_GETINFO, Meta_GetInfo);
// receive filter
CreateProtoServiceFunction(META_FILTER, PSR_MESSAGE, MetaFilter_RecvMessage);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 7565cfe960..dee58045b1 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -53,7 +53,6 @@ Button_SetSkin_IcoLib @24
?OnProtoCheckOnline@CProtoIntDlgBase@@MAEXIJ@Z @54 NONAME
?OnProtoRefresh@CProtoIntDlgBase@@MAEXIJ@Z @55 NONAME
?ProtoBroadcastAck@PROTO_INTERFACE@@QAEHIHHPAXJ@Z @56 NONAME
-?RecvAwayMsg@PROTO_INTERFACE@@UAEHIHPAUPROTORECVEVENT@@@Z @57 NONAME
?RecvContacts@PROTO_INTERFACE@@UAEHIPAUPROTORECVEVENT@@@Z @58 NONAME
?RecvFile@PROTO_INTERFACE@@UAEIIPAUPROTORECVFILE@@@Z @59 NONAME
?RecvMsg@PROTO_INTERFACE@@UAEIIPAUPROTORECVEVENT@@@Z @60 NONAME
@@ -911,7 +910,7 @@ 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
+_CallContactService@16 @1048 NONAME
??0MDatabaseExport@@QAE@XZ @1049 NONAME
??1MDatabaseExport@@UAE@XZ @1050 NONAME
??_7MDatabaseExport@@6B@ @1051 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index f1161f7878..d5b82b164f 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -53,7 +53,6 @@ Button_SetSkin_IcoLib @24
?OnProtoCheckOnline@CProtoIntDlgBase@@MEAAX_K_J@Z @54 NONAME
?OnProtoRefresh@CProtoIntDlgBase@@MEAAX_K_J@Z @55 NONAME
?ProtoBroadcastAck@PROTO_INTERFACE@@QEAA_JIHHPEAX_J@Z @56 NONAME
-?RecvAwayMsg@PROTO_INTERFACE@@UEAAHIHPEAUPROTORECVEVENT@@@Z @57 NONAME
?RecvContacts@PROTO_INTERFACE@@UEAAHIPEAUPROTORECVEVENT@@@Z @58 NONAME
?RecvFile@PROTO_INTERFACE@@UEAAIIPEAUPROTORECVFILE@@@Z @59 NONAME
?RecvMsg@PROTO_INTERFACE@@UEAAIIPEAUPROTORECVEVENT@@@Z @60 NONAME
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 2365798bc4..d87d66f9b5 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -162,6 +162,10 @@ struct MBaseProto : public PROTOCOLDESCRIPTOR, public MZeroedObject
extern OBJLIST<MBaseProto> g_arProtos;
extern LIST<MBaseProto> g_arFilters;
+// tries to call virtual methods of PROTO_INTERFACE by name
+INT_PTR CallContactServiceInt(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
+
+// simple wrapper for CallService(szModule + szService, wParam, lParam);
INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName);
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp
index 0ddf922ed9..7e00c5c56f 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 = CallContactService(0, g_arFilters[i]->szName, ccs->szProtoService, i + 1, LPARAM(ccs))) != CALLSERVICE_NOTFOUND) {
+ if ((ret = CallProtoService(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 = CallContactService(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs);
+ ret = CallContactServiceInt(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs);
else
- ret = CallContactService(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam);
+ ret = CallContactServiceInt(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 = CallContactService(0, g_arFilters[i]->szName, ccs->szProtoService, i + 1, (LPARAM)ccs)) != CALLSERVICE_NOTFOUND)
+ if ((ret = CallProtoService(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 = CallContactService(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs);
+ ret = CallContactServiceInt(ccs->hContact, szProto, ccs->szProtoService, -1, (LPARAM)ccs);
else
- ret = CallContactService(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam);
+ ret = CallContactServiceInt(ccs->hContact, szProto, ccs->szProtoService, ccs->wParam, ccs->lParam);
if (ret == CALLSERVICE_NOTFOUND)
ret = 1;
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp
index 1892847ed5..42584b0f86 100644
--- a/src/mir_app/src/proto_interface.cpp
+++ b/src/mir_app/src/proto_interface.cpp
@@ -272,11 +272,6 @@ HANDLE PROTO_INTERFACE::GetAwayMsg(MCONTACT)
return nullptr; // no away message
}
-int PROTO_INTERFACE::RecvAwayMsg(MCONTACT, int, PROTORECVEVENT*)
-{
- return 1; // error
-}
-
int PROTO_INTERFACE::SetAwayMsg(int, const wchar_t*)
{
return 1; // error
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp
index 7ae8f89074..6a17124f8e 100644
--- a/src/mir_app/src/proto_internal.cpp
+++ b/src/mir_app/src/proto_internal.cpp
@@ -78,30 +78,30 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath) override
{
- CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
+ CCSDATA ccs = { hContact, PS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
if (m_iVersion > 1)
- return (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
+ return (HANDLE)ProtoCallService(m_szModuleName, PS_FILEALLOW, 0, (LPARAM)&ccs);
ccs.lParam = (LPARAM)mir_u2a(szPath);
- HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
+ HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PS_FILEALLOW, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
}
int FileCancel(MCONTACT hContact, HANDLE hTransfer) override
{
- CCSDATA ccs = { hContact, PSS_FILECANCEL, (WPARAM)hTransfer, 0 };
- return (int)ProtoCallService(m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs);
+ CCSDATA ccs = { hContact, PS_FILECANCEL, (WPARAM)hTransfer, 0 };
+ return (int)ProtoCallService(m_szModuleName, PS_FILECANCEL, 0, (LPARAM)&ccs);
}
int FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason) override
{
- CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
+ CCSDATA ccs = { hContact, PS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
if (m_iVersion > 1)
- return (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
+ return (int)ProtoCallService(m_szModuleName, PS_FILEDENY, 0, (LPARAM)&ccs);
ccs.lParam = (LPARAM)mir_u2a(szReason);
- int res = (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
+ int res = (int)ProtoCallService(m_szModuleName, PS_FILEDENY, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
}
@@ -126,8 +126,8 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
int GetInfo(MCONTACT hContact, int flags) override
{
- CCSDATA ccs = { hContact, PSS_GETINFO, (WPARAM)flags, 0 };
- return ProtoCallService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs);
+ CCSDATA ccs = { hContact, PS_GETINFO, (WPARAM)flags, 0 };
+ return ProtoCallService(m_szModuleName, PS_GETINFO, 0, (LPARAM)&ccs);
}
HANDLE SearchBasic(const wchar_t* id) override
@@ -222,14 +222,8 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE GetAwayMsg(MCONTACT hContact) override
{
- CCSDATA ccs = { hContact, PSS_GETAWAYMSG, 0, 0 };
- return (HANDLE)ProtoCallService(m_szModuleName, PSS_GETAWAYMSG, 0, (LPARAM)&ccs);
- }
-
- int RecvAwayMsg(MCONTACT hContact, int statusMode, PROTORECVEVENT* evt) override
- {
- CCSDATA ccs = { hContact, PSR_AWAYMSG, (WPARAM)statusMode, (LPARAM)evt };
- return (int)ProtoCallService(m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs);
+ CCSDATA ccs = { hContact, PS_GETAWAYMSG, 0, 0 };
+ return (HANDLE)ProtoCallService(m_szModuleName, PS_GETAWAYMSG, 0, (LPARAM)&ccs);
}
int SetAwayMsg(int iStatus, const wchar_t *msg) override
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 9ea0380365..cf754b9ff0 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -49,13 +49,13 @@ static TServiceListItem serviceItems[] =
{ PS_AUTHDENY, 4 },
{ PSR_AUTH, 5 },
{ PSS_AUTHREQUEST, 6 },
- { PSS_FILEALLOW, 8 },
- { PSS_FILECANCEL, 9 },
- { PSS_FILEDENY, 10 },
+ { PS_FILEALLOW, 8 },
+ { PS_FILECANCEL, 9 },
+ { PS_FILEDENY, 10 },
{ PS_FILERESUME, 11 },
{ PS_GETCAPS, 12 },
{ PS_LOADICON, 13 },
- { PSS_GETINFO, 14 },
+ { PS_GETINFO, 14 },
{ PS_BASICSEARCH, 15 },
{ PS_SEARCHBYEMAIL, 16 },
{ PS_SEARCHBYNAME, 17 },
@@ -68,12 +68,11 @@ static TServiceListItem serviceItems[] =
{ PSS_FILE, 24 },
{ PSS_MESSAGE, 25 },
{ PS_SETSTATUS, 27 },
- { PSS_GETAWAYMSG, 28 },
- { PSR_AWAYMSG, 29 },
- { PS_SETAWAYMSG, 30 },
- { PSS_USERISTYPING, 31 },
- { PS_GETNAME, 32 },
- { PS_GETSTATUS, 33 },
+ { PS_GETAWAYMSG, 28 },
+ { PS_SETAWAYMSG, 29 },
+ { PSS_USERISTYPING, 30 },
+ { PS_GETNAME, 31 },
+ { PS_GETSTATUS, 32 },
};
//------------------------------------------------------------------------------------
@@ -194,7 +193,7 @@ static int Proto_ValidTypingContact(MCONTACT hContact, char *szProto)
if (!hContact || !szProto)
return 0;
- return (CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
+ return (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
}
static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
@@ -205,7 +204,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
return 0;
if (Proto_ValidTypingContact(wParam, szProto))
- CallContactService(0, szProto, PSS_USERISTYPING, wParam, lParam);
+ CallProtoService(szProto, PSS_USERISTYPING, wParam, lParam);
}
return 0;
@@ -232,11 +231,11 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam)
void Proto_SetStatus(const char *szProto, unsigned status)
{
- if (CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
ptrW tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto));
- CallContactService(0, szProto, PS_SETAWAYMSG, status, tszAwayMsg);
+ CallProtoService(szProto, PS_SETAWAYMSG, status, tszAwayMsg);
}
- CallContactService(0, szProto, PS_SETSTATUS, status, 0);
+ CallProtoService(szProto, PS_SETSTATUS, status, 0);
}
char** __fastcall Proto_FilesMatrixA(wchar_t **files)
@@ -381,16 +380,11 @@ 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 CallContactService(0, szModule, szService, wParam, lParam);
-}
-
-MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
+INT_PTR CallContactServiceInt(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
{
auto *ppi = Proto_GetInstance(szModule);
if (ppi != nullptr) {
- TServiceListItem *item = (TServiceListItem*)bsearch(&szService, serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems);
+ TServiceListItem *item = (TServiceListItem *)bsearch(&szService, serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems);
if (item) {
switch (item->id) {
case 1: return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT *)lParam);
@@ -402,20 +396,22 @@ MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szModule,
case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (wchar_t *)lParam);
case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (wchar_t *)lParam);
- case 11: {
- PROTOFILERESUME *pfr = (PROTOFILERESUME *)lParam;
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, pfr->action, (const wchar_t *)pfr->szFilename);
- }
+ case 11:
+ {
+ PROTOFILERESUME *pfr = (PROTOFILERESUME *)lParam;
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, pfr->action, (const wchar_t *)pfr->szFilename);
+ }
case 12: return (INT_PTR)ppi->GetCaps(wParam, lParam);
case 13: return (INT_PTR)Proto_GetIcon(ppi, wParam);
case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);
case 15: return (INT_PTR)ppi->SearchBasic((wchar_t *)lParam);
case 16: return (INT_PTR)ppi->SearchByEmail((wchar_t *)lParam);
- case 17: {
- PROTOSEARCHBYNAME *psbn = (PROTOSEARCHBYNAME *)lParam;
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- }
+ case 17:
+ {
+ PROTOSEARCHBYNAME *psbn = (PROTOSEARCHBYNAME *)lParam;
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
+ }
case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
case 19: return (INT_PTR)ppi->CreateExtendedSearchUI((HWND)lParam);
case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT *)lParam);
@@ -423,21 +419,21 @@ MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szModule,
case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT *)lParam);
case 23: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT *)lParam);
case 24: return (INT_PTR)ppi->SendFile(hContact, (wchar_t *)wParam, (wchar_t **)lParam);
- case 25: {
- int msgId = ppi->SendMsg(hContact, wParam, (const char *)lParam);
- if (msgId == -1) {
- ppi->ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)-1, (LPARAM)TranslateT("Protocol is offline"));
- return -1;
+ case 25:
+ {
+ int msgId = ppi->SendMsg(hContact, wParam, (const char *)lParam);
+ if (msgId == -1) {
+ ppi->ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)-1, (LPARAM)TranslateT("Protocol is offline"));
+ return -1;
+ }
+ return msgId;
}
- return msgId;
- }
case 27: return (INT_PTR)ppi->SetStatus(wParam);
case 28: return (INT_PTR)ppi->GetAwayMsg(hContact);
- case 29: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT *)lParam);
- case 30: return (INT_PTR)ppi->SetAwayMsg(wParam, (wchar_t *)lParam);
- case 31: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
- case 32: mir_strncpy((char *)lParam, ppi->m_szModuleName, wParam); return 0;
- case 33:
+ case 29: return (INT_PTR)ppi->SetAwayMsg(wParam, (wchar_t *)lParam);
+ case 30: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
+ case 31: mir_strncpy((char *)lParam, ppi->m_szModuleName, wParam); return 0;
+ case 32:
return ppi->m_iStatus;
}
}
@@ -446,6 +442,19 @@ MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szModule,
return ProtoCallService(szModule, szService, wParam, lParam);
}
+MIR_APP_DLL(INT_PTR) CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam)
+{
+ return CallContactServiceInt(0, szModule, szService, wParam, lParam);
+}
+
+MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szService, WPARAM wParam, LPARAM lParam)
+{
+ auto *pa = Proto_GetContactAccount(hContact);
+ return (pa) ? CallContactServiceInt(hContact, pa->szModuleName, szService, wParam, lParam) : 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
{
if (szModule == nullptr || szService == nullptr)
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp
index 0e247b8ebb..3e6ba88ba6 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 = CallContactService(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ INT_PTR ret = CallProtoService(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)CallContactService(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ uint32_t caps = (uint32_t)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(caps & requiredCapability))
continue;
- dat->search[dat->searchCount].hProcess = (HANDLE)CallContactService(0, pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
+ dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(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)CallContactService(0, szProto, szSearchService, 0, (LPARAM)pvSearchParams);
+ dat->search[0].hProcess = (HANDLE)CallProtoService(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)CallContactService(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ MCONTACT hContact = (MCONTACT)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
}
break;
case IDM_SENDMESSAGE:
{
- MCONTACT hContact = (MCONTACT)CallContactService(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ MCONTACT hContact = (MCONTACT)CallProtoService(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 7a0d08e362..042c3d0737 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 = CallContactService(0, szProto, PS_GETCAPS, PFLAGNUM_2, 0)) == CALLSERVICE_NOTFOUND)
+ else if ((caps2 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0)) == CALLSERVICE_NOTFOUND)
caps2 = 0;
if (IsStatusConnecting(status)) {