diff options
Diffstat (limited to 'Swiften/Presence/PresenceOracle.cpp')
-rw-r--r-- | Swiften/Presence/PresenceOracle.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Swiften/Presence/PresenceOracle.cpp b/Swiften/Presence/PresenceOracle.cpp index d7239df..988fc10 100644 --- a/Swiften/Presence/PresenceOracle.cpp +++ b/Swiften/Presence/PresenceOracle.cpp @@ -8,9 +8,33 @@ 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->onPresenceReceived.connect(boost::bind(&PresenceOracle::handleIncomingPresence, this, _1)); + 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()); |