aboutsummaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-21 15:04:49 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-21 15:04:49 +0200
commitc69757fe8d23001e5154febc29ec1bc05ad3cd59 (patch)
tree1b52df55f433c7eeac29c42a76ef0db8b8aae632 /src/base
parentd6694d3db35a553c8930bba083fcc3f5ed4ff124 (diff)
downloadqxmpp-c69757fe8d23001e5154febc29ec1bc05ad3cd59.tar.gz
add QXmppPresence::availableStatusType()
Diffstat (limited to 'src/base')
-rw-r--r--src/base/QXmppPresence.cpp17
-rw-r--r--src/base/QXmppPresence.h16
2 files changed, 32 insertions, 1 deletions
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<AvailableStatusType>(m_status.type());
+}
+
+/// Sets the availability status type, for instance busy or away.
+
+void QXmppPresence::setAvailableStatusType(AvailableStatusType type)
+{
+ m_status.setType(static_cast<QXmppPresence::Status::Type>(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)