From 9cca190bc3022311915eb1e95b3cc3bb89aed328 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 25 Jan 2020 14:24:53 +0300 Subject: massive code cleaning: - GCHOOK structure normalized (i.e. inlined SESSION_INFO fields replaced with a reference to SESSION_INFO); - fake CMsgDialog declaration added to m_srmm_int.h, thus duplicated declarations in plugins aren't needed anymore - other minor changes --- protocols/MSN/src/msn_chat.cpp | 22 +++++++++++----------- protocols/MSN/src/stdafx.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'protocols/MSN/src') diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 3bd58d51fe..4cbdab32b4 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -138,7 +138,7 @@ void CMsnProto::MSN_KillChatSession(const wchar_t* id) void CMsnProto::MSN_Kickuser(GCHOOK *gch) { - GCThreadData *thread = MSN_GetThreadByChatId(gch->ptszID); + GCThreadData *thread = MSN_GetThreadByChatId(gch->si->ptszID); msnNsThread->sendPacketPayload("DEL", "MSGR\\THREAD", "%d:%s%s", thread->netId, thread->szEmail, _T2A(gch->ptszUID).get()); @@ -146,7 +146,7 @@ void CMsnProto::MSN_Kickuser(GCHOOK *gch) void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole) { - GCThreadData *thread = MSN_GetThreadByChatId(gch->ptszID); + GCThreadData *thread = MSN_GetThreadByChatId(gch->si->ptszID); msnNsThread->sendPacketPayload("PUT", "MSGR\\THREAD", "%d:%s%s%s", thread->netId, thread->szEmail, _T2A(gch->ptszUID).get(), pszRole); @@ -458,12 +458,12 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) if (!gch) return 1; - if (_stricmp(gch->pszModule, m_szModuleName)) return 0; + if (_stricmp(gch->si->pszModule, m_szModuleName)) return 0; switch (gch->iType) { case GC_SESSION_TERMINATE: { - GCThreadData* thread = MSN_GetThreadByChatId(gch->ptszID); + GCThreadData* thread = MSN_GetThreadByChatId(gch->si->ptszID); if (thread == nullptr) break; @@ -476,7 +476,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_MESSAGE: if (gch->ptszText && gch->ptszText[0]) { - GCThreadData* thread = MSN_GetThreadByChatId(gch->ptszID); + GCThreadData* thread = MSN_GetThreadByChatId(gch->si->ptszID); if (thread) { wchar_t* pszMsg = Chat_UnescapeTags(NEWWSTR_ALLOCA(gch->ptszText)); rtrimw(pszMsg); // remove the ending linebreak @@ -486,7 +486,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) int bError = getWString("Nick", &dbv); GCEVENT gce = { m_szModuleName, 0, GC_EVENT_MESSAGE }; - gce.pszID.w = gch->ptszID; + gce.pszID.w = gch->si->ptszID; gce.dwFlags = GCEF_ADDTOLOG; gce.pszNick.w = bError ? L"" : dbv.pwszVal; gce.pszUID.w = mir_a2u(MyOptions.szEmail); @@ -504,7 +504,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_CHANMGR: DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat, - LPARAM(new InviteChatParam(gch->ptszID, NULL, this))); + LPARAM(new InviteChatParam(gch->si->ptszID, NULL, this))); break; case GC_USER_PRIVMESS: @@ -515,11 +515,11 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) switch (gch->dwData) { case 10: DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat, - LPARAM(new InviteChatParam(gch->ptszID, NULL, this))); + LPARAM(new InviteChatParam(gch->si->ptszID, NULL, this))); break; case 20: - MSN_KillChatSession(gch->ptszID); + MSN_KillChatSession(gch->si->ptszID); break; } break; @@ -539,11 +539,11 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) break; case 110: - MSN_KillChatSession(gch->ptszID); + MSN_KillChatSession(gch->si->ptszID); break; case 40: - const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->ptszID), _T2A(gch->ptszUID)); + const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->si->ptszID), _T2A(gch->ptszUID)); MSN_Promoteuser(gch, (pszRole && !mir_wstrcmp(pszRole, L"admin")) ? "user" : "admin"); break; } diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 3cea2d0513..2541a56b48 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -56,7 +56,7 @@ along with this program. If not, see . #include #include #include -#include +#include #include #include #include -- cgit v1.2.3