From 25a7a059a20f51e6df201ba606e38c4aef45e8f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 29 Jan 2015 15:34:37 +0000 Subject: - receipts for offline messages - slightly enilghtened login procedure - WHATSAPP_KEY_PUSH_NAME removed git-svn-id: http://svn.miranda-ng.org/main/trunk@11950 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 18 ++++++++++++++++++ protocols/WhatsApp/src/WhatsAPI++/WAConnection.h | 1 + 2 files changed, 19 insertions(+) (limited to 'protocols/WhatsApp/src/WhatsAPI++') diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp index 5566d23145..9aa4450937 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp @@ -210,6 +210,8 @@ bool WAConnection::read() throw(WAException) parseMessage(node); else if (ProtocolTreeNode::tagEquals(node, "ack")) parseAck(node); + else if (ProtocolTreeNode::tagEquals(node, "receipt")) + parseReceipt(node); else if (ProtocolTreeNode::tagEquals(node, "chatstates")) parseChatStates(node); @@ -266,6 +268,22 @@ void WAConnection::parseAck(ProtocolTreeNode *node) throw(WAException) } } +void WAConnection::parseReceipt(ProtocolTreeNode *node) throw(WAException) +{ + const string &from = node->getAttributeValue("from"); + const string &id = node->getAttributeValue("id"); + const string &ts = node->getAttributeValue("t"); + + if (m_pEventHandler != NULL) { + FMessage msg(from, false, id); + msg.status = FMessage::STATUS_RECEIVED_BY_TARGET; + m_pEventHandler->onMessageStatusUpdate(&msg); + } + + out.write(ProtocolTreeNode("ack") + << XATTR("to", from) << XATTR("id", id) << XATTR("type", "read") << XATTRI("t", time(0))); +} + void WAConnection::parseChatStates(ProtocolTreeNode *node) throw (WAException) { const string &from = node->getAttributeValue("from"); diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h index 6bc53e4c86..6ed955caa7 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h @@ -335,6 +335,7 @@ private: void parseIq(ProtocolTreeNode *node) throw(WAException); void parseMessage(ProtocolTreeNode* node) throw(WAException); void parsePresense(ProtocolTreeNode*) throw(WAException); + void parseReceipt(ProtocolTreeNode *node) throw (WAException); std::map parseCategories(ProtocolTreeNode* node) throw(WAException); void sendMessageWithMedia(FMessage* message) throw(WAException); -- cgit v1.2.3