diff options
Diffstat (limited to 'Swiften/VCards/VCardMemoryStorage.h')
-rw-r--r-- | Swiften/VCards/VCardMemoryStorage.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Swiften/VCards/VCardMemoryStorage.h b/Swiften/VCards/VCardMemoryStorage.h index ade9c89..f538fc1 100644 --- a/Swiften/VCards/VCardMemoryStorage.h +++ b/Swiften/VCards/VCardMemoryStorage.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -8,4 +8,5 @@ #include <boost/shared_ptr.hpp> + #include <map> @@ -16,5 +17,5 @@ namespace Swift { class VCardMemoryStorage : public VCardStorage { public: - VCardMemoryStorage() {} + VCardMemoryStorage(CryptoProvider* crypto) : VCardStorage(crypto) {} virtual VCard::ref getVCard(const JID& jid) const { @@ -28,11 +29,23 @@ namespace Swift { } + virtual boost::posix_time::ptime getVCardWriteTime(const JID& jid) const { + if (vcardWriteTimes.find(jid) == vcardWriteTimes.end()) { + return boost::posix_time::ptime(); + } + else { + return vcardWriteTimes.at(jid); + } + } + virtual void setVCard(const JID& jid, VCard::ref v) { vcards[jid] = v; + vcardWriteTimes[jid] = boost::posix_time::second_clock::universal_time(); } private: typedef std::map<JID, VCard::ref> VCardMap; + typedef std::map<JID, boost::posix_time::ptime> VCardWriteTimeMap; VCardMap vcards; + VCardWriteTimeMap vcardWriteTimes; }; } |