summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-12 18:29:39 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-13 19:19:52 (GMT)
commitef1052bbdb315aaa1c6254098ea05638d9a25b2f (patch)
tree482277f649f6c0fc00027514ea8986861fe33437 /Swiften/Presence/PresenceOracle.h
parent3ae8cccfe9c6bfed5dda5f024a5cb046ccfc9793 (diff)
downloadswift-ef1052bbdb315aaa1c6254098ea05638d9a25b2f.zip
swift-ef1052bbdb315aaa1c6254098ea05638d9a25b2f.tar.bz2
Added presence notifier.
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_;
+ };
}