From c69757fe8d23001e5154febc29ec1bc05ad3cd59 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Sat, 21 Jul 2012 15:04:49 +0200 Subject: add QXmppPresence::availableStatusType() --- src/base/QXmppPresence.cpp | 17 +++++++++++++++++ src/base/QXmppPresence.h | 16 +++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'src/base') diff --git a/src/base/QXmppPresence.cpp b/src/base/QXmppPresence.cpp index 780ec532..aaeb0395 100644 --- a/src/base/QXmppPresence.cpp +++ b/src/base/QXmppPresence.cpp @@ -51,6 +51,23 @@ QXmppPresence::~QXmppPresence() } +/// Returns the availability status type, for instance busy or away. +/// +/// This will not tell you whether a contact is connected, check whether +/// type() is QXmppPresence::Available instead. + +QXmppPresence::AvailableStatusType QXmppPresence::availableStatusType() const +{ + return static_cast(m_status.type()); +} + +/// Sets the availability status type, for instance busy or away. + +void QXmppPresence::setAvailableStatusType(AvailableStatusType type) +{ + m_status.setType(static_cast(m_status.type())); +} + /// Returns the priority level of the resource. int QXmppPresence::priority() const diff --git a/src/base/QXmppPresence.h b/src/base/QXmppPresence.h index e327a75b..be80ceb0 100644 --- a/src/base/QXmppPresence.h +++ b/src/base/QXmppPresence.h @@ -47,6 +47,17 @@ public: Probe ///< A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user. }; + /// This enum is used to describe an availability status. + enum AvailableStatusType + { + Online = 0, ///< The entity or resource is online. + Away, ///< The entity or resource is temporarily away. + XA, ///< The entity or resource is away for an extended period. + DND, ///< The entity or resource is busy ("Do Not Disturb"). + Chat, ///< The entity or resource is actively interested in chatting. + Invisible ///< obsolete XEP-0018: Invisible Presence + }; + /// This enum is used to describe vCard updates as defined by /// XEP-0153: vCard-Based Avatars enum VCardUpdateType @@ -109,6 +120,9 @@ public: const QXmppPresence::Status& status = QXmppPresence::Status()); ~QXmppPresence(); + AvailableStatusType availableStatusType() const; + void setAvailableStatusType(AvailableStatusType type); + int priority() const; void setPriority(int priority); @@ -157,10 +171,10 @@ private: QString getTypeStr() const; void setTypeFromStr(const QString&); + AvailableStatusType m_availableStatusType; Type m_type; QXmppPresence::Status m_status; - /// XEP-0153: vCard-Based Avatars /// m_photoHash: the SHA1 hash of the avatar image data itself (not the base64-encoded version) -- cgit v1.2.3