[network/neochat/release/26.08] src/libneochat: Wait until encryption is set up before decrypting pinned message

Joshua Goins <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit e5a782386869170b1e91b78dc128da82ba04e3c2 by Joshua Goins.
Committed on 24/07/2026 at 20:14.
Pushed by redstrate into branch 'release/26.08'.

Wait until encryption is set up before decrypting pinned message

See https://github.com/quotient-im/libQuotient/pull/977 for the crash
related to this issue.

(cherry picked from commit 27334d921b8327fc03d3250e2d2ae458e572125b)

M  +8    -2    src/libneochat/neochatroom.cpp

https://invent.kde.org/network/neochat/-/commit/e5a782386869170b1e91b78dc128da82ba04e3c2

diff --git a/src/libneochat/neochatroom.cpp b/src/libneochat/neochatroom.cpp
index 5c4f5e9b2..3061cceea 100644
--- a/src/libneochat/neochatroom.cpp
+++ b/src/libneochat/neochatroom.cpp
@@ -131,9 +131,15 @@ NeoChatRoom::NeoChatRoom(Connection *c, QString roomId, JoinState joinState)
         this,
         &Room::baseStateLoaded,
         this,
-        [this]() {
+        [this, connection] {
             updatePushNotificationState(u"m.push_rules"_s);
-            loadPinnedMessage();
+
+            // We need to wait until encryption is set up, otherwise the event isn't decrypted.
+            if (!connection->encryptionEnabled()) {
+                connect(connection, &Connection::ready, this, &NeoChatRoom::loadPinnedMessage, Qt::SingleShotConnection);
+            } else {
+                loadPinnedMessage();
+            }
 
             Q_EMIT canEncryptRoomChanged();
             Q_EMIT inviteTimestampChanged();
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.