diff options
Diffstat (limited to 'Swiften/Presence/PresenceOracle.cpp')
-rw-r--r-- | Swiften/Presence/PresenceOracle.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Swiften/Presence/PresenceOracle.cpp b/Swiften/Presence/PresenceOracle.cpp index af98510..f1e6adb 100644 --- a/Swiften/Presence/PresenceOracle.cpp +++ b/Swiften/Presence/PresenceOracle.cpp @@ -13,17 +13,23 @@ PresenceOracle::PresenceOracle(StanzaChannel* stanzaChannel) { void PresenceOracle::handleIncomingPresence(boost::shared_ptr<Presence> presence) { JID bareJID = JID(presence->getFrom().toBare()); - 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; + + if (presence->getType() == Presence::Subscribe) { + fprintf(stderr, "rarr, sub\n"); + 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); } - jidMap[presence->getFrom()] = presence; - entries_[bareJID] = jidMap; - onPresenceChange(presence, last); } } |