From e254312f9a660c83081ce2062ab14ba3c3614089 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 19 Sep 2017 14:12:58 +0300 Subject: useless structure GCDEST finally removed --- protocols/Discord/src/dispatch.cpp | 12 ++++-------- protocols/Discord/src/groupchat.cpp | 10 +++++----- protocols/Discord/src/guilds.cpp | 6 ++---- protocols/Discord/src/server.cpp | 3 +-- 4 files changed, 12 insertions(+), 19 deletions(-) (limited to 'protocols/Discord') diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 2046ae149d..f9d38405cf 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -141,8 +141,7 @@ void CDiscordProto::OnCommandChannelUpdated(const JSONNode &pRoot) CMStringW wszTopic = pRoot["topic"].as_mstring(); Chat_SetStatusbarText(m_szModuleName, pUser->wszUsername, wszTopic); - GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC }; gce.ptszText = wszTopic; gce.time = time(0); Chat_Event(&gce); @@ -275,8 +274,7 @@ void CDiscordProto::OnCommandGuildMemberRemoved(const JSONNode &pRoot) if (pUser.guildId != pGuild->id) continue; - GCDEST gcd = { m_szModuleName, pUser.wszUsername, GC_EVENT_PART }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_PART }; gce.time = time(0); gce.ptszUID = wszUserId; Chat_Event(&gce); @@ -311,8 +309,7 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot) wszOldNick = ui->pszNick; } - GCDEST gcd = { m_szModuleName, pUser.wszUsername, GC_EVENT_NICK }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_NICK }; gce.time = time(0); gce.ptszUID = wszUserId; gce.ptszNick = wszOldNick; @@ -421,8 +418,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot) ParseSpecialChars(si, wszText); - GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE }; gce.dwFlags = GCEF_ADDTOLOG; gce.ptszUID = wszUserId; gce.ptszText = wszText; diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index 729afc84f0..825d8267d2 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -82,7 +82,7 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch) return; setId(hContact, DB_KEY_ID, userId); - setId(hContact, DB_KEY_CHANNELID, _wtoi64(gch->pDest->ptszID)); + setId(hContact, DB_KEY_CHANNELID, _wtoi64(gch->ptszID)); setWString(hContact, "Nick", gch->ptszNick); db_set_b(hContact, "CList", "Hidden", 1); db_set_dw(hContact, "Ignore", "Mask1", 0); @@ -94,7 +94,7 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch) void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch) { - CDiscordUser *pUser = FindUserByChannel(_wtoi64(gch->pDest->ptszID)); + CDiscordUser *pUser = FindUserByChannel(_wtoi64(gch->ptszID)); if (pUser == nullptr) return; @@ -154,10 +154,10 @@ int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam) if (gch == nullptr) return 0; - if (mir_strcmpi(gch->pDest->pszModule, m_szModuleName)) + if (mir_strcmpi(gch->pszModule, m_szModuleName)) return 0; - switch (gch->pDest->iType) { + switch (gch->iType) { case GC_USER_MESSAGE: if (mir_wstrlen(gch->ptszText) > 0) { rtrimw(gch->ptszText); @@ -167,7 +167,7 @@ int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam) Chat_UnescapeTags(wszText); JSONNode body; body << WCHAR_PARAM("content", wszText); - CMStringA szUrl(FORMAT, "/channels/%S/messages", gch->pDest->ptszID); + CMStringA szUrl(FORMAT, "/channels/%S/messages", gch->ptszID); Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, &CDiscordProto::OnReceiveMessage, &body)); } } diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index 4b89937cd6..dcc19ad354 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -112,8 +112,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS if (!wszTopic.IsEmpty()) { Chat_SetStatusbarText(m_szModuleName, wszChannelId, wszTopic); - GCDEST gcd = { m_szModuleName, wszChannelId, GC_EVENT_TOPIC }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, wszChannelId, GC_EVENT_TOPIC }; gce.time = time(0); gce.ptszText = wszTopic; Chat_Event(&gce); @@ -147,8 +146,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS void CDiscordProto::ApplyUsersToChannel(CDiscordGuild *pGuild, const CDiscordUser &pUser) { - GCDEST gcd = { m_szModuleName, pUser.wszUsername, GC_EVENT_JOIN }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_JOIN }; gce.time = time(0); gce.dwFlags = GCEF_SILENT; diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index 60d713d4f2..1d48a3dc04 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -117,8 +117,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest else { ParseSpecialChars(si, wszText); - GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE }; - GCEVENT gce = { &gcd }; + GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE }; gce.dwFlags = GCEF_ADDTOLOG; gce.ptszUID = wszUserId; gce.ptszText = wszText; -- cgit v1.2.3