aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/wellknown.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-11 21:07:21 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-11 21:07:21 +0900
commit63e2c0338e07cbc1939a5ad0f8047a9edab9b97c (patch)
treeb34779450d848ad431f1c82f50df77c38e37b56a /lib/csapi/wellknown.cpp
parente98ec84ab31b2dc656597ac5c87a8299b6c8aed8 (diff)
parent7337876aac42552da6d926b38d7466cf2e51b7d8 (diff)
downloadlibquotient-63e2c0338e07cbc1939a5ad0f8047a9edab9b97c.tar.gz
libquotient-63e2c0338e07cbc1939a5ad0f8047a9edab9b97c.zip
Merge branch 'kitsune-update-matrix-api'
Diffstat (limited to 'lib/csapi/wellknown.cpp')
-rw-r--r--lib/csapi/wellknown.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/csapi/wellknown.cpp b/lib/csapi/wellknown.cpp
index 97505830..a6107f86 100644
--- a/lib/csapi/wellknown.cpp
+++ b/lib/csapi/wellknown.cpp
@@ -15,8 +15,7 @@ static const auto basePath = QStringLiteral("/.well-known");
class GetWellknownJob::Private
{
public:
- HomeserverInformation homeserver;
- Omittable<IdentityServerInformation> identityServer;
+ DiscoveryInformation data;
};
QUrl GetWellknownJob::makeRequestUrl(QUrl baseUrl)
@@ -36,24 +35,14 @@ GetWellknownJob::GetWellknownJob()
GetWellknownJob::~GetWellknownJob() = default;
-const HomeserverInformation& GetWellknownJob::homeserver() const
+const DiscoveryInformation& GetWellknownJob::data() const
{
- return d->homeserver;
-}
-
-const Omittable<IdentityServerInformation>& GetWellknownJob::identityServer() const
-{
- return d->identityServer;
+ return d->data;
}
BaseJob::Status GetWellknownJob::parseJson(const QJsonDocument& data)
{
- auto json = data.object();
- if (!json.contains("m.homeserver"_ls))
- return { JsonParseError,
- "The key 'm.homeserver' not found in the response" };
- fromJson(json.value("m.homeserver"_ls), d->homeserver);
- fromJson(json.value("m.identity_server"_ls), d->identityServer);
+ fromJson(data, d->data);
return Success;
}