diff options
Diffstat (limited to 'Swiften/VCards/VCardFileStorage.cpp')
-rw-r--r-- | Swiften/VCards/VCardFileStorage.cpp | 9 |
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 @@ -42,37 +42,36 @@ VCardFileStorage::VCardFileStorage(boost::filesystem::path dir) : vcardsPath(dir } } catch (...) { std::cerr << "Error reading phashes file" << std::endl; } } } 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)) { ByteArray data; data.readFromFile(vcardPath.string()); 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) { try { boost::filesystem::path vcardPath(getVCardPath(jid)); if (!boost::filesystem::exists(vcardPath.parent_path())) { boost::filesystem::create_directories(vcardPath.parent_path()); } boost::filesystem::ofstream file(getVCardPath(jid)); |