diff options
author | George Hazan <george.hazan@gmail.com> | 2015-01-30 23:30:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-01-30 23:30:48 +0000 |
commit | 7df19254e64619d6b077a7c69b456a39d4a810cb (patch) | |
tree | de24992b72ade3da4e12f428279f03ae19282cc6 /protocols/WhatsApp/src/WhatsAPI++ | |
parent | 2b5452c11f786d502a3f463cdd5a3483fa21c79d (diff) |
- 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
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++')
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 12 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.h | 2 |
2 files changed, 9 insertions, 5 deletions
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<unsigned char>* data) throw (WAException)
+void WAConnection::sendSetPicture(const std::string &jid, std::vector<unsigned char>* data, std::vector<unsigned char>* 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<ProtocolTreeNode*>* messageChildren = new std::vector<ProtocolTreeNode*>();
+ 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<unsigned char>* data) throw (WAException);
+ void sendSetPicture(const std::string& jid, std::vector<unsigned char>* data, std::vector<unsigned char>* preview) throw (WAException);
void sendNotificationReceived(const std::string& from, const std::string& id) throw(WAException);
void sendDeleteAccount() throw(WAException);
};
|