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/Twitter/src/chat.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'protocols/Twitter') diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 491ab50848..b323d0dbfc 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -24,9 +24,7 @@ along with this program. If not, see . void TwitterProto::UpdateChat(const twitter_user &update) { - GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE }; - GCEVENT gce = { &gcd }; - gce.pDest = &gcd; + GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE }; gce.bIsMe = (update.username == twit_.get_username()); gce.dwFlags = GCEF_ADDTOLOG; gce.ptszUID = mir_a2u(update.username.c_str()); @@ -59,10 +57,10 @@ void TwitterProto::UpdateChat(const twitter_user &update) int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) { GCHOOK *hook = reinterpret_cast(lParam); - if (mir_strcmp(hook->pDest->pszModule, m_szModuleName)) + if (mir_strcmp(hook->pszModule, m_szModuleName)) return 0; - switch (hook->pDest->iType) { + switch (hook->iType) { case GC_USER_MESSAGE: debugLogW(L"**Chat - Outgoing message: %s", hook->ptszText); { @@ -90,28 +88,26 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) // TODO: remove nick? void TwitterProto::AddChatContact(const char *name, const char *nick) { - GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN }; - GCEVENT gce = { &gcd }; + ptrW wszId(mir_a2u(name)); + ptrW wszNick(mir_a2u(nick ? nick : name)); + + GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN }; gce.time = DWORD(time(0)); - gce.ptszNick = mir_a2u(nick ? nick : name); - gce.ptszUID = mir_a2u(name); + gce.ptszNick = wszNick; + gce.ptszUID = wszId; gce.ptszStatus = L"Normal"; Chat_Event(&gce); - - mir_free(const_cast(gce.ptszNick)); - mir_free(const_cast(gce.ptszUID)); } void TwitterProto::DeleteChatContact(const char *name) { - GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART }; - GCEVENT gce = { &gcd }; + ptrW wszId(mir_a2u(name)); + + GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_PART }; gce.time = DWORD(time(0)); - gce.ptszNick = mir_a2u(name); + gce.ptszNick = wszId; gce.ptszUID = gce.ptszNick; Chat_Event(&gce); - - mir_free(const_cast(gce.ptszNick)); } INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress) -- cgit v1.2.3