summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/VCards/VCardStorage.cpp')
-rw-r--r--Swiften/VCards/VCardStorage.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Swiften/VCards/VCardStorage.cpp b/Swiften/VCards/VCardStorage.cpp
index cacd083..b14ee60 100644
--- a/Swiften/VCards/VCardStorage.cpp
+++ b/Swiften/VCards/VCardStorage.cpp
@@ -6,9 +6,22 @@
#include "Swiften/VCards/VCardStorage.h"
+#include <Swiften/StringCodecs/Hexify.h>
+#include <Swiften/StringCodecs/SHA1.h>
+
namespace Swift {
VCardStorage::~VCardStorage() {
}
+std::string VCardStorage::getPhotoHash(const JID& jid) const {
+ VCard::ref vCard = getVCard(jid);
+ if (vCard && !vCard->getPhoto().isEmpty()) {
+ return Hexify::hexify(SHA1::getHash(vCard->getPhoto()));
+ }
+ else {
+ return "";
+ }
+}
+
}