From dd6ac172c4f814fa4b5ace6caca80d00d7e01ac8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 20 Feb 2020 21:23:22 +0300 Subject: bunch of useless threads replaced with a call of ProtoBroadcastAsync --- protocols/IRCG/src/ircproto.cpp | 36 +++--------------------------------- protocols/IRCG/src/ircproto.h | 3 --- 2 files changed, 3 insertions(+), 36 deletions(-) (limited to 'protocols/IRCG/src') 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 // 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); -- cgit v1.2.3