diff options
| author | George Hazan <george.hazan@gmail.com> | 2015-01-29 15:34:37 +0000 | 
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2015-01-29 15:34:37 +0000 | 
| commit | 25a7a059a20f51e6df201ba606e38c4aef45e8f0 (patch) | |
| tree | 4bd42c4bc7cbd7b45d7db633d0e9aa8a42595e97 /protocols/WhatsApp/src/WhatsAPI++ | |
| parent | ddb498e9d73f3cba46791983ecece2371796f29b (diff) | |
- 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
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);
 | 
