summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-26 23:35:02 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-26 23:35:02 +0000
commit24c5c5da5e34c0cfb1f6798afb3029f85d5dd062 (patch)
tree6c797923770fad042c93b5dfe41aa1de1eba7218 /protocols/WhatsApp
parent88d6662a12f18844e5487c3d35155d3fbbff85a5 (diff)
WhatsApp: fix for send/recv messages
git-svn-id: http://svn.miranda-ng.org/main/trunk@11922 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp24
-rw-r--r--protocols/WhatsApp/src/messages.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
-rw-r--r--protocols/WhatsApp/src/version.h2
4 files changed, 17 insertions, 13 deletions
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<ProtocolTreeNode*>* messageChildren = new std::vector<ProtocolTreeNode*>();
- 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<ProtocolTreeNode*>* messageChildren = new std::vector<ProtocolTreeNode*>();
+ 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");
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp
index 8d774a47d0..af077934d0 100644
--- a/protocols/WhatsApp/src/messages.cpp
+++ b/protocols/WhatsApp/src/messages.cpp
@@ -54,7 +54,7 @@ int WhatsAppProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
return 0;
}
- int msgId = this->m_pConnection->msg_id++;
+ int msgId = ++this->m_pConnection->msg_id;
try {
time_t now = time(NULL);
std::string id = Utilities::intToStr(now) + "-" + Utilities::intToStr(msgId);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 255417a277..76197975d1 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -205,7 +205,7 @@ HANDLE WhatsAppProto::SearchBasic(const PROTOCHAR* id)
return 0;
// fake - we always accept search
- SearchParam *param = new SearchParam(id, m_pConnection->msg_id++);
+ SearchParam *param = new SearchParam(id, ++m_pConnection->msg_id);
ForkThread(&WhatsAppProto::SearchAckThread, param);
return (HANDLE)param->id;
}
diff --git a/protocols/WhatsApp/src/version.h b/protocols/WhatsApp/src/version.h
index ca808c5877..0331aa5330 100644
--- a/protocols/WhatsApp/src/version.h
+++ b/protocols/WhatsApp/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 2
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>