aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/presence.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-08-03 17:29:52 +0900
committerGitHub <noreply@github.com>2019-08-03 17:29:52 +0900
commit66e116b7b1e848e80577a0229c8995db0a54932e (patch)
tree763340439a0f4034e9c829d76cb1ffe9766b83c5 /lib/csapi/presence.cpp
parent5b236dfe895c7766002559570aa29c9033009228 (diff)
parentc05ade838f0fce81f2bbe80a3295618a8a26ff52 (diff)
downloadlibquotient-66e116b7b1e848e80577a0229c8995db0a54932e.tar.gz
libquotient-66e116b7b1e848e80577a0229c8995db0a54932e.zip
Merge pull request #295 from marcdeop/140_impose_coding_standard
140 impose coding standard
Diffstat (limited to 'lib/csapi/presence.cpp')
-rw-r--r--lib/csapi/presence.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/csapi/presence.cpp b/lib/csapi/presence.cpp
index 210ee0ae..b6e8caf2 100644
--- a/lib/csapi/presence.cpp
+++ b/lib/csapi/presence.cpp
@@ -14,9 +14,10 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0");
static const auto SetPresenceJobName = QStringLiteral("SetPresenceJob");
-SetPresenceJob::SetPresenceJob(const QString& userId, const QString& presence, const QString& statusMsg)
+SetPresenceJob::SetPresenceJob(const QString& userId, const QString& presence,
+ const QString& statusMsg)
: BaseJob(HttpVerb::Put, SetPresenceJobName,
- basePath % "/presence/" % userId % "/status")
+ basePath % "/presence/" % userId % "/status")
{
QJsonObject _data;
addParam<>(_data, QStringLiteral("presence"), presence);
@@ -26,44 +27,37 @@ SetPresenceJob::SetPresenceJob(const QString& userId, const QString& presence, c
class GetPresenceJob::Private
{
- public:
- QString presence;
- Omittable<int> lastActiveAgo;
- QString statusMsg;
- Omittable<bool> currentlyActive;
+public:
+ QString presence;
+ Omittable<int> lastActiveAgo;
+ QString statusMsg;
+ Omittable<bool> currentlyActive;
};
QUrl GetPresenceJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/presence/" % userId % "/status");
+ basePath % "/presence/" % userId % "/status");
}
static const auto GetPresenceJobName = QStringLiteral("GetPresenceJob");
GetPresenceJob::GetPresenceJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetPresenceJobName,
- basePath % "/presence/" % userId % "/status")
+ basePath % "/presence/" % userId % "/status")
, d(new Private)
-{
-}
+{}
GetPresenceJob::~GetPresenceJob() = default;
-const QString& GetPresenceJob::presence() const
-{
- return d->presence;
-}
+const QString& GetPresenceJob::presence() const { return d->presence; }
Omittable<int> GetPresenceJob::lastActiveAgo() const
{
return d->lastActiveAgo;
}
-const QString& GetPresenceJob::statusMsg() const
-{
- return d->statusMsg;
-}
+const QString& GetPresenceJob::statusMsg() const { return d->statusMsg; }
Omittable<bool> GetPresenceJob::currentlyActive() const
{
@@ -75,11 +69,11 @@ BaseJob::Status GetPresenceJob::parseJson(const QJsonDocument& data)
auto json = data.object();
if (!json.contains("presence"_ls))
return { IncorrectResponse,
- "The key 'presence' not found in the response" };
+ "The key 'presence' not found in the response" };
fromJson(json.value("presence"_ls), d->presence);
fromJson(json.value("last_active_ago"_ls), d->lastActiveAgo);
fromJson(json.value("status_msg"_ls), d->statusMsg);
fromJson(json.value("currently_active"_ls), d->currentlyActive);
+
return Success;
}
-