diff options
Diffstat (limited to 'Swiften/Presence/PresenceOracle.h')
-rw-r--r-- | Swiften/Presence/PresenceOracle.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Swiften/Presence/PresenceOracle.h b/Swiften/Presence/PresenceOracle.h index f312506..a010e8e 100644 --- a/Swiften/Presence/PresenceOracle.h +++ b/Swiften/Presence/PresenceOracle.h @@ -17,6 +17,11 @@ namespace Swift { class StanzaChannel; class XMPPRoster; + /** + * The PresenceOracle class observes all received presence stanzas for + * the \ref StanzaChannel class passed in the constructor and maintains a + * cache. + */ class SWIFTEN_API PresenceOracle { public: PresenceOracle(StanzaChannel* stanzaChannel, XMPPRoster* roster); @@ -26,6 +31,34 @@ namespace Swift { Presence::ref getHighestPriorityPresence(const JID& bareJID) const; std::vector<Presence::ref> getAllPresence(const JID& bareJID) const; + /** + * \brief Returns the relevant presence for a list of resource presences. + * + * It only takes the presence show type into account. Priorities are + * ignored as various clients set them to arbitrary values unrelated + * to actual end point availability. + * + * The presences of the resources are group by availablilty and sorted + * by show type in the following order: + * + * -# Online + * -# Free for Chat + * -# Available + * -# Away + * -# DND + * -# Extended Away + * -# Away + * -# Offline + * -# Unavailable + */ + static Presence::ref getActivePresence(const std::vector<Presence::ref> presences); + + /** + * \brief This considers all online resources of a bare JID and returns + * the value returned by \ref getActivePresence when passing this list. + */ + Presence::ref getAccountPresence(const JID& jid) const; + public: boost::signal<void (Presence::ref)> onPresenceChange; |