diff options
author | George Hazan <ghazan@miranda.im> | 2020-02-20 21:23:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-02-20 21:23:22 +0300 |
commit | dd6ac172c4f814fa4b5ace6caca80d00d7e01ac8 (patch) | |
tree | 805abd69e64f8e1f268e6415689de8742cac2215 /protocols/IRCG | |
parent | 79d99837e0fefa32d695dba7e2a13b8a42f39da2 (diff) |
bunch of useless threads replaced with a call of ProtoBroadcastAsync
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 36 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.h | 3 |
2 files changed, 3 insertions, 36 deletions
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index d05c5a5027..1b4fbb5a31 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -630,47 +630,17 @@ HANDLE CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFile ////////////////////////////////////////////////////////////////////////////////////////
// SendMessage - sends a message
-struct TFakeAckParam
-{
- __inline TFakeAckParam(MCONTACT _hContact, int _msgid) :
- hContact(_hContact), msgid(_msgid)
- {}
-
- MCONTACT hContact;
- int msgid;
-};
-
-void __cdecl CIrcProto::AckMessageFail(void *info)
-{
- Thread_SetName("IRC: AckMessageFail");
- ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The protocol is not online"));
-}
-
-void __cdecl CIrcProto::AckMessageFailDcc(void *info)
-{
- Thread_SetName("IRC: AckMessageFailDcc");
- ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The dcc chat connection is not active"));
-}
-
-void __cdecl CIrcProto::AckMessageSuccess(void *info)
-{
- Thread_SetName("IRC: AckMessageSuccess");
- TFakeAckParam *param = (TFakeAckParam*)info;
- ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)param->msgid, 0);
- delete param;
-}
-
int CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
BYTE bDcc = getByte(hContact, "DCC", 0);
WORD wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (bDcc && wStatus != ID_STATUS_ONLINE) {
- ForkThread(&CIrcProto::AckMessageFailDcc, (void*)hContact);
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The dcc chat connection is not active"));
return 0;
}
if (!bDcc && (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)) {
- ForkThread(&CIrcProto::AckMessageFail, (void*)hContact);
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The protocol is not online"));
return 0;
}
@@ -680,7 +650,7 @@ int CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) mir_free(result);
int seq = InterlockedIncrement(&g_msgid);
- ForkThread(&CIrcProto::AckMessageSuccess, new TFakeAckParam(hContact, seq));
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)seq);
return seq;
}
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index 11f43c23b3..fb8839d056 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -232,9 +232,6 @@ struct CIrcProto : public PROTO<CIrcProto> // ircproto.cpp void __cdecl AckBasicSearch(void* param); - void __cdecl AckMessageFail(void* info); - void __cdecl AckMessageFailDcc(void* info); - void __cdecl AckMessageSuccess(void* info); int SetStatusInternal(int iNewStatus, bool bIsInternal); |