summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Presence/PresenceOracle.cpp')
m---------Swiften0
-rw-r--r--Swiften/Presence/PresenceOracle.cpp58
2 files changed, 0 insertions, 58 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Presence/PresenceOracle.cpp b/Swiften/Presence/PresenceOracle.cpp
deleted file mode 100644
index 988fc10..0000000
--- a/Swiften/Presence/PresenceOracle.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "PresenceOracle.h"
-
-#include <boost/bind.hpp>
-#include "Swiften/Client/StanzaChannel.h"
-namespace Swift {
-
-typedef std::pair<JID, std::map<JID, boost::shared_ptr<Presence> > > JIDMapPair;
-typedef std::pair<JID, boost::shared_ptr<Presence> > JIDPresencePair;
-
-PresenceOracle::PresenceOracle(StanzaChannel* stanzaChannel) {
- stanzaChannel_ = stanzaChannel;
- stanzaChannel_->onPresenceReceived.connect(boost::bind(&PresenceOracle::handleIncomingPresence, this, _1));
-}
-
-void PresenceOracle::cancelSubscription(const JID& jid) {
- boost::shared_ptr<Presence> stanza(new Presence());
- stanza->setType(Presence::Unsubscribed);
- stanza->setTo(jid);
- stanzaChannel_->sendPresence(stanza);
-}
-
-void PresenceOracle::confirmSubscription(const JID& jid) {
- boost::shared_ptr<Presence> stanza(new Presence());
- stanza->setType(Presence::Subscribed);
- stanza->setTo(jid);
- stanzaChannel_->sendPresence(stanza);
-}
-
-
-void PresenceOracle::requestSubscription(const JID& jid) {
- boost::shared_ptr<Presence> stanza(new Presence());
- stanza->setType(Presence::Subscribe);
- stanza->setTo(jid);
- stanzaChannel_->sendPresence(stanza);
-}
-
-
-void PresenceOracle::handleIncomingPresence(boost::shared_ptr<Presence> presence) {
- JID bareJID = JID(presence->getFrom().toBare());
-
- if (presence->getType() == Presence::Subscribe) {
- onPresenceSubscriptionRequest(bareJID, presence->getStatus());
- } else {
- std::map<JID, boost::shared_ptr<Presence> > jidMap = entries_[bareJID];
- boost::shared_ptr<Presence> last;
- foreach(JIDPresencePair pair, jidMap) {
- if (pair.first == presence->getFrom()) {
- last = pair.second;
- break;
- }
- }
- jidMap[presence->getFrom()] = presence;
- entries_[bareJID] = jidMap;
- onPresenceChange(presence, last);
- }
-}
-
-}