diff options
-rw-r--r-- | src/mir_app/src/miranda.h | 3 | ||||
-rw-r--r-- | src/mir_app/src/proto_chains.cpp | 36 | ||||
-rw-r--r-- | src/mir_app/src/protocols.cpp | 2 |
3 files changed, 35 insertions, 6 deletions
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index 24486ff3aa..3a7f358eac 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -166,6 +166,9 @@ void WriteDbAccounts(void); INT_PTR CallProtoServiceInt(MCONTACT hContact, const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam);
+INT_PTR stubChainRecv(WPARAM, LPARAM);
+#define MS_PROTO_HIDDENSTUB "Proto/stubChainRecv"
+
/**** utils.cpp ************************************************************************/
void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key);
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index e8b7338e91..60b1e2ad00 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -70,7 +70,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs) }
char szProto[40];
- if (GetProtocolP((MCONTACT)ccs->hContact, szProto, sizeof(szProto)))
+ if (GetProtocolP(ccs->hContact, szProto, sizeof(szProto)))
return 1;
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
@@ -91,16 +91,40 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs) MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam)
{
+ INT_PTR ret;
CCSDATA ccs = { hContact, szProtoService, wParam, lParam };
- return Proto_ChainSend(0, &ccs);
+
+ for (int i = 0; i < filters.getCount(); i++) {
+ if ((ret = CallProtoServiceInt(hContact, filters[i]->szName, szProtoService, i + 1, (LPARAM)&ccs)) != CALLSERVICE_NOTFOUND) {
+ //chain was started, exit
+ return ret;
+ }
+ }
+
+ char szProto[40];
+ if (GetProtocolP(hContact, szProto, sizeof(szProto)))
+ return 1;
+
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
+ if (pa == NULL || pa->ppro == NULL)
+ return 1;
+
+ if (pa->bOldProto)
+ ret = CallProtoServiceInt(hContact, szProto, szProtoService, (WPARAM)(-1), (LPARAM)&ccs);
+ else
+ ret = CallProtoServiceInt(hContact, szProto, szProtoService, wParam, lParam);
+ if (ret == CALLSERVICE_NOTFOUND)
+ ret = 1;
+
+ return ret;
}
/////////////////////////////////////////////////////////////////////////////////////////
-static void __stdcall stubChainRecv(void *param)
+INT_PTR stubChainRecv(WPARAM wParam, LPARAM lParam)
{
- CCSDATA *ccs = (CCSDATA*)param;
- Proto_ChainRecv(0, ccs);
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ return Proto_ChainRecv(wParam, ccs);
}
MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs)
@@ -114,7 +138,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs) // begin processing by finding end of chain
if (iOrder == 0) {
if (GetCurrentThreadId() != hMainThreadId) // restart this function in the main thread
- return CallFunctionAsync(stubChainRecv, ccs);
+ return CallServiceSync(MS_PROTO_HIDDENSTUB, iOrder, LPARAM(ccs));
iOrder = filters.getCount();
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 6d9ee1b9e9..1d81c61188 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -472,6 +472,8 @@ int LoadProtocolsModule(void) // just to make QuickSearch happy
CreateServiceFunction("Proto/GetContactBaseAccount", srvProto_GetContactBaseAccount);
+
+ CreateServiceFunction(MS_PROTO_HIDDENSTUB, stubChainRecv);
return LoadProtoOptions();
}
|