libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
presence.h
Go to the documentation of this file.
1// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2
3#pragma once
4
5#include <Quotient/jobs/basejob.h>
6
7namespace Quotient {
8
9//! \brief Update this user's presence state.
10//!
11//! This API sets the given user's presence state. When setting the status,
12//! the activity time is updated to reflect that activity; the client does
13//! not need to specify the `last_active_ago` field. You cannot set the
14//! presence state of another user.
16public:
17 //! \param userId
18 //! The user whose presence state to update.
19 //!
20 //! \param presence
21 //! The new presence state.
22 //!
23 //! \param statusMsg
24 //! The status message to attach to this state.
25 explicit SetPresenceJob(const QString& userId, const QString& presence,
26 const QString& statusMsg = {});
27};
28
29//! \brief Get this user's presence state.
30//!
31//! Get the given user's presence state.
33public:
34 //! \param userId
35 //! The user whose presence state to get.
36 explicit GetPresenceJob(const QString& userId);
37
38 //! \brief Construct a URL without creating a full-fledged job object
39 //!
40 //! This function can be used when a URL for GetPresenceJob
41 //! is necessary but the job itself isn't.
43
44 // Result properties
45
46 //! This user's presence.
47 QString presence() const { return loadFromJson<QString>("presence"_L1); }
48
49 //! The length of time in milliseconds since an action was performed
50 //! by this user.
52 {
53 return loadFromJson<std::optional<int>>("last_active_ago"_L1);
54 }
55
56 //! The state message for this user if one was set.
57 QString statusMsg() const { return loadFromJson<QString>("status_msg"_L1); }
58
59 //! Whether the user is currently active
61 {
62 return loadFromJson<std::optional<bool>>("currently_active"_L1);
63 }
64
65 struct Response {
66 //! This user's presence.
68
69 //! The length of time in milliseconds since an action was performed
70 //! by this user.
72
73 //! The state message for this user if one was set.
75
76 //! Whether the user is currently active
78 };
79};
80
82constexpr inline auto doCollectResponse<JobT> = [](JobT* j) -> GetPresenceJob::Response {
83 return { j->presence(), j->lastActiveAgo(), j->statusMsg(), j->currentlyActive() };
84};
85
86} // namespace Quotient
Get this user's presence state.
Definition presence.h:32
Update this user's presence state.
Definition presence.h:15
#define QUOTIENT_API