[network/ruqola] src/core: Add messageEncrypted in message class

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

Add messageEncrypted in message class

M  +1    -1    src/core/autotests/messagetest.cpp
M  +17   -0    src/core/messages/message.cpp
M  +7    -0    src/core/messages/message.h

https://invent.kde.org/network/ruqola/-/commit/e0d0e9a2046a4201855031282d92ffff598a9001

diff --git a/src/core/autotests/messagetest.cpp b/src/core/autotests/messagetest.cpp
index ea423465a4..f24a9b474f 100644
--- a/src/core/autotests/messagetest.cpp
+++ b/src/core/autotests/messagetest.cpp
@@ -35,7 +35,7 @@ void MessageTest::shouldHaveDefaultValues()
     QVERIFY(!m.privateMessage());
     QVERIFY(!m.textToSpeechInProgress());
     // 14/03/2024 => size 816
-    QCOMPARE(sizeof(Message), 432);
+    QCOMPARE(sizeof(Message), 440);
     QCOMPARE(m.messageStates(), Message::MessageStates(Message::MessageState::Groupable | Message::MessageState::Translated));
 }
 
diff --git a/src/core/messages/message.cpp b/src/core/messages/message.cpp
index f925d573d3..361780957b 100644
--- a/src/core/messages/message.cpp
+++ b/src/core/messages/message.cpp
@@ -345,6 +345,23 @@ const MessagePinned *Message::messagePinned() const
     return nullptr;
 }
 
+void Message::setMessageEncrypted(const MessageEncrypted &messageEncrypted)
+{
+    if (!mMessageEncrypted) {
+        mMessageEncrypted = new MessageEncrypted(messageEncrypted);
+    } else {
+        mMessageEncrypted.reset(new MessageEncrypted(messageEncrypted));
+    }
+}
+
+const MessageEncrypted *Message::messageEncrypted() const
+{
+    if (mMessageEncrypted) {
+        return mMessageEncrypted.data();
+    }
+    return nullptr;
+}
+
 void Message::setMessagePinned(const MessagePinned &messagePinned)
 {
     if (!mMessagePinned) {
diff --git a/src/core/messages/message.h b/src/core/messages/message.h
index 1279e30ed2..5993943522 100644
--- a/src/core/messages/message.h
+++ b/src/core/messages/message.h
@@ -10,6 +10,7 @@
 #include "channels.h"
 #include "libruqolacore_export.h"
 #include "messageattachments.h"
+#include "messageencrypted.h"
 #include "messageextra.h"
 #include "messagepinned.h"
 #include "messagestarred.h"
@@ -241,6 +242,9 @@ public:
     [[nodiscard]] bool textToSpeechInProgress() const;
     void setTextToSpeechInProgress(bool newTextToSpeechInProgress);
 
+    [[nodiscard]] const MessageEncrypted *messageEncrypted() const;
+    void setMessageEncrypted(const MessageEncrypted &messageEncrypted);
+
 private:
     LIBRUQOLACORE_NO_EXPORT void parseMentions(const QJsonArray &mentions);
     LIBRUQOLACORE_NO_EXPORT void parseAttachment(const QJsonArray &attachments);
@@ -287,6 +291,9 @@ private:
     // Users which replies to thread
     QSharedDataPointer<Replies> mReplies;
 
+    // Encrypted message
+    QSharedDataPointer<MessageEncrypted> mMessageEncrypted;
+
     // role used when we add/remove role. It will displaying in messagesystem
     QString mRole;
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.