diff options
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++')
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 18 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.h | 1 |
2 files changed, 19 insertions, 0 deletions
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<string, string> parseCategories(ProtocolTreeNode* node) throw(WAException);
void sendMessageWithMedia(FMessage* message) throw(WAException);
|