summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-29 19:45:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-29 19:45:00 +0000
commit7442e2473e41113ca0fbb40c7816267b3e5cbd16 (patch)
tree8c5c45039ad22f8be5d21fa97f6578fd6ec96c1f /protocols/WhatsApp/src
parentd2e609471178d3026f1c9ba140f4804b0ae12eb7 (diff)
fix for user typing notifications
git-svn-id: http://svn.miranda-ng.org/main/trunk@11953 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp2
-rw-r--r--protocols/WhatsApp/src/chat.cpp2
-rw-r--r--protocols/WhatsApp/src/entities.h7
-rw-r--r--protocols/WhatsApp/src/messages.cpp33
-rw-r--r--protocols/WhatsApp/src/proto.h2
5 files changed, 10 insertions, 36 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
index fcb659e97b..b5f52bb1e2 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
@@ -208,7 +208,7 @@ bool WAConnection::read() throw(WAException)
parseAck(node);
else if (ProtocolTreeNode::tagEquals(node, "receipt"))
parseReceipt(node);
- else if (ProtocolTreeNode::tagEquals(node, "chatstates"))
+ else if (ProtocolTreeNode::tagEquals(node, "chatstate"))
parseChatStates(node);
delete node;
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index 4c3d3afeeb..361da25850 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -38,8 +38,6 @@ int WhatsAppProto::OnChatOutgoing(WPARAM wParam, LPARAM lParam)
debugLogA("**Chat - Outgoing message: %s", text);
this->SendMsg(hContact, IS_CHAT, msg.c_str());
- // #TODO Move to SendMsgWorker, otherwise all messages are "acknowledged" by Miranda
-
GCDEST gcd = { m_szModuleName, hook->pDest->ptszID, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
diff --git a/protocols/WhatsApp/src/entities.h b/protocols/WhatsApp/src/entities.h
index 7cf037792e..c55e3dfd8a 100644
--- a/protocols/WhatsApp/src/entities.h
+++ b/protocols/WhatsApp/src/entities.h
@@ -12,13 +12,6 @@ struct send_direct
HANDLE msgid;
};
-struct send_typing
-{
- send_typing(MCONTACT hContact, const int status) : hContact(hContact), status(status) {}
- MCONTACT hContact;
- int status;
-};
-
struct input_box
{
tstring text;
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<send_typing*>(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)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 09e98b8a7c..cff4d14f65 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -103,8 +103,6 @@ public:
//////////////////////////////////////////////////////////////////////////////////////
// Worker Threads
- void __cdecl SendMsgWorker(void*);
- void __cdecl SendTypingWorker(void*);
void __cdecl SendGetGroupInfoWorker(void*);
void __cdecl SendSetGroupNameWorker(void*);
void __cdecl SendCreateGroupWorker(void*);