diff options
Diffstat (limited to 'Swiften/Avatars')
-rw-r--r-- | Swiften/Avatars/AvatarManager.cpp | 6 | ||||
-rw-r--r-- | Swiften/Avatars/AvatarManager.h | 1 |
2 files changed, 7 insertions, 0 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; |