From 24c5c5da5e34c0cfb1f6798afb3029f85d5dd062 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Jan 2015 23:35:02 +0000 Subject: WhatsApp: fix for send/recv messages git-svn-id: http://svn.miranda-ng.org/main/trunk@11922 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++') diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp index 1abcd431dd..c7ce6648c8 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp @@ -185,16 +185,6 @@ void WAConnection::setLogin(WALogin* login) this->account_kind = login->account_kind; } -ProtocolTreeNode* WAConnection::getMessageNode(FMessage* message, ProtocolTreeNode *child) -{ - std::vector* messageChildren = new std::vector(); - messageChildren->push_back(new ProtocolTreeNode("x", new ProtocolTreeNode("server")) << XATTR("xmlns", "jabber:x:event")); - messageChildren->push_back(child); - - return new ProtocolTreeNode("message", NULL, messageChildren) << - XATTR("to", message->key->remote_jid) << XATTR("type", "chat") << XATTR("id", message->key->id); -} - void WAConnection::setVerboseId(bool b) { this->verbose = b; @@ -721,6 +711,18 @@ void WAConnection::sendInactive() throw(WAException) this->out->write(ProtocolTreeNode("presence") << XATTR("type", "inactive")); } +///////////////////////////////////////////////////////////////////////////////////////// + +ProtocolTreeNode* WAConnection::getMessageNode(FMessage* message, ProtocolTreeNode *child) +{ + std::vector* messageChildren = new std::vector(); + messageChildren->push_back(new ProtocolTreeNode("x", new ProtocolTreeNode("server")) << XATTR("xmlns", "jabber:x:event")); + messageChildren->push_back(child); + + return new ProtocolTreeNode("message", NULL, messageChildren) << + XATTR("to", message->key->remote_jid) << XATTR("type", "text") << XATTR("id", message->key->id) << XATTRI("t", message->timestamp); +} + void WAConnection::sendMessage(FMessage* message) throw(WAException) { if (message->media_wa_type != 0) @@ -779,6 +781,8 @@ void WAConnection::sendMessageReceived(FMessage* message) throw(WAException) << XATTR("to", message->key->remote_jid) << XATTR("type", "chat") << XATTR("id", message->key->id)); } +///////////////////////////////////////////////////////////////////////////////////////// + void WAConnection::sendNotificationReceived(const std::string& jid, const std::string& id) throw(WAException) { ProtocolTreeNode *child = new ProtocolTreeNode("received") << XATTR("xmlns", "urn:xmpp:receipts"); -- cgit v1.2.3