[network/ruqola] src/core/messages: Serialize/deserialize

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 24bb4502ec0bd07db24c18dd3b17711a1df29a48 by Laurent Montel.
Committed on 03/08/2026 at 11:44.
Pushed by mlaurent into branch 'master'.

Serialize/deserialize

M  +10   -3    src/core/messages/messageencrypted.cpp

https://invent.kde.org/network/ruqola/-/commit/24bb4502ec0bd07db24c18dd3b17711a1df29a48

diff --git a/src/core/messages/messageencrypted.cpp b/src/core/messages/messageencrypted.cpp
index 40b8c8080a..c09ab4de28 100644
--- a/src/core/messages/messageencrypted.cpp
+++ b/src/core/messages/messageencrypted.cpp
@@ -86,10 +86,13 @@ void MessageEncrypted::parse(const QJsonObject &o)
     mKeyId = o["kid"_L1].toString().toLatin1();
 }
 
-QJsonObject MessageEncrypted::serialize(const MessageEncrypted &messagePinned)
+QJsonObject MessageEncrypted::serialize(const MessageEncrypted &encrypted)
 {
     QJsonObject o;
-    // TODO
+    o["algorithm"_L1] = QString::fromLatin1(encrypted.algorithm());
+    o["ciphertext"_L1] = encrypted.ciphertext();
+    o["iv"_L1] = QString::fromLatin1(encrypted.iv());
+    o["kid"_L1] = QString::fromLatin1(encrypted.keyId());
     return o;
 }
 
@@ -105,6 +108,10 @@ QDebug operator<<(QDebug d, const MessageEncrypted &t)
 MessageEncrypted *MessageEncrypted::deserialize(const QJsonObject &o)
 {
     MessageEncrypted *encrypted = new MessageEncrypted;
-    // TODO
+    encrypted->setAlgorithm(o["algorithm"_L1].toString().toLatin1());
+    encrypted->setCiphertext(o["ciphertext"_L1].toString());
+    encrypted->setCiphertext(o["ciphertext"_L1].toString());
+    encrypted->setIv(o["iv"_L1].toString().toLatin1());
+    encrypted->setKeyId(o["kid"_L1].toString().toLatin1());
     return encrypted;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.