summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-08-28 14:39:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-08-28 14:39:42 (GMT)
commiteba9a50f10082430c38b849b6af95f92f3de6ef8 (patch)
tree709d1912d8304893066518525101c1e93598d0d2 /Swiften/VCards
parentc6d782ee1c904330b82e3e1ce2b90baf49ead4de (diff)
downloadswift-contrib-eba9a50f10082430c38b849b6af95f92f3de6ef8.zip
swift-contrib-eba9a50f10082430c38b849b6af95f92f3de6ef8.tar.bz2
Keep VCard photo hash cache consistent.
Diffstat (limited to 'Swiften/VCards')
-rw-r--r--Swiften/VCards/VCardFileStorage.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Swiften/VCards/VCardFileStorage.cpp b/Swiften/VCards/VCardFileStorage.cpp
index cd5cc9c..476fde1 100644
--- a/Swiften/VCards/VCardFileStorage.cpp
+++ b/Swiften/VCards/VCardFileStorage.cpp
@@ -48,6 +48,7 @@ VCardFileStorage::VCardFileStorage(boost::filesystem::path dir) : vcardsPath(dir
}
boost::shared_ptr<VCard> VCardFileStorage::getVCard(const JID& jid) const {
+ boost::shared_ptr<VCard> result;
try {
boost::filesystem::path vcardPath(getVCardPath(jid));
if (boost::filesystem::exists(vcardPath)) {
@@ -57,16 +58,14 @@ boost::shared_ptr<VCard> VCardFileStorage::getVCard(const JID& jid) const {
VCardParser parser;
PayloadParserTester tester(&parser);
tester.parse(data.toString());
- return boost::dynamic_pointer_cast<VCard>(parser.getPayload());
- }
- else {
- return boost::shared_ptr<VCard>();
+ result = boost::dynamic_pointer_cast<VCard>(parser.getPayload());
}
}
catch (const boost::filesystem::filesystem_error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
- return boost::shared_ptr<VCard>();
}
+ getAndUpdatePhotoHash(jid, result);
+ return result;
}
void VCardFileStorage::setVCard(const JID& jid, VCard::ref v) {