diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-06-22 18:53:42 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-06-22 19:14:55 (GMT) |
commit | 0bebf1a69870f75432517cfcb6d115996cf5be4f (patch) | |
tree | 0cc3ced0707990f02dc725fb01c1a4966455df89 /Swiften | |
parent | fcba2d245a3dde4c584f4ed04081512441eb383f (diff) | |
download | swift-contrib-0bebf1a69870f75432517cfcb6d115996cf5be4f.zip swift-contrib-0bebf1a69870f75432517cfcb6d115996cf5be4f.tar.bz2 |
Send avatar vCard-updates in presence.
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Avatars/AvatarManager.cpp | 6 | ||||
-rw-r--r-- | Swiften/Avatars/AvatarManager.h | 1 | ||||
-rw-r--r-- | Swiften/Elements/VCardUpdate.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/Swiften/Avatars/AvatarManager.cpp b/Swiften/Avatars/AvatarManager.cpp index c15d002..6a1efc6 100644 --- a/Swiften/Avatars/AvatarManager.cpp +++ b/Swiften/Avatars/AvatarManager.cpp @@ -49,6 +49,12 @@ void AvatarManager::handleVCardReceived(const JID& from, const String& promisedH setAvatarHash(from, realHash); } +void AvatarManager::setAvatar(const JID& jid, const ByteArray& avatar) { + String hash = SHA1::getHexHash(avatar); + avatarStorage_->addAvatar(hash, avatar); + setAvatarHash(getAvatarJID(jid), hash); +} + void AvatarManager::setAvatarHash(const JID& from, const String& hash) { avatarHashes_[from] = hash; onAvatarChanged(from, hash); diff --git a/Swiften/Avatars/AvatarManager.h b/Swiften/Avatars/AvatarManager.h index 13c6cb7..984ce19 100644 --- a/Swiften/Avatars/AvatarManager.h +++ b/Swiften/Avatars/AvatarManager.h @@ -23,6 +23,7 @@ namespace Swift { String getAvatarHash(const JID&) const; boost::filesystem::path getAvatarPath(const JID&) const; + void setAvatar(const JID&, const ByteArray& avatar); public: boost::signal<void (const JID&, const String&)> onAvatarChanged; diff --git a/Swiften/Elements/VCardUpdate.h b/Swiften/Elements/VCardUpdate.h index b6c8ebd..6bb79cc 100644 --- a/Swiften/Elements/VCardUpdate.h +++ b/Swiften/Elements/VCardUpdate.h @@ -6,7 +6,7 @@ namespace Swift { class VCardUpdate : public Payload { public: - VCardUpdate() {} + VCardUpdate(const String& photoHash = "") : photoHash_(photoHash) {} void setPhotoHash(const String& photoHash) { photoHash_ = photoHash; } const String& getPhotoHash() { return photoHash_; } |