summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Avatars/AvatarMemoryStorage.h')
-rw-r--r--Swiften/Avatars/AvatarMemoryStorage.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/Swiften/Avatars/AvatarMemoryStorage.h b/Swiften/Avatars/AvatarMemoryStorage.h
index 3fa770a..095b144 100644
--- a/Swiften/Avatars/AvatarMemoryStorage.h
+++ b/Swiften/Avatars/AvatarMemoryStorage.h
@@ -7,10 +7,11 @@
#pragma once
#include <map>
-
#include <string>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Avatars/AvatarStorage.h"
+
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Avatars/AvatarStorage.h>
+#include <Swiften/JID/JID.h>
namespace Swift {
class AvatarMemoryStorage : public AvatarStorage {
@@ -26,7 +27,17 @@ namespace Swift {
return boost::filesystem::path("/avatars") / hash;
}
+ virtual void setAvatarForJID(const JID& jid, const std::string& hash) {
+ jidAvatars[jid] = hash;
+ }
+
+ virtual std::string getAvatarForJID(const JID& jid) const {
+ std::map<JID, std::string>::const_iterator i = jidAvatars.find(jid);
+ return i == jidAvatars.end() ? "" : i->second;
+ }
+
private:
std::map<std::string, ByteArray> avatars;
+ std::map<JID, std::string> jidAvatars;
};
}