summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Presence/PresenceOracle.h')
-rw-r--r--Swiften/Presence/PresenceOracle.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/Swiften/Presence/PresenceOracle.h b/Swiften/Presence/PresenceOracle.h
index 9f64000..e5f0372 100644
--- a/Swiften/Presence/PresenceOracle.h
+++ b/Swiften/Presence/PresenceOracle.h
@@ -6,31 +6,35 @@
#pragma once
+#include <map>
+
#include "Swiften/Base/String.h"
#include "Swiften/Elements/Presence.h"
-#include <map>
#include "Swiften/Base/boost_bsignals.h"
namespace Swift {
class StanzaChannel;
-
-class PresenceOracle {
- public:
- PresenceOracle(StanzaChannel* stanzaChannel);
- ~PresenceOracle() {};
-
- void cancelSubscription(const JID& jid);
- void confirmSubscription(const JID& jid);
- void requestSubscription(const JID& jid);
-
- boost::signal<void (boost::shared_ptr<Presence>, boost::shared_ptr<Presence>)> onPresenceChange;
- boost::signal<void (const JID&, const String&)> onPresenceSubscriptionRequest;
-
- private:
- void handleIncomingPresence(boost::shared_ptr<Presence> presence);
- std::map<JID, std::map<JID, boost::shared_ptr<Presence> > > entries_;
- StanzaChannel* stanzaChannel_;
-};
+ class PresenceOracle {
+ public:
+ PresenceOracle(StanzaChannel* stanzaChannel);
+ ~PresenceOracle();
+
+ Presence::ref getLastPresence(const JID&) const;
+
+ public:
+ boost::signal<void (boost::shared_ptr<Presence>)> onPresenceChange;
+ boost::signal<void (const JID&, const String&)> onPresenceSubscriptionRequest;
+
+ private:
+ void handleIncomingPresence(boost::shared_ptr<Presence> presence);
+ void handleStanzaChannelAvailableChanged(bool);
+
+ private:
+ typedef std::map<JID, Presence::ref> PresenceMap;
+ typedef std::map<JID, PresenceMap> PresencesMap;
+ PresencesMap entries_;
+ StanzaChannel* stanzaChannel_;
+ };
}