aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/list_public_rooms.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-08 23:24:51 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-08 23:24:51 +0900
commit6767cb8eccea7b74531f59f165a28afa0bec61f4 (patch)
treeea3ffe2fc07d3a9b7b48ee2ab37b0fe594f1af85 /lib/csapi/list_public_rooms.cpp
parent4b1b308f28bdaef598a5dfc249d7af6a0346b367 (diff)
downloadlibquotient-6767cb8eccea7b74531f59f165a28afa0bec61f4.tar.gz
libquotient-6767cb8eccea7b74531f59f165a28afa0bec61f4.zip
csapi: Fix boolean query parameters incorrectly passed
Diffstat (limited to 'lib/csapi/list_public_rooms.cpp')
-rw-r--r--lib/csapi/list_public_rooms.cpp12
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;
}