From 7442e2473e41113ca0fbb40c7816267b3e5cbd16 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 29 Jan 2015 19:45:00 +0000 Subject: fix for user typing notifications git-svn-id: http://svn.miranda-ng.org/main/trunk@11953 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/messages.cpp | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'protocols/WhatsApp/src/messages.cpp') diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 37b2ebad65..e139af9512 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -87,32 +87,17 @@ void WhatsAppProto::onIsTyping(const std::string& paramString, bool paramBoolean int WhatsAppProto::UserIsTyping(MCONTACT hContact, int type) { - if (hContact && isOnline()) - ForkThread(&WhatsAppProto::SendTypingWorker, new send_typing(hContact, type)); - - return 0; -} - -void WhatsAppProto::SendTypingWorker(void* p) -{ - if (p == NULL) - return; - - send_typing *typing = static_cast(p); - - // Don't send typing notifications to contacts which are offline - if (getWord(typing->hContact, "Status", 0) == ID_STATUS_OFFLINE) - return; - - ptrA jid(getStringA(typing->hContact, WHATSAPP_KEY_ID)); - if (jid && this->isOnline()) { - if (typing->status == PROTOTYPE_SELFTYPING_ON) - m_pConnection->sendComposing((char*)jid); - else - m_pConnection->sendPaused((char*)jid); + if (hContact && isOnline()) { + ptrA jid(getStringA(hContact, WHATSAPP_KEY_ID)); + if (jid && isOnline()) { + if (type == PROTOTYPE_SELFTYPING_ON) + m_pConnection->sendComposing((char*)jid); + else + m_pConnection->sendPaused((char*)jid); + } } - delete typing; + return 0; } void WhatsAppProto::onMessageStatusUpdate(FMessage* fmsg) -- cgit v1.2.3