00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <map>
00010
00011 #include <string>
00012 #include <Swiften/Elements/Presence.h>
00013
00014 #include <Swiften/Base/API.h>
00015 #include <Swiften/Base/boost_bsignals.h>
00016
00017 namespace Swift {
00018 class StanzaChannel;
00019
00020 class SWIFTEN_API PresenceOracle {
00021 public:
00022 PresenceOracle(StanzaChannel* stanzaChannel);
00023 ~PresenceOracle();
00024
00025 Presence::ref getLastPresence(const JID&) const;
00026 Presence::ref getHighestPriorityPresence(const JID& bareJID) const;
00027 std::vector<Presence::ref> getAllPresence(const JID& bareJID) const;
00028
00029 public:
00030 boost::signal<void (Presence::ref)> onPresenceChange;
00031
00032 private:
00033 void handleIncomingPresence(Presence::ref presence);
00034 void handleStanzaChannelAvailableChanged(bool);
00035
00036 private:
00037 typedef std::map<JID, Presence::ref> PresenceMap;
00038 typedef std::map<JID, PresenceMap> PresencesMap;
00039 PresencesMap entries_;
00040 StanzaChannel* stanzaChannel_;
00041 };
00042 }
00043