diff options
Diffstat (limited to 'Swiften/Presence')
-rw-r--r-- | Swiften/Presence/PresenceOracle.cpp | 15 | ||||
-rw-r--r-- | Swiften/Presence/PresenceOracle.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Swiften/Presence/PresenceOracle.cpp b/Swiften/Presence/PresenceOracle.cpp index 387ad42..90e403c 100644 --- a/Swiften/Presence/PresenceOracle.cpp +++ b/Swiften/Presence/PresenceOracle.cpp @@ -76,6 +76,21 @@ Presence::ref PresenceOracle::getLastPresence(const JID& jid) const { } } +std::vector<Presence::ref> PresenceOracle::getAllPresence(const JID& bareJID) const { + std::vector<Presence::ref> results; + PresencesMap::const_iterator i = entries_.find(bareJID); + if (i == entries_.end()) { + return results; + } + PresenceMap presenceMap = i->second; + PresenceMap::const_iterator j = presenceMap.begin(); + for (; j != presenceMap.end(); j++) { + Presence::ref current = j->second; + results.push_back(current); + } + return results; +} + Presence::ref PresenceOracle::getHighestPriorityPresence(const JID& bareJID) const { PresencesMap::const_iterator i = entries_.find(bareJID); if (i == entries_.end()) { diff --git a/Swiften/Presence/PresenceOracle.h b/Swiften/Presence/PresenceOracle.h index e846984..4e16e41 100644 --- a/Swiften/Presence/PresenceOracle.h +++ b/Swiften/Presence/PresenceOracle.h @@ -22,6 +22,7 @@ class StanzaChannel; Presence::ref getLastPresence(const JID&) const; Presence::ref getHighestPriorityPresence(const JID& bareJID) const; + std::vector<Presence::ref> getAllPresence(const JID& bareJID) const; public: boost::signal<void (Presence::ref)> onPresenceChange; |