summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Avatars/OfflineAvatarManager.cpp')
-rw-r--r--Swiften/Avatars/OfflineAvatarManager.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Swiften/Avatars/OfflineAvatarManager.cpp b/Swiften/Avatars/OfflineAvatarManager.cpp
new file mode 100644
index 0000000..02c6a35
--- /dev/null
+++ b/Swiften/Avatars/OfflineAvatarManager.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Avatars/OfflineAvatarManager.h>
+
+#include <boost/bind.hpp>
+
+#include <Swiften/Avatars/AvatarStorage.h>
+
+namespace Swift {
+
+OfflineAvatarManager::OfflineAvatarManager(AvatarStorage* avatarStorage) : avatarStorage(avatarStorage) {
+}
+
+OfflineAvatarManager::~OfflineAvatarManager() {
+}
+
+std::string OfflineAvatarManager::getAvatarHash(const JID& jid) const {
+ return avatarStorage->getAvatarForJID(jid);
+}
+
+void OfflineAvatarManager::setAvatar(const JID& jid, const std::string& hash) {
+ if (getAvatarHash(jid) != hash) {
+ avatarStorage->setAvatarForJID(jid, hash);
+ onAvatarChanged(jid);
+ }
+}
+
+}