diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-05-26 20:18:32 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-05-26 20:18:32 +0900 |
commit | 6a4af80a7199753b493b17684162673b024d2191 (patch) | |
tree | 54cda4e8d95ce33cfa090893b13aa83fef016c35 /lib/csapi/administrative_contact.cpp | |
parent | c5d06cf378e820ca4290998a5580e87957daf061 (diff) | |
download | libquotient-6a4af80a7199753b493b17684162673b024d2191.tar.gz libquotient-6a4af80a7199753b493b17684162673b024d2191.zip |
lib/csapi/: regenerate job classes from the most recent templates
The second part to close #208.
Diffstat (limited to 'lib/csapi/administrative_contact.cpp')
-rw-r--r-- | lib/csapi/administrative_contact.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/csapi/administrative_contact.cpp b/lib/csapi/administrative_contact.cpp index eeb7cb68..7c6c4141 100644 --- a/lib/csapi/administrative_contact.cpp +++ b/lib/csapi/administrative_contact.cpp @@ -20,12 +20,12 @@ namespace QMatrixClient { GetAccount3PIDsJob::ThirdPartyIdentifier operator()(const QJsonValue& jv) { - const auto& o = jv.toObject(); + const auto& _json = jv.toObject(); GetAccount3PIDsJob::ThirdPartyIdentifier result; result.medium = - fromJson<QString>(o.value("medium")); + fromJson<QString>(_json.value("medium")); result.address = - fromJson<QString>(o.value("address")); + fromJson<QString>(_json.value("address")); return result; } @@ -71,12 +71,14 @@ namespace QMatrixClient QJsonObject toJson(const Post3PIDsJob::ThreePidCredentials& pod) { - QJsonObject o; - o.insert("client_secret", toJson(pod.clientSecret)); - o.insert("id_server", toJson(pod.idServer)); - o.insert("sid", toJson(pod.sid)); - - return o; + QJsonObject _json; + if (pod.omitted) + return _json; + + addToJson<>(_json, "client_secret", pod.clientSecret); + addToJson<>(_json, "id_server", pod.idServer); + addToJson<>(_json, "sid", pod.sid); + return _json; } } // namespace QMatrixClient @@ -85,8 +87,8 @@ Post3PIDsJob::Post3PIDsJob(const ThreePidCredentials& threePidCreds, bool bind) basePath % "/account/3pid") { QJsonObject _data; - _data.insert("three_pid_creds", toJson(threePidCreds)); - _data.insert("bind", toJson(bind)); + addToJson<>(_data, "three_pid_creds", threePidCreds); + addToJson<IfNotEmpty>(_data, "bind", bind); setRequestData(_data); } |