From 3ba2acce470407854bb38b2633675e916a51a904 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 26 Mar 2020 09:28:11 +0100 Subject: AliasesEventContent::toJson(): optimise generated JSON --- lib/events/roomcanonicalaliasevent.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/events/roomcanonicalaliasevent.h') diff --git a/lib/events/roomcanonicalaliasevent.h b/lib/events/roomcanonicalaliasevent.h index 311a5959..5d680de7 100644 --- a/lib/events/roomcanonicalaliasevent.h +++ b/lib/events/roomcanonicalaliasevent.h @@ -37,10 +37,12 @@ namespace EventContent{ , altAliases(fromJson(json["alt_aliases"])) { } - QJsonObject toJson() const + auto toJson() const { - return { { "alias", Quotient::toJson(canonicalAlias) }, - { "alt_aliases", Quotient::toJson(altAliases) } }; + QJsonObject jo; + addParam(jo, QStringLiteral("alias"), canonicalAlias); + addParam(jo, QStringLiteral("alt_aliases"), altAliases); + return jo; } QString canonicalAlias; @@ -68,7 +70,6 @@ public: { } QString alias() const { return content().canonicalAlias; } - QStringList altAliases() const { return content().altAliases; } }; REGISTER_EVENT_TYPE(RoomCanonicalAliasEvent) -- cgit v1.2.3