From 46fd8bbce689895bfbaaa08d9bad73b879e17172 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 19 Feb 2020 12:31:20 +0300 Subject: Twitter: - fixes #2218 (add support for private messages); - code optimization; - support for JSON requests; - fixed base url; --- protocols/Twitter/src/chat.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'protocols/Twitter/src/chat.cpp') diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 72705dd926..733e4aacee 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -23,17 +23,15 @@ along with this program. If not, see . void CTwitterProto::UpdateChat(const twitter_user &update) { + CMStringA chatText = update.status.text.c_str(); + chatText.Replace("%", "%%"); + GCEVENT gce = { m_szModuleName, m_szChatId, GC_EVENT_MESSAGE }; gce.dwFlags = GCEF_UTF8 + GCEF_ADDTOLOG; gce.bIsMe = (update.username.c_str() == m_szUserName); gce.pszUID.a = update.username.c_str(); - //TODO: write code here to replace % with %% in update.status.text (which is a CMStringA) - - CMStringA chatText = update.status.text.c_str(); - chatText.Replace("%", "%%"); - gce.pszText.a = chatText.c_str(); - gce.time = static_cast(update.status.time); + gce.time = (DWORD)update.status.time; MCONTACT hContact = UsernameToHContact(update.username.c_str()); CMStringA szNick = db_get_sm(hContact, "CList", "MyHandle"); @@ -43,10 +41,6 @@ void CTwitterProto::UpdateChat(const twitter_user &update) gce.pszNick.a = update.username.c_str(); Chat_Event(&gce); - - mir_free(const_cast(gce.pszNick.w)); - mir_free(const_cast(gce.pszUID.w)); - mir_free(const_cast(gce.pszText.w)); } int CTwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) -- cgit v1.2.3