From 7df19254e64619d6b077a7c69b456a39d4a810cb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 30 Jan 2015 23:30:48 +0000 Subject: - avatar support functions moved to the separate module; - added support for setting our own avatar git-svn-id: http://svn.miranda-ng.org/main/trunk@11963 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 12 ++++++++---- protocols/WhatsApp/src/WhatsAPI++/WAConnection.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++') diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp index 34b0f2a899..c08066426e 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp @@ -835,14 +835,18 @@ void WAConnection::sendQueryLastOnline(const std::string &jid) throw (WAExceptio << XATTR("id", id) << XATTR("type", "get") << XATTR("to", jid)); } -void WAConnection::sendSetPicture(const std::string &jid, std::vector* data) throw (WAException) +void WAConnection::sendSetPicture(const std::string &jid, std::vector* data, std::vector* preview) throw (WAException) { std::string id = this->makeId("set_photo_"); this->pending_server_requests[id] = new IqResultSetPhotoHandler(this, jid); - ProtocolTreeNode *listNode = new ProtocolTreeNode("picture", data, NULL) << XATTR("xmlns", "w:profile:picture"); - out.write(ProtocolTreeNode("iq", listNode) - << XATTR("id", id) << XATTR("type", "set") << XATTR("to", jid)); + std::vector* messageChildren = new std::vector(); + if (preview) + messageChildren->push_back(new ProtocolTreeNode("picture", preview, NULL) << XATTR("type", "preview")); + if (data) + messageChildren->push_back(new ProtocolTreeNode("picture", data, NULL) << XATTR("type", "image")); + out.write(ProtocolTreeNode("iq", NULL, messageChildren) + << XATTR("id", id) << XATTR("type", "set") << XATTR("to", jid) << XATTR("xmlns", "w:profile:picture")); } void WAConnection::sendStatusUpdate(std::string& status) throw (WAException) diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h index 6ed955caa7..6f4fb2b4f2 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h @@ -412,7 +412,7 @@ public: void sendSetNewSubject(const std::string& gjid, const std::string& subject) throw (WAException); void sendStatusUpdate(std::string& status) throw (WAException); void sendGetPicture(const std::string& jid, const std::string& type) throw (WAException); - void sendSetPicture(const std::string& jid, std::vector* data) throw (WAException); + void sendSetPicture(const std::string& jid, std::vector* data, std::vector* preview) throw (WAException); void sendNotificationReceived(const std::string& from, const std::string& id) throw(WAException); void sendDeleteAccount() throw(WAException); }; -- cgit v1.2.3