summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-09-13 14:32:53 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-09-13 14:32:53 +0000
commitcf0be00671d56bb18118e1491e7c1f0e131e7b3d (patch)
tree407d1760615f4cf22a4e664f242ae045a4cf8408 /protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
parent6f20ee4beb6b840ed81489358bca01ed41a0ea56 (diff)
Patch by Cassio:
Another patch, which fixes last seen timestamps/presence due to a change in WA protocol: There is no longer a last seen request/response as this info is now received within the presence response. git-svn-id: http://svn.miranda-ng.org/main/trunk@15345 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
index c271a83be2..56c86c6806 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
@@ -586,8 +586,10 @@ void WAConnection::parsePresense(ProtocolTreeNode *node) throw(WAException)
if (m_pEventHandler != NULL) {
const string &type = node->getAttributeValue("type");
- if (type == "unavailable")
- m_pEventHandler->onAvailable(from, false);
+ if (type == "unavailable") {
+ const string &lastSeen = node->getAttributeValue("last");
+ m_pEventHandler->onAvailable(from, false, (lastSeen == "deny") ? -2 : atoi(lastSeen.c_str()));
+ }
else if (type == "available" || type == "")
m_pEventHandler->onAvailable(from, true);
}
@@ -962,18 +964,6 @@ void WAConnection::sendPresenceSubscriptionRequest(const std::string &to) throw(
out.write(ProtocolTreeNode("presence") << XATTR("type", "subscribe") << XATTR("to", to));
}
-void WAConnection::sendQueryLastOnline(const std::string &jid) throw (WAException)
-{
- if (jid == "Server@s.whatsapp.net") // to avoid error 405
- return;
-
- std::string id = makeId("iq_");
- this->pending_server_requests[id] = new IqResultQueryLastOnlineHandler(this);
-
- out.write(ProtocolTreeNode("iq", new ProtocolTreeNode("query"))
- << XATTR("id", id) << XATTR("type", "get") << XATTR("to", jid) << XATTR("xmlns", "jabber:iq:last"));
-}
-
void WAConnection::sendSetPicture(const char *jid, std::vector<unsigned char>* data, std::vector<unsigned char>* preview) throw (WAException)
{
std::string id = this->makeId("set_photo_");