aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/create_room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-02 17:58:34 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-04 20:13:43 +0900
commit3dd6b5e6cc50aafce74b21b5a0bf4b26a9fcf6ee (patch)
treea647fa5328e04b20a84e46d29d420555d9c56cde /lib/csapi/create_room.cpp
parented467d27b07781fdd2f7ddef043568954ce50b69 (diff)
downloadlibquotient-3dd6b5e6cc50aafce74b21b5a0bf4b26a9fcf6ee.tar.gz
libquotient-3dd6b5e6cc50aafce74b21b5a0bf4b26a9fcf6ee.zip
Use QStringLiteral() and operator"" _ls() in network jobs
Diffstat (limited to 'lib/csapi/create_room.cpp')
-rw-r--r--lib/csapi/create_room.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/csapi/create_room.cpp b/lib/csapi/create_room.cpp
index 910210bc..5600e18a 100644
--- a/lib/csapi/create_room.cpp
+++ b/lib/csapi/create_room.cpp
@@ -19,18 +19,18 @@ namespace QMatrixClient
QJsonObject toJson(const CreateRoomJob::Invite3pid& pod)
{
QJsonObject _json;
- addParam<>(_json, "id_server", pod.idServer);
- addParam<>(_json, "medium", pod.medium);
- addParam<>(_json, "address", pod.address);
+ addParam<>(_json, QStringLiteral("id_server"), pod.idServer);
+ addParam<>(_json, QStringLiteral("medium"), pod.medium);
+ addParam<>(_json, QStringLiteral("address"), pod.address);
return _json;
}
QJsonObject toJson(const CreateRoomJob::StateEvent& pod)
{
QJsonObject _json;
- addParam<IfNotEmpty>(_json, "type", pod.type);
- addParam<IfNotEmpty>(_json, "state_key", pod.stateKey);
- addParam<IfNotEmpty>(_json, "content", pod.content);
+ addParam<IfNotEmpty>(_json, QStringLiteral("type"), pod.type);
+ addParam<IfNotEmpty>(_json, QStringLiteral("state_key"), pod.stateKey);
+ addParam<IfNotEmpty>(_json, QStringLiteral("content"), pod.content);
return _json;
}
} // namespace QMatrixClient
@@ -41,23 +41,25 @@ class CreateRoomJob::Private
QString roomId;
};
+static const auto CreateRoomJobName = QStringLiteral("CreateRoomJob");
+
CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QStringList& invite, const QVector<Invite3pid>& invite3pid, const QJsonObject& creationContent, const QVector<StateEvent>& initialState, const QString& preset, bool isDirect, bool guestCanJoin)
- : BaseJob(HttpVerb::Post, "CreateRoomJob",
+ : BaseJob(HttpVerb::Post, CreateRoomJobName,
basePath % "/createRoom")
, d(new Private)
{
QJsonObject _data;
- addParam<IfNotEmpty>(_data, "visibility", visibility);
- addParam<IfNotEmpty>(_data, "room_alias_name", roomAliasName);
- addParam<IfNotEmpty>(_data, "name", name);
- addParam<IfNotEmpty>(_data, "topic", topic);
- addParam<IfNotEmpty>(_data, "invite", invite);
- addParam<IfNotEmpty>(_data, "invite_3pid", invite3pid);
- addParam<IfNotEmpty>(_data, "creation_content", creationContent);
- addParam<IfNotEmpty>(_data, "initial_state", initialState);
- addParam<IfNotEmpty>(_data, "preset", preset);
- addParam<IfNotEmpty>(_data, "is_direct", isDirect);
- addParam<IfNotEmpty>(_data, "guest_can_join", guestCanJoin);
+ addParam<IfNotEmpty>(_data, QStringLiteral("visibility"), visibility);
+ addParam<IfNotEmpty>(_data, QStringLiteral("room_alias_name"), roomAliasName);
+ addParam<IfNotEmpty>(_data, QStringLiteral("name"), name);
+ addParam<IfNotEmpty>(_data, QStringLiteral("topic"), topic);
+ addParam<IfNotEmpty>(_data, QStringLiteral("invite"), invite);
+ addParam<IfNotEmpty>(_data, QStringLiteral("invite_3pid"), invite3pid);
+ addParam<IfNotEmpty>(_data, QStringLiteral("creation_content"), creationContent);
+ addParam<IfNotEmpty>(_data, QStringLiteral("initial_state"), initialState);
+ addParam<IfNotEmpty>(_data, QStringLiteral("preset"), preset);
+ addParam<IfNotEmpty>(_data, QStringLiteral("is_direct"), isDirect);
+ addParam<IfNotEmpty>(_data, QStringLiteral("guest_can_join"), guestCanJoin);
setRequestData(_data);
}
@@ -71,7 +73,7 @@ const QString& CreateRoomJob::roomId() const
BaseJob::Status CreateRoomJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
- d->roomId = fromJson<QString>(json.value("room_id"));
+ d->roomId = fromJson<QString>(json.value("room_id"_ls));
return Success;
}