aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/presence.h
diff options
context:
space:
mode:
authorBlack Hat <bhat@encom.eu.org>2019-09-26 22:22:36 -0700
committerBlack Hat <bhat@encom.eu.org>2019-09-26 22:22:36 -0700
commit363cf452bcdbaf6ff1cf94a83ca66cbb31122346 (patch)
treec64c8fda885e4e1785130e8ee3e7c47fd18cbf67 /lib/csapi/presence.h
parent412e2cf19449e73aa7da729e9c5de6502687aade (diff)
parent944653463fe4134c82d85e2d01e2bc0fa43fd727 (diff)
downloadlibquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.tar.gz
libquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.zip
Merge branch 'master' of https://github.com/quotient-im/libQuotient into
bhat-libqtolm-update
Diffstat (limited to 'lib/csapi/presence.h')
-rw-r--r--lib/csapi/presence.h121
1 files changed, 63 insertions, 58 deletions
diff --git a/lib/csapi/presence.h b/lib/csapi/presence.h
index 5e132d24..c5ecb987 100644
--- a/lib/csapi/presence.h
+++ b/lib/csapi/presence.h
@@ -4,73 +4,78 @@
#pragma once
+#include "converters.h"
+
#include "jobs/basejob.h"
-#include "converters.h"
+namespace Quotient
+{
-namespace QMatrixClient
+// Operations
+
+/// Update this user's presence state.
+/*!
+ * This API sets the given user's presence state. When setting the status,
+ * the activity time is updated to reflect that activity; the client does
+ * not need to specify the ``last_active_ago`` field. You cannot set the
+ * presence state of another user.
+ */
+class SetPresenceJob : public BaseJob
{
- // Operations
+public:
+ /*! Update this user's presence state.
+ * \param userId
+ * The user whose presence state to update.
+ * \param presence
+ * The new presence state.
+ * \param statusMsg
+ * The status message to attach to this state.
+ */
+ explicit SetPresenceJob(const QString& userId, const QString& presence,
+ const QString& statusMsg = {});
+};
- /// Update this user's presence state.
- ///
- /// This API sets the given user's presence state. When setting the status,
- /// the activity time is updated to reflect that activity; the client does
- /// not need to specify the ``last_active_ago`` field. You cannot set the
- /// presence state of another user.
- class SetPresenceJob : public BaseJob
- {
- public:
- /*! Update this user's presence state.
- * \param userId
- * The user whose presence state to update.
- * \param presence
- * The new presence state.
- * \param statusMsg
- * The status message to attach to this state.
- */
- explicit SetPresenceJob(const QString& userId, const QString& presence, const QString& statusMsg = {});
- };
+/// Get this user's presence state.
+/*!
+ * Get the given user's presence state.
+ */
+class GetPresenceJob : public BaseJob
+{
+public:
+ /*! Get this user's presence state.
+ * \param userId
+ * The user whose presence state to get.
+ */
+ explicit GetPresenceJob(const QString& userId);
- /// Get this user's presence state.
- ///
- /// Get the given user's presence state.
- class GetPresenceJob : public BaseJob
- {
- public:
- /*! Get this user's presence state.
- * \param userId
- * The user whose presence state to get.
- */
- explicit GetPresenceJob(const QString& userId);
+ /*! Construct a URL without creating a full-fledged job object
+ *
+ * This function can be used when a URL for
+ * GetPresenceJob is necessary but the job
+ * itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
- /*! Construct a URL without creating a full-fledged job object
- *
- * This function can be used when a URL for
- * GetPresenceJob is necessary but the job
- * itself isn't.
- */
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId);
+ ~GetPresenceJob() override;
- ~GetPresenceJob() override;
+ // Result properties
- // Result properties
+ /// This user's presence.
+ const QString& presence() const;
+ /// The length of time in milliseconds since an action was performed
+ /// by this user.
+ Omittable<int> lastActiveAgo() const;
+ /// The state message for this user if one was set.
+ const QString& statusMsg() const;
+ /// Whether the user is currently active
+ Omittable<bool> currentlyActive() const;
- /// This user's presence.
- const QString& presence() const;
- /// The length of time in milliseconds since an action was performed
- /// by this user.
- Omittable<int> lastActiveAgo() const;
- /// The state message for this user if one was set.
- const QString& statusMsg() const;
- /// Whether the user is currently active
- Omittable<bool> currentlyActive() const;
+protected:
+ Status parseJson(const QJsonDocument& data) override;
- protected:
- Status parseJson(const QJsonDocument& data) override;
+private:
+ class Private;
+ QScopedPointer<Private> d;
+};
- private:
- class Private;
- QScopedPointer<Private> d;
- };
-} // namespace QMatrixClient
+} // namespace Quotient