aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/profile.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-06-24 07:21:13 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-06-24 07:21:13 +0900
commit63ae79c3e2820efc2ba60d33e2caf2d7b9b3c408 (patch)
tree2552f5049a6ef7ba0034483b25ca4ab33d1fcb13 /lib/csapi/profile.cpp
parente083d327e6f6581210f8d077d8bbe1151e81e82c (diff)
parent93f0c8fe89f448d1d58caa757573f17102369471 (diff)
downloadlibquotient-63ae79c3e2820efc2ba60d33e2caf2d7b9b3c408.tar.gz
libquotient-63ae79c3e2820efc2ba60d33e2caf2d7b9b3c408.zip
Merge branch 'master' into clang-format
# Conflicts: # CMakeLists.txt # lib/avatar.cpp # lib/connection.cpp # lib/connection.h # lib/connectiondata.cpp # lib/csapi/account-data.cpp # lib/csapi/account-data.h # lib/csapi/capabilities.cpp # lib/csapi/capabilities.h # lib/csapi/content-repo.cpp # lib/csapi/create_room.cpp # lib/csapi/filter.cpp # lib/csapi/joining.cpp # lib/csapi/keys.cpp # lib/csapi/list_joined_rooms.cpp # lib/csapi/notifications.cpp # lib/csapi/openid.cpp # lib/csapi/presence.cpp # lib/csapi/pushrules.cpp # lib/csapi/registration.cpp # lib/csapi/room_upgrades.cpp # lib/csapi/room_upgrades.h # lib/csapi/search.cpp # lib/csapi/users.cpp # lib/csapi/versions.cpp # lib/csapi/whoami.cpp # lib/csapi/{{base}}.cpp.mustache # lib/events/accountdataevents.h # lib/events/eventcontent.h # lib/events/roommemberevent.cpp # lib/events/stateevent.cpp # lib/jobs/basejob.cpp # lib/jobs/basejob.h # lib/networkaccessmanager.cpp # lib/networksettings.cpp # lib/room.cpp # lib/room.h # lib/settings.cpp # lib/settings.h # lib/syncdata.cpp # lib/user.cpp # lib/user.h # lib/util.cpp
Diffstat (limited to 'lib/csapi/profile.cpp')
-rw-r--r--lib/csapi/profile.cpp43
1 files changed, 20 insertions, 23 deletions
diff --git a/lib/csapi/profile.cpp b/lib/csapi/profile.cpp
index fefc18f2..630452f6 100644
--- a/lib/csapi/profile.cpp
+++ b/lib/csapi/profile.cpp
@@ -26,25 +26,23 @@ SetDisplayNameJob::SetDisplayNameJob(const QString& userId,
class GetDisplayNameJob::Private
{
- public:
+public:
QString displayname;
};
QUrl GetDisplayNameJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
- return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/profile/" % userId
- % "/displayname");
+ return BaseJob::makeRequestUrl(
+ std::move(baseUrl), basePath % "/profile/" % userId % "/displayname");
}
static const auto GetDisplayNameJobName = QStringLiteral("GetDisplayNameJob");
GetDisplayNameJob::GetDisplayNameJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetDisplayNameJobName,
- basePath % "/profile/" % userId % "/displayname", false),
- d(new Private)
-{
-}
+ basePath % "/profile/" % userId % "/displayname", false)
+ , d(new Private)
+{}
GetDisplayNameJob::~GetDisplayNameJob() = default;
@@ -54,13 +52,13 @@ BaseJob::Status GetDisplayNameJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("displayname"_ls), d->displayname);
+
return Success;
}
static const auto SetAvatarUrlJobName = QStringLiteral("SetAvatarUrlJob");
-SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId,
- const QString& avatarUrl)
+SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId, const QString& avatarUrl)
: BaseJob(HttpVerb::Put, SetAvatarUrlJobName,
basePath % "/profile/" % userId % "/avatar_url")
{
@@ -71,25 +69,23 @@ SetAvatarUrlJob::SetAvatarUrlJob(const QString& userId,
class GetAvatarUrlJob::Private
{
- public:
+public:
QString avatarUrl;
};
QUrl GetAvatarUrlJob::makeRequestUrl(QUrl baseUrl, const QString& userId)
{
- return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/profile/" % userId
- % "/avatar_url");
+ return BaseJob::makeRequestUrl(
+ std::move(baseUrl), basePath % "/profile/" % userId % "/avatar_url");
}
static const auto GetAvatarUrlJobName = QStringLiteral("GetAvatarUrlJob");
GetAvatarUrlJob::GetAvatarUrlJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetAvatarUrlJobName,
- basePath % "/profile/" % userId % "/avatar_url", false),
- d(new Private)
-{
-}
+ basePath % "/profile/" % userId % "/avatar_url", false)
+ , d(new Private)
+{}
GetAvatarUrlJob::~GetAvatarUrlJob() = default;
@@ -99,12 +95,13 @@ BaseJob::Status GetAvatarUrlJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("avatar_url"_ls), d->avatarUrl);
+
return Success;
}
class GetUserProfileJob::Private
{
- public:
+public:
QString avatarUrl;
QString displayname;
};
@@ -119,10 +116,9 @@ static const auto GetUserProfileJobName = QStringLiteral("GetUserProfileJob");
GetUserProfileJob::GetUserProfileJob(const QString& userId)
: BaseJob(HttpVerb::Get, GetUserProfileJobName,
- basePath % "/profile/" % userId, false),
- d(new Private)
-{
-}
+ basePath % "/profile/" % userId, false)
+ , d(new Private)
+{}
GetUserProfileJob::~GetUserProfileJob() = default;
@@ -135,5 +131,6 @@ BaseJob::Status GetUserProfileJob::parseJson(const QJsonDocument& data)
auto json = data.object();
fromJson(json.value("avatar_url"_ls), d->avatarUrl);
fromJson(json.value("displayname"_ls), d->displayname);
+
return Success;
}