diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-04 21:34:00 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-04 21:34:00 +0900 |
commit | 6a9de91752dfe75e185bf90ab856367b2c804582 (patch) | |
tree | 2a12ecc84bf0055e317ef2e4aeec3439d92b2035 /lib/csapi/definitions | |
parent | d5397fe5ae2ca34d5cfb11394dac17728a2b50ce (diff) | |
parent | 5d1dd53890611376873f6f959e206d5a56cfff70 (diff) | |
download | libquotient-6a9de91752dfe75e185bf90ab856367b2c804582.tar.gz libquotient-6a9de91752dfe75e185bf90ab856367b2c804582.zip |
Merge branch 'kitsune-events-rewritten'
Diffstat (limited to 'lib/csapi/definitions')
-rw-r--r-- | lib/csapi/definitions/client_device.cpp | 16 | ||||
-rw-r--r-- | lib/csapi/definitions/device_keys.cpp | 20 | ||||
-rw-r--r-- | lib/csapi/definitions/event_filter.cpp | 20 | ||||
-rw-r--r-- | lib/csapi/definitions/push_condition.cpp | 16 | ||||
-rw-r--r-- | lib/csapi/definitions/push_rule.cpp | 24 | ||||
-rw-r--r-- | lib/csapi/definitions/push_ruleset.cpp | 20 | ||||
-rw-r--r-- | lib/csapi/definitions/room_event_filter.cpp | 12 | ||||
-rw-r--r-- | lib/csapi/definitions/sync_filter.cpp | 48 |
8 files changed, 88 insertions, 88 deletions
diff --git a/lib/csapi/definitions/client_device.cpp b/lib/csapi/definitions/client_device.cpp index 7c3d7ea6..bd7acd02 100644 --- a/lib/csapi/definitions/client_device.cpp +++ b/lib/csapi/definitions/client_device.cpp @@ -9,10 +9,10 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const Device& pod) { QJsonObject _json; - addParam<>(_json, "device_id", pod.deviceId); - addParam<IfNotEmpty>(_json, "display_name", pod.displayName); - addParam<IfNotEmpty>(_json, "last_seen_ip", pod.lastSeenIp); - addParam<IfNotEmpty>(_json, "last_seen_ts", pod.lastSeenTs); + addParam<>(_json, QStringLiteral("device_id"), pod.deviceId); + addParam<IfNotEmpty>(_json, QStringLiteral("display_name"), pod.displayName); + addParam<IfNotEmpty>(_json, QStringLiteral("last_seen_ip"), pod.lastSeenIp); + addParam<IfNotEmpty>(_json, QStringLiteral("last_seen_ts"), pod.lastSeenTs); return _json; } @@ -21,13 +21,13 @@ Device FromJson<Device>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); Device result; result.deviceId = - fromJson<QString>(_json.value("device_id")); + fromJson<QString>(_json.value("device_id"_ls)); result.displayName = - fromJson<QString>(_json.value("display_name")); + fromJson<QString>(_json.value("display_name"_ls)); result.lastSeenIp = - fromJson<QString>(_json.value("last_seen_ip")); + fromJson<QString>(_json.value("last_seen_ip"_ls)); result.lastSeenTs = - fromJson<qint64>(_json.value("last_seen_ts")); + fromJson<qint64>(_json.value("last_seen_ts"_ls)); return result; } diff --git a/lib/csapi/definitions/device_keys.cpp b/lib/csapi/definitions/device_keys.cpp index 43cd5d2e..d17f4c12 100644 --- a/lib/csapi/definitions/device_keys.cpp +++ b/lib/csapi/definitions/device_keys.cpp @@ -9,11 +9,11 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const DeviceKeys& pod) { QJsonObject _json; - addParam<>(_json, "user_id", pod.userId); - addParam<>(_json, "device_id", pod.deviceId); - addParam<>(_json, "algorithms", pod.algorithms); - addParam<>(_json, "keys", pod.keys); - addParam<>(_json, "signatures", pod.signatures); + addParam<>(_json, QStringLiteral("user_id"), pod.userId); + addParam<>(_json, QStringLiteral("device_id"), pod.deviceId); + addParam<>(_json, QStringLiteral("algorithms"), pod.algorithms); + addParam<>(_json, QStringLiteral("keys"), pod.keys); + addParam<>(_json, QStringLiteral("signatures"), pod.signatures); return _json; } @@ -22,15 +22,15 @@ DeviceKeys FromJson<DeviceKeys>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); DeviceKeys result; result.userId = - fromJson<QString>(_json.value("user_id")); + fromJson<QString>(_json.value("user_id"_ls)); result.deviceId = - fromJson<QString>(_json.value("device_id")); + fromJson<QString>(_json.value("device_id"_ls)); result.algorithms = - fromJson<QStringList>(_json.value("algorithms")); + fromJson<QStringList>(_json.value("algorithms"_ls)); result.keys = - fromJson<QHash<QString, QString>>(_json.value("keys")); + fromJson<QHash<QString, QString>>(_json.value("keys"_ls)); result.signatures = - fromJson<QHash<QString, QHash<QString, QString>>>(_json.value("signatures")); + fromJson<QHash<QString, QHash<QString, QString>>>(_json.value("signatures"_ls)); return result; } diff --git a/lib/csapi/definitions/event_filter.cpp b/lib/csapi/definitions/event_filter.cpp index 21ee2b81..336de0dd 100644 --- a/lib/csapi/definitions/event_filter.cpp +++ b/lib/csapi/definitions/event_filter.cpp @@ -9,11 +9,11 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const Filter& pod) { QJsonObject _json; - addParam<IfNotEmpty>(_json, "limit", pod.limit); - addParam<IfNotEmpty>(_json, "not_senders", pod.notSenders); - addParam<IfNotEmpty>(_json, "not_types", pod.notTypes); - addParam<IfNotEmpty>(_json, "senders", pod.senders); - addParam<IfNotEmpty>(_json, "types", pod.types); + addParam<IfNotEmpty>(_json, QStringLiteral("limit"), pod.limit); + addParam<IfNotEmpty>(_json, QStringLiteral("not_senders"), pod.notSenders); + addParam<IfNotEmpty>(_json, QStringLiteral("not_types"), pod.notTypes); + addParam<IfNotEmpty>(_json, QStringLiteral("senders"), pod.senders); + addParam<IfNotEmpty>(_json, QStringLiteral("types"), pod.types); return _json; } @@ -22,15 +22,15 @@ Filter FromJson<Filter>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); Filter result; result.limit = - fromJson<int>(_json.value("limit")); + fromJson<int>(_json.value("limit"_ls)); result.notSenders = - fromJson<QStringList>(_json.value("not_senders")); + fromJson<QStringList>(_json.value("not_senders"_ls)); result.notTypes = - fromJson<QStringList>(_json.value("not_types")); + fromJson<QStringList>(_json.value("not_types"_ls)); result.senders = - fromJson<QStringList>(_json.value("senders")); + fromJson<QStringList>(_json.value("senders"_ls)); result.types = - fromJson<QStringList>(_json.value("types")); + fromJson<QStringList>(_json.value("types"_ls)); return result; } diff --git a/lib/csapi/definitions/push_condition.cpp b/lib/csapi/definitions/push_condition.cpp index b8595ec6..19351ae1 100644 --- a/lib/csapi/definitions/push_condition.cpp +++ b/lib/csapi/definitions/push_condition.cpp @@ -9,10 +9,10 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const PushCondition& pod) { QJsonObject _json; - addParam<>(_json, "kind", pod.kind); - addParam<IfNotEmpty>(_json, "key", pod.key); - addParam<IfNotEmpty>(_json, "pattern", pod.pattern); - addParam<IfNotEmpty>(_json, "is", pod.is); + addParam<>(_json, QStringLiteral("kind"), pod.kind); + addParam<IfNotEmpty>(_json, QStringLiteral("key"), pod.key); + addParam<IfNotEmpty>(_json, QStringLiteral("pattern"), pod.pattern); + addParam<IfNotEmpty>(_json, QStringLiteral("is"), pod.is); return _json; } @@ -21,13 +21,13 @@ PushCondition FromJson<PushCondition>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); PushCondition result; result.kind = - fromJson<QString>(_json.value("kind")); + fromJson<QString>(_json.value("kind"_ls)); result.key = - fromJson<QString>(_json.value("key")); + fromJson<QString>(_json.value("key"_ls)); result.pattern = - fromJson<QString>(_json.value("pattern")); + fromJson<QString>(_json.value("pattern"_ls)); result.is = - fromJson<QString>(_json.value("is")); + fromJson<QString>(_json.value("is"_ls)); return result; } diff --git a/lib/csapi/definitions/push_rule.cpp b/lib/csapi/definitions/push_rule.cpp index 98f5d788..833135ec 100644 --- a/lib/csapi/definitions/push_rule.cpp +++ b/lib/csapi/definitions/push_rule.cpp @@ -9,12 +9,12 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const PushRule& pod) { QJsonObject _json; - addParam<>(_json, "actions", pod.actions); - addParam<>(_json, "default", pod.isDefault); - addParam<>(_json, "enabled", pod.enabled); - addParam<>(_json, "rule_id", pod.ruleId); - addParam<IfNotEmpty>(_json, "conditions", pod.conditions); - addParam<IfNotEmpty>(_json, "pattern", pod.pattern); + addParam<>(_json, QStringLiteral("actions"), pod.actions); + addParam<>(_json, QStringLiteral("default"), pod.isDefault); + addParam<>(_json, QStringLiteral("enabled"), pod.enabled); + addParam<>(_json, QStringLiteral("rule_id"), pod.ruleId); + addParam<IfNotEmpty>(_json, QStringLiteral("conditions"), pod.conditions); + addParam<IfNotEmpty>(_json, QStringLiteral("pattern"), pod.pattern); return _json; } @@ -23,17 +23,17 @@ PushRule FromJson<PushRule>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); PushRule result; result.actions = - fromJson<QVector<QVariant>>(_json.value("actions")); + fromJson<QVector<QVariant>>(_json.value("actions"_ls)); result.isDefault = - fromJson<bool>(_json.value("default")); + fromJson<bool>(_json.value("default"_ls)); result.enabled = - fromJson<bool>(_json.value("enabled")); + fromJson<bool>(_json.value("enabled"_ls)); result.ruleId = - fromJson<QString>(_json.value("rule_id")); + fromJson<QString>(_json.value("rule_id"_ls)); result.conditions = - fromJson<QVector<PushCondition>>(_json.value("conditions")); + fromJson<QVector<PushCondition>>(_json.value("conditions"_ls)); result.pattern = - fromJson<QString>(_json.value("pattern")); + fromJson<QString>(_json.value("pattern"_ls)); return result; } diff --git a/lib/csapi/definitions/push_ruleset.cpp b/lib/csapi/definitions/push_ruleset.cpp index ca2bbc0d..c424f686 100644 --- a/lib/csapi/definitions/push_ruleset.cpp +++ b/lib/csapi/definitions/push_ruleset.cpp @@ -9,11 +9,11 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const PushRuleset& pod) { QJsonObject _json; - addParam<IfNotEmpty>(_json, "content", pod.content); - addParam<IfNotEmpty>(_json, "override", pod.override); - addParam<IfNotEmpty>(_json, "room", pod.room); - addParam<IfNotEmpty>(_json, "sender", pod.sender); - addParam<IfNotEmpty>(_json, "underride", pod.underride); + addParam<IfNotEmpty>(_json, QStringLiteral("content"), pod.content); + addParam<IfNotEmpty>(_json, QStringLiteral("override"), pod.override); + addParam<IfNotEmpty>(_json, QStringLiteral("room"), pod.room); + addParam<IfNotEmpty>(_json, QStringLiteral("sender"), pod.sender); + addParam<IfNotEmpty>(_json, QStringLiteral("underride"), pod.underride); return _json; } @@ -22,15 +22,15 @@ PushRuleset FromJson<PushRuleset>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); PushRuleset result; result.content = - fromJson<QVector<PushRule>>(_json.value("content")); + fromJson<QVector<PushRule>>(_json.value("content"_ls)); result.override = - fromJson<QVector<PushRule>>(_json.value("override")); + fromJson<QVector<PushRule>>(_json.value("override"_ls)); result.room = - fromJson<QVector<PushRule>>(_json.value("room")); + fromJson<QVector<PushRule>>(_json.value("room"_ls)); result.sender = - fromJson<QVector<PushRule>>(_json.value("sender")); + fromJson<QVector<PushRule>>(_json.value("sender"_ls)); result.underride = - fromJson<QVector<PushRule>>(_json.value("underride")); + fromJson<QVector<PushRule>>(_json.value("underride"_ls)); return result; } diff --git a/lib/csapi/definitions/room_event_filter.cpp b/lib/csapi/definitions/room_event_filter.cpp index 1702be22..18ce07ec 100644 --- a/lib/csapi/definitions/room_event_filter.cpp +++ b/lib/csapi/definitions/room_event_filter.cpp @@ -9,9 +9,9 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const RoomEventFilter& pod) { QJsonObject _json; - addParam<IfNotEmpty>(_json, "not_rooms", pod.notRooms); - addParam<IfNotEmpty>(_json, "rooms", pod.rooms); - addParam<IfNotEmpty>(_json, "contains_url", pod.containsUrl); + addParam<IfNotEmpty>(_json, QStringLiteral("not_rooms"), pod.notRooms); + addParam<IfNotEmpty>(_json, QStringLiteral("rooms"), pod.rooms); + addParam<IfNotEmpty>(_json, QStringLiteral("contains_url"), pod.containsUrl); return _json; } @@ -20,11 +20,11 @@ RoomEventFilter FromJson<RoomEventFilter>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); RoomEventFilter result; result.notRooms = - fromJson<QStringList>(_json.value("not_rooms")); + fromJson<QStringList>(_json.value("not_rooms"_ls)); result.rooms = - fromJson<QStringList>(_json.value("rooms")); + fromJson<QStringList>(_json.value("rooms"_ls)); result.containsUrl = - fromJson<bool>(_json.value("contains_url")); + fromJson<bool>(_json.value("contains_url"_ls)); return result; } diff --git a/lib/csapi/definitions/sync_filter.cpp b/lib/csapi/definitions/sync_filter.cpp index 2b5cf8be..b42f15f5 100644 --- a/lib/csapi/definitions/sync_filter.cpp +++ b/lib/csapi/definitions/sync_filter.cpp @@ -9,13 +9,13 @@ using namespace QMatrixClient; QJsonObject QMatrixClient::toJson(const RoomFilter& pod) { QJsonObject _json; - addParam<IfNotEmpty>(_json, "not_rooms", pod.notRooms); - addParam<IfNotEmpty>(_json, "rooms", pod.rooms); - addParam<IfNotEmpty>(_json, "ephemeral", pod.ephemeral); - addParam<IfNotEmpty>(_json, "include_leave", pod.includeLeave); - addParam<IfNotEmpty>(_json, "state", pod.state); - addParam<IfNotEmpty>(_json, "timeline", pod.timeline); - addParam<IfNotEmpty>(_json, "account_data", pod.accountData); + addParam<IfNotEmpty>(_json, QStringLiteral("not_rooms"), pod.notRooms); + addParam<IfNotEmpty>(_json, QStringLiteral("rooms"), pod.rooms); + addParam<IfNotEmpty>(_json, QStringLiteral("ephemeral"), pod.ephemeral); + addParam<IfNotEmpty>(_json, QStringLiteral("include_leave"), pod.includeLeave); + addParam<IfNotEmpty>(_json, QStringLiteral("state"), pod.state); + addParam<IfNotEmpty>(_json, QStringLiteral("timeline"), pod.timeline); + addParam<IfNotEmpty>(_json, QStringLiteral("account_data"), pod.accountData); return _json; } @@ -24,19 +24,19 @@ RoomFilter FromJson<RoomFilter>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); RoomFilter result; result.notRooms = - fromJson<QStringList>(_json.value("not_rooms")); + fromJson<QStringList>(_json.value("not_rooms"_ls)); result.rooms = - fromJson<QStringList>(_json.value("rooms")); + fromJson<QStringList>(_json.value("rooms"_ls)); result.ephemeral = - fromJson<RoomEventFilter>(_json.value("ephemeral")); + fromJson<RoomEventFilter>(_json.value("ephemeral"_ls)); result.includeLeave = - fromJson<bool>(_json.value("include_leave")); + fromJson<bool>(_json.value("include_leave"_ls)); result.state = - fromJson<RoomEventFilter>(_json.value("state")); + fromJson<RoomEventFilter>(_json.value("state"_ls)); result.timeline = - fromJson<RoomEventFilter>(_json.value("timeline")); + fromJson<RoomEventFilter>(_json.value("timeline"_ls)); result.accountData = - fromJson<RoomEventFilter>(_json.value("account_data")); + fromJson<RoomEventFilter>(_json.value("account_data"_ls)); return result; } @@ -44,11 +44,11 @@ RoomFilter FromJson<RoomFilter>::operator()(const QJsonValue& jv) QJsonObject QMatrixClient::toJson(const SyncFilter& pod) { QJsonObject _json; - addParam<IfNotEmpty>(_json, "event_fields", pod.eventFields); - addParam<IfNotEmpty>(_json, "event_format", pod.eventFormat); - addParam<IfNotEmpty>(_json, "presence", pod.presence); - addParam<IfNotEmpty>(_json, "account_data", pod.accountData); - addParam<IfNotEmpty>(_json, "room", pod.room); + addParam<IfNotEmpty>(_json, QStringLiteral("event_fields"), pod.eventFields); + addParam<IfNotEmpty>(_json, QStringLiteral("event_format"), pod.eventFormat); + addParam<IfNotEmpty>(_json, QStringLiteral("presence"), pod.presence); + addParam<IfNotEmpty>(_json, QStringLiteral("account_data"), pod.accountData); + addParam<IfNotEmpty>(_json, QStringLiteral("room"), pod.room); return _json; } @@ -57,15 +57,15 @@ SyncFilter FromJson<SyncFilter>::operator()(const QJsonValue& jv) const auto& _json = jv.toObject(); SyncFilter result; result.eventFields = - fromJson<QStringList>(_json.value("event_fields")); + fromJson<QStringList>(_json.value("event_fields"_ls)); result.eventFormat = - fromJson<QString>(_json.value("event_format")); + fromJson<QString>(_json.value("event_format"_ls)); result.presence = - fromJson<Filter>(_json.value("presence")); + fromJson<Filter>(_json.value("presence"_ls)); result.accountData = - fromJson<Filter>(_json.value("account_data")); + fromJson<Filter>(_json.value("account_data"_ls)); result.room = - fromJson<RoomFilter>(_json.value("room")); + fromJson<RoomFilter>(_json.value("room"_ls)); return result; } |