diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-24 07:26:43 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-24 17:10:23 (GMT) |
commit | 042c12c31cda77b3d57ed41d5c121a2b4383e69a (patch) | |
tree | 4e6bbe2aaddfbae52aacf024917dbbf9f6861dfe /Swiften/Avatars/VCardUpdateAvatarManager.h | |
parent | b6a34463dfcedd454ab42230a47cdb7294a76f21 (diff) | |
download | swift-contrib-042c12c31cda77b3d57ed41d5c121a2b4383e69a.zip swift-contrib-042c12c31cda77b3d57ed41d5c121a2b4383e69a.tar.bz2 |
Split out VCardUpdateAvatarManager from AvatarManager.
Diffstat (limited to 'Swiften/Avatars/VCardUpdateAvatarManager.h')
-rw-r--r-- | Swiften/Avatars/VCardUpdateAvatarManager.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h new file mode 100644 index 0000000..b7ef34b --- /dev/null +++ b/Swiften/Avatars/VCardUpdateAvatarManager.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/filesystem.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> +#include <map> + +#include "Swiften/Base/boost_bsignals.h" +#include "Swiften/JID/JID.h" +#include "Swiften/Elements/Presence.h" +#include "Swiften/Elements/VCard.h" +#include "Swiften/Elements/ErrorPayload.h" + +namespace Swift { + class MUCRegistry; + class AvatarStorage; + class StanzaChannel; + class VCardManager; + + class VCardUpdateAvatarManager { + public: + VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, MUCRegistry* = NULL); + virtual ~VCardUpdateAvatarManager(); + + virtual void setMUCRegistry(MUCRegistry*); + + virtual boost::filesystem::path getAvatarPath(const JID&) const; + + public: + boost::signal<void (const JID&, const String& /*hash*/)> onAvatarChanged; + + private: + void handlePresenceReceived(boost::shared_ptr<Presence>); + void handleVCardChanged(const JID& from, VCard::ref); + void setAvatarHash(const JID& from, const String& hash); + JID getAvatarJID(const JID& o) const; + String getAvatarHash(const JID&) const; + + private: + VCardManager* vcardManager_; + StanzaChannel* stanzaChannel_; + AvatarStorage* avatarStorage_; + MUCRegistry* mucRegistry_; + std::map<JID, String> avatarHashes_; + }; +} |