summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp18
1 files changed, 18 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");