summaryrefslogtreecommitdiff
path: root/protocols/Twitter/src/chat.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-19 12:31:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-19 12:31:20 +0300
commit46fd8bbce689895bfbaaa08d9bad73b879e17172 (patch)
tree965513d22957bad31ea5d6fb2ea8f9ea94c9cd75 /protocols/Twitter/src/chat.cpp
parent845d6d07ee1c6c87c7dacae4f0ba0a803a5aff3d (diff)
Twitter:
- fixes #2218 (add support for private messages); - code optimization; - support for JSON requests; - fixed base url;
Diffstat (limited to 'protocols/Twitter/src/chat.cpp')
-rw-r--r--protocols/Twitter/src/chat.cpp14
1 files changed, 4 insertions, 10 deletions
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 <http://www.gnu.org/licenses/>.
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<DWORD>(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<wchar_t*>(gce.pszNick.w));
- mir_free(const_cast<wchar_t*>(gce.pszUID.w));
- mir_free(const_cast<wchar_t*>(gce.pszText.w));
}
int CTwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)