summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_protoint.h2
-rw-r--r--include/m_protosvc.h14
-rw-r--r--plugins/NewsAggregator/Src/NewsAggregator.cpp1
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp6
-rw-r--r--plugins/NewsAggregator/Src/stdafx.h1
-rw-r--r--protocols/Discord/src/proto.cpp3
-rw-r--r--protocols/FacebookRM/src/messages.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp3
-rw-r--r--protocols/MSN/src/msn_proto.cpp3
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp4
-rw-r--r--protocols/Steam/src/steam_history.cpp2
-rw-r--r--protocols/Steam/src/steam_polling.cpp2
-rw-r--r--protocols/Twitter/src/proto.cpp8
-rw-r--r--protocols/Twitter/src/proto.h1
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp9
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
-rw-r--r--src/mir_app/src/miranda.h2
-rw-r--r--src/mir_app/src/proto_internal.cpp5
-rw-r--r--src/mir_app/src/proto_utils.cpp37
-rw-r--r--src/mir_app/src/protocols.cpp36
22 files changed, 47 insertions, 105 deletions
diff --git a/include/m_protoint.h b/include/m_protoint.h
index 6231df6990..d105f55862 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -229,6 +229,8 @@ public:
template<class T> struct PROTO : public PROTO_INTERFACE
{
+ typedef PROTO_INTERFACE CSuper;
+
__forceinline PROTO(const char *szProto, const wchar_t *tszUserName) :
PROTO_INTERFACE(szProto, tszUserName)
{}
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index 0ccd3d3c46..e376c3d4ab 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -770,14 +770,6 @@ struct PROTORECVEVENT
#define PSR_MESSAGE "/RecvMessage"
-#define MS_PROTO_RECVMSG "Proto/RecvMessage"
-
-__forceinline INT_PTR Proto_RecvMessage(MCONTACT hContact, PROTORECVEVENT *pcre)
-{
- CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pcre };
- return CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs);
-}
-
__forceinline INT_PTR ProtoChainRecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
{
CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre };
@@ -817,12 +809,6 @@ struct PROTORECVFILE
#define MS_PROTO_RECVFILET "Proto/RecvFileT"
-__forceinline INT_PTR Proto_RecvFile(MCONTACT hContact, PROTORECVFILE *pcre)
-{
- CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pcre };
- return CallService(MS_PROTO_RECVFILET, 0, (LPARAM)&ccs);
-}
-
__forceinline INT_PTR ProtoChainRecvFile(MCONTACT hContact, PROTORECVFILE *pre)
{
CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pre };
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp
index bc9d91ac3a..57eaa475f7 100644
--- a/plugins/NewsAggregator/Src/NewsAggregator.cpp
+++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp
@@ -78,7 +78,6 @@ extern "C" __declspec(dllexport) int Load(void)
CreateProtoServiceFunction(MODULE, PS_LOADICON, NewsAggrLoadIcon);
CreateProtoServiceFunction(MODULE, PSS_GETINFO, NewsAggrGetInfo);
CreateProtoServiceFunction(MODULE, PS_GETAVATARINFO, NewsAggrGetAvatarInfo);
- CreateProtoServiceFunction(MODULE, PSR_MESSAGE, NewsAggrRecvMessage);
CreateServiceFunction(MS_NEWSAGGREGATOR_CHECKALLFEEDS, CheckAllFeeds);
CreateServiceFunction(MS_NEWSAGGREGATOR_ADDFEED, AddFeed);
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index 92bfa6aa8a..885f311fe1 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -213,12 +213,6 @@ INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam, LPARAM lParam)
return GAIR_WAITFOR;
}
-INT_PTR NewsAggrRecvMessage(WPARAM, LPARAM lParam)
-{
- CallService(MS_PROTO_RECVMSG, 0, lParam);
- return 0;
-}
-
void UpdateMenu(bool State)
{
if (!State) // to enable auto-update
diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h
index c1091c1f63..c5c66a8116 100644
--- a/plugins/NewsAggregator/Src/stdafx.h
+++ b/plugins/NewsAggregator/Src/stdafx.h
@@ -108,7 +108,6 @@ INT_PTR NewsAggrGetStatus(WPARAM/* wp*/, LPARAM/* lp*/);
INT_PTR NewsAggrLoadIcon(WPARAM wParam, LPARAM lParam);
INT_PTR NewsAggrGetInfo(WPARAM wParam, LPARAM lParam);
INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam, LPARAM lParam);
-INT_PTR NewsAggrRecvMessage(WPARAM wParam, LPARAM lParam);
INT_PTR CheckAllFeeds(WPARAM wParam, LPARAM lParam);
INT_PTR AddFeed(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index ab1253571e..0b450a9fda 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -337,8 +337,7 @@ int CDiscordProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
T2Utf szResUtf((const wchar_t*)evt->lParam);
evt->pCustomData = (char*)szResUtf;
evt->cbCustomDataSize = (DWORD)mir_strlen(szResUtf);
- Proto_RecvMessage(hContact, evt);
- return 0;
+ return CSuper::RecvMsg(hContact, evt);
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index 5c128d5bb2..263f33a462 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -26,7 +26,7 @@ int FacebookProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
{
StopTyping(hContact);
- return Proto_RecvMessage(hContact, pre);
+ return CSuper::RecvMsg(hContact, pre);
}
void FacebookProto::SendMsgWorker(void *p)
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index 65e3ce7a1b..4d95ef5828 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -925,14 +925,6 @@ int GaduProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t *)
}
////////////////////////////////////////////////////////////
-// Called when received an file
-//
-int GaduProto::RecvFile(MCONTACT hContact, PROTORECVFILE* pre)
-{
- return Proto_RecvFile(hContact, pre);
-}
-
-////////////////////////////////////////////////////////////
// Called when user sends a file
//
HANDLE GaduProto::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles)
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index f342797018..543c936ea4 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -45,8 +45,6 @@ struct GaduProto : public PROTO<GaduProto>
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
- virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILE*);
-
virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 037094c27c..a360260186 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -752,8 +752,7 @@ int __cdecl CJabberProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
T2Utf szResUtf((LPCTSTR)evt->lParam);
evt->pCustomData = (char*)szResUtf;
evt->cbCustomDataSize = (DWORD)mir_strlen(szResUtf);
- Proto_RecvMessage(hContact, evt);
- return 0;
+ return CSuper::RecvMsg(hContact, evt);
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index 8be8598f2a..d4498913e1 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -672,8 +672,7 @@ int __cdecl CMsnProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
db_unset(hContact, "CList", "Hidden");
}
-
- return Proto_RecvMessage(hContact, pre);
+ return CSuper::RecvMsg(hContact, pre);
}
int CMsnProto::GetInfo(MCONTACT hContact, int)
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index 9adfa781f7..5ff1285790 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -188,7 +188,7 @@ int CSametimeProto::RecvFile(MCONTACT hContact, PROTORECVFILE* pre)
db_unset(hContact, "CList", "Hidden");
db_unset(hContact, "CList", "NotOnList");
- return Proto_RecvFile(hContact, pre);
+ return CSuper::RecvFile(hContact, pre);
}
int CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
@@ -198,7 +198,7 @@ int CSametimeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
db_unset(hContact, "CList", "Hidden");
db_unset(hContact, "CList", "NotOnList");
- return Proto_RecvMessage(hContact, pre);
+ return CSuper::RecvMsg(hContact, pre);
}
HANDLE CSametimeProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp
index d78da4b4bd..987b96ecea 100644
--- a/protocols/Steam/src/steam_history.cpp
+++ b/protocols/Steam/src/steam_history.cpp
@@ -74,6 +74,6 @@ void CSteamProto::OnGotHistoryMessages(const JSONNode &root, void *arg)
if (IsMe(steamId))
recv.flags = PREF_SENT;
- Proto_RecvMessage(hContact, &recv);
+ RecvMsg(hContact, &recv);
}
}
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp
index b2a85ff670..24b9047d9b 100644
--- a/protocols/Steam/src/steam_polling.cpp
+++ b/protocols/Steam/src/steam_polling.cpp
@@ -21,7 +21,7 @@ void CSteamProto::ParsePollData(const JSONNode &data)
recv.timestamp = timestamp;
recv.szMessage = (char*)text.c_str();
recv.flags = PREF_SENT;
- Proto_RecvMessage(hContact, &recv);
+ RecvMsg(hContact, &recv);
}
else if (type == "saytext" || type =="emote") {
json_string text = item["text"].as_string();
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index 1cb498226b..588c866a0e 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -98,14 +98,6 @@ DWORD_PTR TwitterProto::GetCaps(int type, MCONTACT)
// *************************
-int TwitterProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
-{
- Proto_RecvMessage(hContact, pre);
- return 0;
-}
-
-// *************************
-
struct send_direct
{
__inline send_direct(MCONTACT _hContact, const std::string &_msg, int _msgid) :
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h
index f381516075..e1e7dd051e 100644
--- a/protocols/Twitter/src/proto.h
+++ b/protocols/Twitter/src/proto.h
@@ -36,7 +36,6 @@ public:
virtual HANDLE __cdecl SearchBasic(const wchar_t *);
virtual HANDLE __cdecl SearchByEmail(const wchar_t *);
- virtual int __cdecl RecvMsg(MCONTACT, PROTORECVEVENT *);
virtual int __cdecl SendMsg(MCONTACT, int, const char *);
virtual int __cdecl SetStatus(int);
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index cd3661e119..839066adb1 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -19,15 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////
-int CVkProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
-{
- debugLogA("CVkProto::RecvMsg");
- Proto_RecvMessage(hContact, pre);
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
void CVkProto::SendMsgAck(void *param)
{
debugLogA("CVkProto::SendMsgAck");
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 1a53fd325f..8b7abdbb8a 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -61,7 +61,6 @@ struct CVkProto : public PROTO<CVkProto>
virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
virtual HANDLE __cdecl SearchByEmail(const wchar_t *email);
virtual HANDLE __cdecl SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName);
- virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg);
virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles);
virtual int __cdecl SetStatus(int iNewStatus);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 476c80b070..0e2c27aec4 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -131,7 +131,7 @@ extern OBJLIST<CListEvent> g_cliEvents;
extern LIST<PROTOACCOUNT> accounts;
extern LIST<PROTOCOLDESCRIPTOR> protos;
-INT_PTR ProtoCallService(LPCSTR szModule, const char *szService, WPARAM wParam, LPARAM lParam);
+INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const wchar_t *tszAccountName);
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp
index 437f9cd0a4..bb57cde70c 100644
--- a/src/mir_app/src/proto_internal.cpp
+++ b/src/mir_app/src/proto_internal.cpp
@@ -46,6 +46,8 @@ void FreeFilesMatrix(wchar_t ***files)
struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
{
+ typedef PROTO_INTERFACE CSuper;
+
DEFAULT_PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszUserName) :
PROTO_INTERFACE(pszModuleName, ptszUserName)
{}
@@ -200,7 +202,8 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT* evt) override
{
CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)evt };
- return (int)ProtoCallService(m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs);
+ INT_PTR res = ProtoCallService(m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs);
+ return (res != CALLSERVICE_NOTFOUND) ? (int)res : CSuper::RecvMsg(hContact, evt);
}
virtual int __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT* evt) override
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index f667522e06..199e730fd8 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -388,15 +388,42 @@ int PROTO_INTERFACE::RecvContacts(MCONTACT, PROTORECVEVENT*)
return 1; // error
}
-int PROTO_INTERFACE::RecvFile(MCONTACT hContact, PROTORECVFILE *evt)
+int PROTO_INTERFACE::RecvFile(MCONTACT hContact, PROTORECVFILE *pcre)
{
- return ::Proto_RecvFile(hContact, evt); // default file receiver
+ CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pcre };
+ return CallService(MS_PROTO_RECVFILET, 0, (LPARAM)&ccs);
}
-int PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
+int PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
{
- ::Proto_RecvMessage(hContact, evt); // default message receiver
- return 0;
+ if (pre->szMessage == nullptr)
+ return 0;
+
+ ptrA pszTemp;
+ mir_ptr<BYTE> pszBlob;
+
+ DBEVENTINFO dbei = {};
+ dbei.flags = DBEF_UTF;
+ dbei.szModule = GetContactProto(hContact);
+ dbei.timestamp = pre->timestamp;
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
+ dbei.pBlob = (PBYTE)pre->szMessage;
+
+ if (pre->cbCustomDataSize != 0) {
+ pszBlob = (PBYTE)mir_alloc(dbei.cbBlob + pre->cbCustomDataSize);
+ memcpy(pszBlob, dbei.pBlob, dbei.cbBlob);
+ memcpy((PBYTE)pszBlob + dbei.cbBlob, pre->pCustomData, pre->cbCustomDataSize);
+ dbei.pBlob = pszBlob;
+ dbei.cbBlob += pre->cbCustomDataSize;
+ }
+
+ if (pre->flags & PREF_CREATEREAD)
+ dbei.flags |= DBEF_READ;
+ if (pre->flags & PREF_SENT)
+ dbei.flags |= DBEF_SENT;
+
+ return (INT_PTR)db_event_add(hContact, &dbei);
}
int PROTO_INTERFACE::RecvUrl(MCONTACT, PROTORECVEVENT*)
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 2e9d6652b8..8e2896414d 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -148,40 +148,6 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
/////////////////////////////////////////////////////////////////////////////////////////
// Basic core services
-static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA*)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
- if (pre->szMessage == nullptr)
- return 0;
-
- ptrA pszTemp;
- mir_ptr<BYTE> pszBlob;
-
- DBEVENTINFO dbei = {};
- dbei.flags = DBEF_UTF;
- dbei.szModule = GetContactProto(ccs->hContact);
- dbei.timestamp = pre->timestamp;
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
- dbei.pBlob = (PBYTE)pre->szMessage;
-
- if (pre->cbCustomDataSize != 0) {
- pszBlob = (PBYTE)mir_alloc(dbei.cbBlob + pre->cbCustomDataSize);
- memcpy(pszBlob, dbei.pBlob, dbei.cbBlob);
- memcpy((PBYTE)pszBlob + dbei.cbBlob, pre->pCustomData, pre->cbCustomDataSize);
- dbei.pBlob = pszBlob;
- dbei.cbBlob += pre->cbCustomDataSize;
- }
-
- if (pre->flags & PREF_CREATEREAD)
- dbei.flags |= DBEF_READ;
- if (pre->flags & PREF_SENT)
- dbei.flags |= DBEF_SENT;
-
- return (INT_PTR)db_event_add(ccs->hContact, &dbei);
-}
-
MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre)
{
if (szProtoName == nullptr || pcre == nullptr)
@@ -460,8 +426,6 @@ int LoadProtocolsModule(void)
CreateServiceFunction(MS_PROTO_SELFISTYPING, Proto_SelfIsTyping);
CreateServiceFunction(MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping);
- CreateServiceFunction(MS_PROTO_RECVMSG, Proto_RecvMessage);
-
CreateServiceFunction(MS_PROTO_CREATEACCOUNT, srvProto_CreateAccount);
// just to make QuickSearch happy