summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_core.h2
-rw-r--r--include/m_protoint.h1
-rw-r--r--include/m_protosvc.h142
-rw-r--r--libs/win32/mir_app.libbin290906 -> 290496 bytes
-rw-r--r--libs/win64/mir_app.libbin290624 -> 290204 bytes
-rw-r--r--plugins/Clist_modern/src/modern_awaymsg.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/ReadAwayMsg.cpp2
-rw-r--r--plugins/NewXstatusNotify/src/popup.cpp2
-rw-r--r--plugins/SimpleStatusMsg/src/awaymsg.cpp4
-rw-r--r--plugins/TipperYM/src/message_pump.cpp2
-rw-r--r--plugins/TipperYM/src/subst.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp8
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp2
-rw-r--r--plugins/WhenWasIt/src/services.cpp2
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp8
-rw-r--r--protocols/ICQCorp/src/services.cpp10
-rw-r--r--protocols/NewsAggregator/Src/NewsAggregator.cpp2
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp9
-rw-r--r--protocols/Sametime/src/sametime_proto.h1
-rw-r--r--protocols/Weather/src/weather_svcs.cpp4
-rw-r--r--protocols/WebView/src/main.cpp2
-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
44 files changed, 218 insertions, 240 deletions
diff --git a/include/m_core.h b/include/m_core.h
index 4c7d3d40d0..2c0d9fa927 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -147,7 +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);
+MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szService, WPARAM wParam = 0, LPARAM lParam = 0);
///////////////////////////////////////////////////////////////////////////////
// exceptions
diff --git a/include/m_protoint.h b/include/m_protoint.h
index c4e3894096..51eb352f22 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -245,7 +245,6 @@ public:
virtual int SetStatus(int iNewStatus);
virtual HANDLE GetAwayMsg(MCONTACT hContact);
- virtual int RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT *evt);
virtual int SetAwayMsg(int iStatus, const wchar_t *msg);
virtual int UserIsTyping(MCONTACT hContact, int type);
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index 9e35d726fd..95c9e57e60 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -246,6 +246,17 @@ static __inline unsigned long Proto_Status2Flag(int status)
#define PS_SETSTATUS "/SetStatus"
///////////////////////////////////////////////////////////////////////////////
+// Sends a request to retrieve somebody's mode message.
+// wParam = lParam = 0
+// returns an hProcess identifying the request, or 0 on failure
+// This function will fail if the contact's current status mode doesn't have an
+// associated message
+// The reply will be in the form of an ack:
+// type = ACKTYPE_AWAYMSG, result = success/failure, lParam = (const char*)szMessage
+
+#define PS_GETAWAYMSG "/GetAwayMsg"
+
+///////////////////////////////////////////////////////////////////////////////
// Sets the status-mode specific message for yourself
// wParam = status mode
// lParam = (LPARAM)(const wchar_t*)szMessage
@@ -267,6 +278,59 @@ static __inline unsigned long Proto_Status2Flag(int status)
#define PS_GETSTATUS "/GetStatus"
///////////////////////////////////////////////////////////////////////////////
+// Updates a contact's details from the server
+// wParam = flags
+// lParam = 0
+// returns 0 on success, nonzero on failure
+// Will update all the information in the database, and then send acks with
+// type = ACKTYPE_GETINFO, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)(int)nReplies, lParam = thisReply
+// Since some protocols do not allow the library to tell when it has got all
+// the information so it can send a final ack, one ack will be sent after each
+// chunk of data has been received. nReplies contains the number of distinct
+// acks that will be sent to get all the information, thisReply is the zero-
+// based index of this ack. When thisReply = 0 the 'minimal' information has just
+// been received. All other numbering is arbitrary.
+
+#define SGIF_MINIMAL 1 // get only the most basic information. This should
+ // contain at least a Nick and e-mail.
+#define SGIF_ONOPEN 2 // set when the User Info form is being opened
+
+#define PS_GETINFO "/GetInfo"
+
+///////////////////////////////////////////////////////////////////////////////
+// Allows a file transfer to begin
+// wParam = (WPARAM)(HANDLE)hTransfer
+// lParam = (LPARAM)(const wchar_t*)szPath
+// Returns a new handle to the transfer, to be used from now on
+// If szPath does not point to a directory then:
+// if a single file is being transferred and the protocol supports file
+// renaming (PF1_CANRENAMEFILE) then the file is given this name
+// otherwise the filename is removed and the file(s) are placed in the
+// resulting directory
+// File transfers are marked by an EVENTTYPE_FILE added to the database. The
+// format is:
+// uint32_t hTransfer
+// ASCIIZ filename(s), description
+
+#define PS_FILEALLOW "/FileAllow"
+
+///////////////////////////////////////////////////////////////////////////////
+// Refuses a file transfer request
+// wParam = (WPARAM)(HANDLE)hTransfer
+// lParam = (LPARAM)(const wchar_t*)szReason
+// Returns 0 on success, nonzero on failure
+
+#define PS_FILEDENY "/FileDeny"
+
+///////////////////////////////////////////////////////////////////////////////
+// Cancels an in-progress file transfer
+// wParam = (WPARAM)(HANDLE)hTransfer
+// lParam = 0
+// Returns 0 on success, nonzero on failure
+
+#define PS_FILECANCEL "/FileCancel"
+
+///////////////////////////////////////////////////////////////////////////////
// Allow somebody to add us to their contact list
// wParam = (WPARAM)(HANDLE)hDbEvent
// lParam = 0
@@ -565,25 +629,7 @@ struct PROTOFILERESUME
///////////////////////////////////////////////////////////////////////////////
// SENDING SERVICES
-// these should be called with CallContactService()
-
-// Updates a contact's details from the server
-// wParam = flags
-// lParam = 0
-// returns 0 on success, nonzero on failure
-// Will update all the information in the database, and then send acks with
-// type = ACKTYPE_GETINFO, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)(int)nReplies, lParam = thisReply
-// Since some protocols do not allow the library to tell when it has got all
-// the information so it can send a final ack, one ack will be sent after each
-// chunk of data has been received. nReplies contains the number of distinct
-// acks that will be sent to get all the information, thisReply is the zero-
-// based index of this ack. When thisReply = 0 the 'minimal' information has just
-// been received. All other numbering is arbitrary.
-
-#define SGIF_MINIMAL 1 // get only the most basic information. This should
- // contain at least a Nick and e-mail.
-#define SGIF_ONOPEN 2 // set when the User Info form is being opened
-#define PSS_GETINFO "/GetInfo"
+// these should be called with ProtoChainSend()
///////////////////////////////////////////////////////////////////////////////
// Send an instant message
@@ -614,50 +660,6 @@ struct PROTOFILERESUME
#define PSS_CONTACTS "/SendContacts"
///////////////////////////////////////////////////////////////////////////////
-// Send a request to retrieve somebody's mode message.
-// wParam = lParam = 0
-// returns an hProcess identifying the request, or 0 on failure
-// This function will fail if the contact's current status mode doesn't have an
-// associated message
-// The reply will be in the form of an ack:
-// type = ACKTYPE_AWAYMSG, result = success/failure, lParam = (const char*)szMessage
-
-#define PSS_GETAWAYMSG "/GetAwayMsg"
-
-///////////////////////////////////////////////////////////////////////////////
-// Allows a file transfer to begin
-// wParam = (WPARAM)(HANDLE)hTransfer
-// lParam = (LPARAM)(const wchar_t*)szPath
-// Returns a new handle to the transfer, to be used from now on
-// If szPath does not point to a directory then:
-// if a single file is being transferred and the protocol supports file
-// renaming (PF1_CANRENAMEFILE) then the file is given this name
-// otherwise the filename is removed and the file(s) are placed in the
-// resulting directory
-// File transfers are marked by an EVENTTYPE_FILE added to the database. The
-// format is:
-// uint32_t hTransfer
-// ASCIIZ filename(s), description
-
-#define PSS_FILEALLOW "/FileAllow"
-
-///////////////////////////////////////////////////////////////////////////////
-// Refuses a file transfer request
-// wParam = (WPARAM)(HANDLE)hTransfer
-// lParam = (LPARAM)(const wchar_t*)szReason
-// Returns 0 on success, nonzero on failure
-
-#define PSS_FILEDENY "/FileDeny"
-
-///////////////////////////////////////////////////////////////////////////////
-// Cancel an in-progress file transfer
-// wParam = (WPARAM)(HANDLE)hTransfer
-// lParam = 0
-// Returns 0 on success, nonzero on failure
-
-#define PSS_FILECANCEL "/FileCancel"
-
-///////////////////////////////////////////////////////////////////////////////
// Initiate a file send
// wParam = (WPARAM)(const wchar_t*)szDescription
// lParam = (LPARAM)(wchar_t **)ppszFiles
@@ -684,15 +686,16 @@ struct PROTOFILERESUME
///////////////////////////////////////////////////////////////////////////////
// RECEIVING SERVICES
+// these should be called with ProtoChainRecv()
// These services are not for calling by general modules. They serve a specific
// role in communicating through protocol module chains before the whole app is
// notified that an event has occurred.
// When the respective event is received over the network, the network-level
-// protocol module initiates the chain by calling MS_PROTO_CHAINRECV with wParam
+// protocol module initiates the chain by calling ProtoChainRecv with wParam
// set to zero and lParam pointing to the CCSDATA structure.
// Protocol modules should continue the message up the chain by calling
-// MS_PROTO_CHAINRECV with the same wParam they received and a modified (or not)
+// ProtoChainRecv with the same wParam they received and a modified (or not)
// lParam (CCSDATA). If they do not do this and return nonzero then all further
// processing for the event will cease and the event will be ignored.
// Once all non-network protocol modules have been called (in reverse order),
@@ -825,9 +828,6 @@ struct OFD_Callback
// pre.flags can contain PREF_UTF defining the strings as utf-8 encoded (0.7.0+)
// PS_ADDTOLIST can be used to add the contacts to the contact list.
-#define PSR_CONTACTS "/RecvContacts"
-
-///////////////////////////////////////////////////////////////////////////////
// contacts database event format (EVENTTYPE_CONTACTS)
// repeat {
// ASCIIZ userNick
@@ -842,10 +842,6 @@ struct OFD_Callback
// zero-terminated, binary data should be converted to text.
// Use PS_ADDTOLISTBYEVENT to add the contacts from one of these to the list.
-// An away message reply has been received
-// wParam = statusMode
-// lParam = (LPARAM)(PROTORECVEVENT*)&pre
-
-#define PSR_AWAYMSG "/RecvAwayMsg"
+#define PSR_CONTACTS "/RecvContacts"
#endif // M_PROTOSVC_H__
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 6f707bba15..84516634ca 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 87a691b6e8..9648bae33d 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp
index 95ecfe2689..449edd481a 100644
--- a/plugins/Clist_modern/src/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/src/modern_awaymsg.cpp
@@ -90,7 +90,7 @@ static void amThreadProc(void *)
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact);
- HANDLE ACK = (HANDLE)ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0);
+ HANDLE ACK = (HANDLE)CallContactService(hContact, PS_GETAWAYMSG);
if (!ACK) {
ACKDATA ack;
ack.hContact = hContact;
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
index 241d1777d0..25d8f59b75 100644
--- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
@@ -59,7 +59,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)awayData);
awayData->hContact = lParam;
awayData->hAwayMsgEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, UM_RAM_AWAYMSGACK);
- awayData->hSeq = (HANDLE)ProtoChainSend(awayData->hContact, PSS_GETAWAYMSG, 0, 0);
+ awayData->hSeq = (HANDLE)CallContactService(awayData->hContact, PS_GETAWAYMSG);
WindowList_Add(g_hReadWndList, hwndDlg, awayData->hContact);
wchar_t str[256], format[128];
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp
index 6c43a08686..4b4904fa2c 100644
--- a/plugins/NewXstatusNotify/src/popup.cpp
+++ b/plugins/NewXstatusNotify/src/popup.cpp
@@ -105,7 +105,7 @@ void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp)
// The following HookEventMessage will hook the ME_PROTO_ACK event and send a WM_AWAYMSG to hWnd when the hooks get notified.
pdp->hAwayMsgHook = HookEventParam(ME_PROTO_ACK, AwayMsgHook, (LPARAM)pdp);
// The following instruction asks Miranda to retrieve the away message and associates a hProcess (handle) to this request. This handle will appear in the ME_PROTO_ACK event.
- pdp->hAwayMsgProcess = (HANDLE)ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0);
+ pdp->hAwayMsgProcess = (HANDLE)CallContactService(hContact, PS_GETAWAYMSG);
}
}
}
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp
index 08c2670ccd..612e3d6e19 100644
--- a/plugins/SimpleStatusMsg/src/awaymsg.cpp
+++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp
@@ -50,7 +50,7 @@ public:
bool OnInitDialog() override
{
- m_hSeq = (HANDLE)ProtoChainSend(m_hContact, PSS_GETAWAYMSG, 0, 0);
+ m_hSeq = (HANDLE)CallContactService(m_hContact, PS_GETAWAYMSG, 0, 0);
m_hAwayMsgEvent = m_hSeq ? HookEventMessage(ME_PROTO_ACK, m_hwnd, HM_AWAYMSG) : nullptr;
WindowList_Add(hWindowList, m_hwnd, m_hContact);
@@ -150,7 +150,7 @@ public:
bool OnInitDialog() override
{
- m_hSeq = (HANDLE)ProtoChainSend(m_hContact, PSS_GETAWAYMSG, 0, 0);
+ m_hSeq = (HANDLE)CallContactService(m_hContact, PS_GETAWAYMSG, 0, 0);
m_hAwayMsgEvent = m_hSeq ? HookEventMessage(ME_PROTO_ACK, m_hwnd, HM_AWAYMSG) : nullptr;
WindowList_Add(hWindowList2, m_hwnd, m_hContact);
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp
index fd851af172..ec252d07a3 100644
--- a/plugins/TipperYM/src/message_pump.cpp
+++ b/plugins/TipperYM/src/message_pump.cpp
@@ -55,7 +55,7 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex)
if (opt.bWaitForStatusMsg && !bStatusMsgReady) {
g_plugin.delSetting(hContact, "TempStatusMsg");
- if (CanRetrieveStatusMsg(hContact, szProto) && ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0)) {
+ if (CanRetrieveStatusMsg(hContact, szProto) && CallContactService(hContact, PS_GETAWAYMSG, 0, 0)) {
if (WaitForContentTimerID)
KillTimer(nullptr, WaitForContentTimerID);
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp
index 9f929b59fd..e2ffcdba4e 100644
--- a/plugins/TipperYM/src/subst.cpp
+++ b/plugins/TipperYM/src/subst.cpp
@@ -220,7 +220,7 @@ wchar_t* GetStatusMessageText(MCONTACT hContact)
if (!swzMsg) {
if (CanRetrieveStatusMsg(hContact, szProto))
- if (ProtoChainSend(hContact, PSS_GETAWAYMSG, 0, 0))
+ if (CallContactService(hContact, PS_GETAWAYMSG, 0, 0))
return nullptr;
if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) {
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 28fb93902e..f14314f984 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -1225,12 +1225,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
// need meta contact's subcontact information
if (DB::Module::IsMetaAndScan(pPs->pszProto)) {
- // count valid subcontacts whose protocol supports the PSS_GETINFO service to update the information
+ // count valid subcontacts whose protocol supports the PS_GETINFO service to update the information
int numSubs = db_mc_getSubCount(pPs->hContact);
for (int i = 0; i < numSubs; i++) {
MCONTACT hSubContact = db_mc_getSub(pPs->hContact, i);
if (hSubContact) {
- if (ProtoServiceExists(Proto_GetBaseAccountName(hSubContact), PSS_GETINFO)) {
+ if (ProtoServiceExists(Proto_GetBaseAccountName(hSubContact), PS_GETINFO)) {
pPs->infosUpdated = (TAckInfo *)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1));
pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact;
pPs->infosUpdated[pPs->nSubContacts].acks = nullptr;
@@ -1245,7 +1245,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
// call the services
for (int i = 0; i < pPs->nSubContacts; i++)
- if (!ProtoChainSend(pPs->infosUpdated[pPs->nSubContacts].hContact, PSS_GETINFO, NULL, NULL))
+ if (!CallContactService(pPs->infosUpdated[pPs->nSubContacts].hContact, PS_GETINFO))
bDo = TRUE;
if (bDo) {
@@ -1255,7 +1255,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
}
}
- else if (!ProtoChainSend(pPs->hContact, PSS_GETINFO, NULL, NULL)) {
+ else if (!CallContactService(pPs->hContact, PS_GETINFO)) {
pPs->infosUpdated = (TAckInfo *)mir_calloc(sizeof(TAckInfo));
pPs->infosUpdated[0].hContact = pPs->hContact;
pPs->nSubContacts = 1;
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 77a2076b48..d77d5d6a18 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -594,7 +594,7 @@ class CContactUpdater : public CContactQueue
_pProgress->SetTextParam(TranslateT("[b]%s (%S)...[/b]\n%d Contacts remaining"), Clist_GetContactDisplayName(_hContact), pszProto, Size());
if (IsProtoOnline(pszProto))
- for (int i = 0; i < 3 && ProtoChainSend(hContact, PSS_GETINFO, 0, 0); i++)
+ for (int i = 0; i < 3 && CallContactService(hContact, PS_GETINFO, 0, 0); i++)
Sleep(3000);
}
}
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 7ea3973d82..5c1c6bb3b3 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -123,7 +123,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*)
MCONTACT hContact = db_find_first();
while (hContact != NULL) {
- ProtoChainSend(hContact, PSS_GETINFO, 0, 0);
+ CallContactService(hContact, PS_GETINFO);
hContact = db_find_next(hContact);
if (hContact)
Sleep(delay); //sleep for a few seconds between requests
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp
index 215f02a24b..30f0bc886c 100644
--- a/protocols/EmLanProto/src/amdproto.cpp
+++ b/protocols/EmLanProto/src/amdproto.cpp
@@ -334,13 +334,13 @@ int CMPlugin::Load()
CreateProtoServiceFunction(MODULENAME, PS_ADDTOLIST, EMPAddToList);
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, EMPSendMessage);
CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, EMPRecvMessage);
- CreateProtoServiceFunction(MODULENAME, PSS_GETAWAYMSG, EMPGetAwayMsg);
+ CreateProtoServiceFunction(MODULENAME, PS_GETAWAYMSG, EMPGetAwayMsg);
CreateProtoServiceFunction(MODULENAME, PS_SETAWAYMSG, EMPSetAwayMsg);
CreateProtoServiceFunction(MODULENAME, PSR_AWAYMSG, EMPRecvAwayMessage);
CreateProtoServiceFunction(MODULENAME, PS_FILERESUME, EMPFileResume);
- CreateProtoServiceFunction(MODULENAME, PSS_FILEALLOW, EMPSendFileAllow);
- CreateProtoServiceFunction(MODULENAME, PSS_FILEDENY, EMPSendFileDeny);
- CreateProtoServiceFunction(MODULENAME, PSS_FILECANCEL, EMPSendFileCancel);
+ CreateProtoServiceFunction(MODULENAME, PS_FILEALLOW, EMPSendFileAllow);
+ CreateProtoServiceFunction(MODULENAME, PS_FILEDENY, EMPSendFileDeny);
+ CreateProtoServiceFunction(MODULENAME, PS_FILECANCEL, EMPSendFileCancel);
CreateProtoServiceFunction(MODULENAME, PSS_FILE, EMPSendFile);
CreateProtoServiceFunction(MODULENAME, PSR_FILE, EMPRecvFile);
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp
index 90a79b090f..1457488d93 100644
--- a/protocols/ICQCorp/src/services.cpp
+++ b/protocols/ICQCorp/src/services.cpp
@@ -434,13 +434,13 @@ int LoadServices()
CreateProtoServiceFunction(protoName, PS_ADDTOLIST, icqAddToList);
CreateProtoServiceFunction(protoName, PS_FILERESUME, icqFileResume);
- CreateProtoServiceFunction(protoName, PSS_GETINFO, icqGetInfo);
+ CreateProtoServiceFunction(protoName, PS_GETINFO, icqGetInfo);
CreateProtoServiceFunction(protoName, PSS_MESSAGE, icqSendMessage);
- CreateProtoServiceFunction(protoName, PSS_GETAWAYMSG, icqGetAwayMsg);
+ CreateProtoServiceFunction(protoName, PS_GETAWAYMSG, icqGetAwayMsg);
CreateProtoServiceFunction(protoName, PSS_FILE, icqSendFile);
- CreateProtoServiceFunction(protoName, PSS_FILEALLOW, icqFileAllow);
- CreateProtoServiceFunction(protoName, PSS_FILEDENY, icqFileDeny);
- CreateProtoServiceFunction(protoName, PSS_FILECANCEL, icqFileCancel);
+ CreateProtoServiceFunction(protoName, PS_FILEALLOW, icqFileAllow);
+ CreateProtoServiceFunction(protoName, PS_FILEDENY, icqFileDeny);
+ CreateProtoServiceFunction(protoName, PS_FILECANCEL, icqFileCancel);
CreateProtoServiceFunction(protoName, PSR_MESSAGE, icqRecvMessage);
CreateProtoServiceFunction(protoName, PSR_AWAYMSG, icqRecvAwayMsg);
diff --git a/protocols/NewsAggregator/Src/NewsAggregator.cpp b/protocols/NewsAggregator/Src/NewsAggregator.cpp
index 420cbd9ec6..32be6949e1 100644
--- a/protocols/NewsAggregator/Src/NewsAggregator.cpp
+++ b/protocols/NewsAggregator/Src/NewsAggregator.cpp
@@ -67,7 +67,7 @@ int CMPlugin::Load()
CreateProtoServiceFunction(MODULENAME, PS_SETSTATUS, NewsAggrSetStatus);
CreateProtoServiceFunction(MODULENAME, PS_GETSTATUS, NewsAggrGetStatus);
CreateProtoServiceFunction(MODULENAME, PS_LOADICON, NewsAggrLoadIcon);
- CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, NewsAggrGetInfo);
+ CreateProtoServiceFunction(MODULENAME, PS_GETINFO, NewsAggrGetInfo);
CreateProtoServiceFunction(MODULENAME, PS_GETAVATARINFO, NewsAggrGetAvatarInfo);
CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, NewsAggrRecvMessage);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index b9e3c61d9c..50987d47f5 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -244,15 +244,6 @@ HANDLE CSametimeProto::GetAwayMsg(MCONTACT hContact)
return nullptr;
}
-int CSametimeProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt)
-{
- debugLogW(L"CSametimeProto::RecvAwayMsg() hContact=[%x], mode=[%d]", hContact, mode);
-
- ptrW pszMsg(mir_utf8decodeW(evt->szMessage));
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, pszMsg);
- return 0;
-}
-
int CSametimeProto::SetAwayMsg(int iStatus, const wchar_t* msg)
{
debugLogW(L"CSametimeProto::SetAwayMsg() iStatus=[%d], msg:len=[%d]", iStatus, msg == nullptr ? -1 : mir_wstrlen(msg));
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h
index 6c3bd27e9e..fb8bdc629c 100644
--- a/protocols/Sametime/src/sametime_proto.h
+++ b/protocols/Sametime/src/sametime_proto.h
@@ -33,7 +33,6 @@ struct CSametimeProto : public PROTO<CSametimeProto>
int SetStatus(int iNewStatus) override;
HANDLE GetAwayMsg(MCONTACT hContact) override;
- int RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt) override;
int SetAwayMsg(int iStatus, const wchar_t* msg) override;
int UserIsTyping(MCONTACT hContact, int type) override;
diff --git a/protocols/Weather/src/weather_svcs.cpp b/protocols/Weather/src/weather_svcs.cpp
index 757e243910..3c4c775347 100644
--- a/protocols/Weather/src/weather_svcs.cpp
+++ b/protocols/Weather/src/weather_svcs.cpp
@@ -271,9 +271,9 @@ void InitServices(void)
CreateProtoServiceFunction(MODULENAME, PS_BASICSEARCH, WeatherBasicSearch);
CreateProtoServiceFunction(MODULENAME, PS_SEARCHBYEMAIL, WeatherBasicSearch);
CreateProtoServiceFunction(MODULENAME, PS_ADDTOLIST, WeatherAddToList);
- CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, WeatherGetInfo);
+ CreateProtoServiceFunction(MODULENAME, PS_GETINFO, WeatherGetInfo);
CreateProtoServiceFunction(MODULENAME, PS_GETAVATARINFO, WeatherGetAvatarInfo);
- CreateProtoServiceFunction(MODULENAME, PSS_GETAWAYMSG, WeatherGetAwayMsg);
+ CreateProtoServiceFunction(MODULENAME, PS_GETAWAYMSG, WeatherGetAwayMsg);
CreateProtoServiceFunction(MODULENAME, PS_CREATEADVSEARCHUI, WeatherCreateAdvancedSearchUI);
CreateProtoServiceFunction(MODULENAME, PS_SEARCHBYADVANCED, WeatherAdvancedSearch);
CreateProtoServiceFunction(MODULENAME, PS_GETADVANCEDSTATUSICON, WeatherAdvancedStatusIcon);
diff --git a/protocols/WebView/src/main.cpp b/protocols/WebView/src/main.cpp
index eb67282a15..77375f0e63 100644
--- a/protocols/WebView/src/main.cpp
+++ b/protocols/WebView/src/main.cpp
@@ -64,7 +64,7 @@ void InitServices()
CreateProtoServiceFunction(MODULENAME, PS_GETSTATUS, GetStatus);
CreateProtoServiceFunction(MODULENAME, PS_BASICSEARCH, BasicSearch);
CreateProtoServiceFunction(MODULENAME, PS_ADDTOLIST, AddToList);
- CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, GetInfo);
+ CreateProtoServiceFunction(MODULENAME, PS_GETINFO, GetInfo);
}
/////////////////////////////////////////////////////////////////////////////////////////
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)) {