diff options
Diffstat (limited to 'lib/csapi/list_public_rooms.cpp')
-rw-r--r-- | lib/csapi/list_public_rooms.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp index f104786b..5952fd6e 100644 --- a/lib/csapi/list_public_rooms.cpp +++ b/lib/csapi/list_public_rooms.cpp @@ -100,12 +100,9 @@ class GetPublicRoomsJob::Private BaseJob::Query queryToGetPublicRooms(Omittable<int> limit, const QString& since, const QString& server) { BaseJob::Query _q; - if (limit) - _q.addQueryItem("limit", QString("%1").arg(limit.value())); - if (!since.isEmpty()) - _q.addQueryItem("since", since); - if (!server.isEmpty()) - _q.addQueryItem("server", server); + addToQuery<IfNotEmpty>(_q, "limit", limit); + addToQuery<IfNotEmpty>(_q, "since", since); + addToQuery<IfNotEmpty>(_q, "server", server); return _q; } @@ -213,8 +210,7 @@ class QueryPublicRoomsJob::Private BaseJob::Query queryToQueryPublicRooms(const QString& server) { BaseJob::Query _q; - if (!server.isEmpty()) - _q.addQueryItem("server", server); + addToQuery<IfNotEmpty>(_q, "server", server); return _q; } |