aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptedevent.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-27 20:14:53 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-27 20:14:53 +0100
commit0425fd280e7eee7a4c9bcf18f79910f181322c42 (patch)
treeec8e044711866266d38fc8c78f6e7ece8cf447d4 /lib/events/encryptedevent.h
parent0a46049ef26270933ecf6fea7395b03e6aee783e (diff)
downloadlibquotient-0425fd280e7eee7a4c9bcf18f79910f181322c42.tar.gz
libquotient-0425fd280e7eee7a4c9bcf18f79910f181322c42.zip
Event::content() -> contentPart()
There's a clash between Event::content() (a template function) and RoomMessageEvent::content() (plain member). Out of these two, the name more fits to the RME's member function - strictly speaking, Event::content() retrieves a part of content, and so is renamed. In addition, contentPart() defaults to QJsonValue now, which is pretty intuitive (the function returns values from a JSON object) and allows to implement more elaborate logic such as if (const auto v = contentPart<>("key"_ls); v.isObject()) { // foo } else if (v.isString()) { // bar } else { // boo }
Diffstat (limited to 'lib/events/encryptedevent.h')
-rw-r--r--lib/events/encryptedevent.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/events/encryptedevent.h b/lib/events/encryptedevent.h
index 598829cd..de89a7c6 100644
--- a/lib/events/encryptedevent.h
+++ b/lib/events/encryptedevent.h
@@ -41,7 +41,7 @@ public:
QString algorithm() const
{
- QString algo = content<QString>(AlgorithmKeyL);
+ QString algo = contentPart<QString>(AlgorithmKeyL);
if (!SupportedAlgorithms.contains(algo)) {
qWarning(MAIN) << "The EncryptedEvent's algorithm" << algo
<< "is not supported";
@@ -50,17 +50,17 @@ public:
}
QByteArray ciphertext() const
{
- return content<QString>(CiphertextKeyL).toLatin1();
+ return contentPart<QString>(CiphertextKeyL).toLatin1();
}
QJsonObject ciphertext(const QString& identityKey) const
{
- return content<QJsonObject>(CiphertextKeyL).value(identityKey).toObject();
+ return contentPart<QJsonObject>(CiphertextKeyL).value(identityKey).toObject();
}
- QString senderKey() const { return content<QString>(SenderKeyKeyL); }
+ QString senderKey() const { return contentPart<QString>(SenderKeyKeyL); }
/* device_id and session_id are required with Megolm */
- QString deviceId() const { return content<QString>(DeviceIdKeyL); }
- QString sessionId() const { return content<QString>(SessionIdKeyL); }
+ QString deviceId() const { return contentPart<QString>(DeviceIdKeyL); }
+ QString sessionId() const { return contentPart<QString>(SessionIdKeyL); }
};
REGISTER_EVENT_TYPE(EncryptedEvent)