diff options
Diffstat (limited to 'lib/csapi/definitions/wellknown')
-rw-r--r-- | lib/csapi/definitions/wellknown/full.cpp | 9 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/full.h | 54 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/homeserver.cpp | 5 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/homeserver.h | 30 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/identity_server.cpp | 5 | ||||
-rw-r--r-- | lib/csapi/definitions/wellknown/identity_server.h | 30 |
6 files changed, 69 insertions, 64 deletions
diff --git a/lib/csapi/definitions/wellknown/full.cpp b/lib/csapi/definitions/wellknown/full.cpp index 5ecef34f..595db0e5 100644 --- a/lib/csapi/definitions/wellknown/full.cpp +++ b/lib/csapi/definitions/wellknown/full.cpp @@ -4,14 +4,15 @@ #include "full.h" -using namespace QMatrixClient; +using namespace Quotient; void JsonObjectConverter<DiscoveryInformation>::dumpTo( - QJsonObject& jo, const DiscoveryInformation& pod) + QJsonObject& jo, const DiscoveryInformation& pod) { fillJson(jo, pod.additionalProperties); addParam<>(jo, QStringLiteral("m.homeserver"), pod.homeserver); - addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"), pod.identityServer); + addParam<IfNotEmpty>(jo, QStringLiteral("m.identity_server"), + pod.identityServer); } void JsonObjectConverter<DiscoveryInformation>::fillFrom( @@ -19,7 +20,5 @@ void JsonObjectConverter<DiscoveryInformation>::fillFrom( { fromJson(jo.take("m.homeserver"_ls), result.homeserver); fromJson(jo.take("m.identity_server"_ls), result.identityServer); - fromJson(jo, result.additionalProperties); } - diff --git a/lib/csapi/definitions/wellknown/full.h b/lib/csapi/definitions/wellknown/full.h index d9346acb..92c8afff 100644 --- a/lib/csapi/definitions/wellknown/full.h +++ b/lib/csapi/definitions/wellknown/full.h @@ -6,33 +6,37 @@ #include "converters.h" -#include <QtCore/QJsonObject> -#include "converters.h" #include "csapi/definitions/wellknown/homeserver.h" #include "csapi/definitions/wellknown/identity_server.h" + #include <QtCore/QHash> +#include <QtCore/QJsonObject> -namespace QMatrixClient +namespace Quotient { - // Data structures - - /// Used by clients to determine the homeserver, identity server, and other - /// optional components they should be interacting with. - struct DiscoveryInformation - { - /// Used by clients to determine the homeserver, identity server, and other - /// optional components they should be interacting with. - HomeserverInformation homeserver; - /// Used by clients to determine the homeserver, identity server, and other - /// optional components they should be interacting with. - Omittable<IdentityServerInformation> identityServer; - /// Application-dependent keys using Java package naming convention. - QHash<QString, QJsonObject> additionalProperties; - }; - template <> struct JsonObjectConverter<DiscoveryInformation> - { - static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod); - static void fillFrom(QJsonObject jo, DiscoveryInformation& pod); - }; - -} // namespace QMatrixClient + +// Data structures + +/// Used by clients to determine the homeserver, identity server, and other/// +/// optional components they should be interacting with. +struct DiscoveryInformation +{ + /// Used by clients to determine the homeserver, identity server, and + /// otheroptional components they should be interacting with. + HomeserverInformation homeserver; + /// Used by clients to determine the homeserver, identity server, and + /// otheroptional components they should be interacting with. + Omittable<IdentityServerInformation> identityServer; + + /// Application-dependent keys using Java package naming convention. + QHash<QString, QJsonObject> additionalProperties; +}; + +template <> +struct JsonObjectConverter<DiscoveryInformation> +{ + static void dumpTo(QJsonObject& jo, const DiscoveryInformation& pod); + static void fillFrom(QJsonObject jo, DiscoveryInformation& pod); +}; + +} // namespace Quotient diff --git a/lib/csapi/definitions/wellknown/homeserver.cpp b/lib/csapi/definitions/wellknown/homeserver.cpp index 0783f11b..7b87aa95 100644 --- a/lib/csapi/definitions/wellknown/homeserver.cpp +++ b/lib/csapi/definitions/wellknown/homeserver.cpp @@ -4,10 +4,10 @@ #include "homeserver.h" -using namespace QMatrixClient; +using namespace Quotient; void JsonObjectConverter<HomeserverInformation>::dumpTo( - QJsonObject& jo, const HomeserverInformation& pod) + QJsonObject& jo, const HomeserverInformation& pod) { addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl); } @@ -17,4 +17,3 @@ void JsonObjectConverter<HomeserverInformation>::fillFrom( { fromJson(jo.value("base_url"_ls), result.baseUrl); } - diff --git a/lib/csapi/definitions/wellknown/homeserver.h b/lib/csapi/definitions/wellknown/homeserver.h index f6761c30..606df88b 100644 --- a/lib/csapi/definitions/wellknown/homeserver.h +++ b/lib/csapi/definitions/wellknown/homeserver.h @@ -6,21 +6,23 @@ #include "converters.h" +namespace Quotient +{ + +// Data structures -namespace QMatrixClient +/// Used by clients to discover homeserver information. +struct HomeserverInformation { - // Data structures + /// The base URL for the homeserver for client-server connections. + QString baseUrl; +}; - /// Used by clients to discover homeserver information. - struct HomeserverInformation - { - /// The base URL for the homeserver for client-server connections. - QString baseUrl; - }; - template <> struct JsonObjectConverter<HomeserverInformation> - { - static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod); - static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod); - }; +template <> +struct JsonObjectConverter<HomeserverInformation> +{ + static void dumpTo(QJsonObject& jo, const HomeserverInformation& pod); + static void fillFrom(const QJsonObject& jo, HomeserverInformation& pod); +}; -} // namespace QMatrixClient +} // namespace Quotient diff --git a/lib/csapi/definitions/wellknown/identity_server.cpp b/lib/csapi/definitions/wellknown/identity_server.cpp index 99f36641..3b2a5720 100644 --- a/lib/csapi/definitions/wellknown/identity_server.cpp +++ b/lib/csapi/definitions/wellknown/identity_server.cpp @@ -4,10 +4,10 @@ #include "identity_server.h" -using namespace QMatrixClient; +using namespace Quotient; void JsonObjectConverter<IdentityServerInformation>::dumpTo( - QJsonObject& jo, const IdentityServerInformation& pod) + QJsonObject& jo, const IdentityServerInformation& pod) { addParam<>(jo, QStringLiteral("base_url"), pod.baseUrl); } @@ -17,4 +17,3 @@ void JsonObjectConverter<IdentityServerInformation>::fillFrom( { fromJson(jo.value("base_url"_ls), result.baseUrl); } - diff --git a/lib/csapi/definitions/wellknown/identity_server.h b/lib/csapi/definitions/wellknown/identity_server.h index 67d8b08d..b4304ef7 100644 --- a/lib/csapi/definitions/wellknown/identity_server.h +++ b/lib/csapi/definitions/wellknown/identity_server.h @@ -6,21 +6,23 @@ #include "converters.h" +namespace Quotient +{ + +// Data structures -namespace QMatrixClient +/// Used by clients to discover identity server information. +struct IdentityServerInformation { - // Data structures + /// The base URL for the identity server for client-server connections. + QString baseUrl; +}; - /// Used by clients to discover identity server information. - struct IdentityServerInformation - { - /// The base URL for the identity server for client-server connections. - QString baseUrl; - }; - template <> struct JsonObjectConverter<IdentityServerInformation> - { - static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod); - static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod); - }; +template <> +struct JsonObjectConverter<IdentityServerInformation> +{ + static void dumpTo(QJsonObject& jo, const IdentityServerInformation& pod); + static void fillFrom(const QJsonObject& jo, IdentityServerInformation& pod); +}; -} // namespace QMatrixClient +} // namespace Quotient |