[network/ruqola] src/core: otr clean up

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

otr clean up

M  +0    -24   src/core/autotests/rocketchatmessagetest.cpp
M  +0    -4    src/core/autotests/rocketchatmessagetest.h
M  +0    -6    src/core/messages/message.cpp
M  +0    -12   src/core/messages/systemmessagetypeutil.cpp
M  +0    -3    src/core/messages/systemmessagetypeutil.h
M  +0    -3    src/core/model/roommodel.cpp
M  +0    -1    src/core/model/roommodel.h
M  +0    -32   src/core/rocketchatmessage.cpp
M  +0    -8    src/core/rocketchatmessage.h

https://invent.kde.org/network/ruqola/-/commit/473cd32b135a69616e883e7b024b40899d74a0c2

diff --git a/src/core/autotests/rocketchatmessagetest.cpp b/src/core/autotests/rocketchatmessagetest.cpp
index e21f601d0c..721bf45af7 100644
--- a/src/core/autotests/rocketchatmessagetest.cpp
+++ b/src/core/autotests/rocketchatmessagetest.cpp
@@ -131,30 +131,6 @@ void RocketChatMessageTest::unBlockUser()
     compareFile(r.result, u"unBlockUser"_s);
 }
 
-void RocketChatMessageTest::streamNotifyUserOtrEnd()
-{
-    RocketChatMessage m;
-    m.setJsonFormat(QJsonDocument::Indented);
-    RocketChatMessage::RocketChatMessageResult r = m.streamNotifyUserOtrEnd(u"userFrom"_s, u"userTo"_s, 43);
-    compareFile(r.result, u"streamNotifyUserOtrEnd"_s);
-}
-
-void RocketChatMessageTest::streamNotifyUserOtrHandshake()
-{
-    RocketChatMessage m;
-    m.setJsonFormat(QJsonDocument::Indented);
-    RocketChatMessage::RocketChatMessageResult r = m.streamNotifyUserOtrHandshake(u"userFrom"_s, u"userTo"_s, u"publickeys"_s, 43);
-    compareFile(r.result, u"streamNotifyUserOtrHandshake"_s);
-}
-
-void RocketChatMessageTest::streamNotifyUserOtrAcknowledge()
-{
-    RocketChatMessage m;
-    m.setJsonFormat(QJsonDocument::Indented);
-    RocketChatMessage::RocketChatMessageResult r = m.streamNotifyUserOtrAcknowledge(QByteArrayLiteral("userFrom"), "userTo"_ba, u"publickeys"_s, 43);
-    compareFile(r.result, u"streamNotifyUserOtrAcknowledge"_s);
-}
-
 void RocketChatMessageTest::enable2fa()
 {
     RocketChatMessage m;
diff --git a/src/core/autotests/rocketchatmessagetest.h b/src/core/autotests/rocketchatmessagetest.h
index 42e1242ba9..02c41567d1 100644
--- a/src/core/autotests/rocketchatmessagetest.h
+++ b/src/core/autotests/rocketchatmessagetest.h
@@ -38,10 +38,6 @@ private Q_SLOTS:
     void blockUser();
     void unBlockUser();
 
-    void streamNotifyUserOtrEnd();
-    void streamNotifyUserOtrHandshake();
-    void streamNotifyUserOtrAcknowledge();
-
     void enable2fa();
     void disable2fa();
     void validateTempToken2fa();
diff --git a/src/core/messages/message.cpp b/src/core/messages/message.cpp
index 8f815351e3..d51324a054 100644
--- a/src/core/messages/message.cpp
+++ b/src/core/messages/message.cpp
@@ -869,8 +869,6 @@ QString Message::systemMessageText() const
         return i18n("Message Deleted");
     case SystemMessageTypeUtil::SystemMessageType::Pinned:
         return i18n("Message Pinned");
-    case SystemMessageTypeUtil::SystemMessageType::EncryptedMessage:
-        return i18n("Encrypted Message");
     case SystemMessageTypeUtil::SystemMessageType::UserUnmuted:
         return i18n("%1 was unmuted by %2", mText, mUsername);
     case SystemMessageTypeUtil::SystemMessageType::UserMuted:
@@ -928,12 +926,8 @@ QString Message::systemMessageText() const
         return i18n("Room disallowed reacting by %1", mUsername);
     case SystemMessageTypeUtil::SystemMessageType::UserJoinedTeam:
         return i18n("%1 joined this Team", mUsername);
-    case SystemMessageTypeUtil::SystemMessageType::UserJoinedOtr:
-        return i18n("%1 has joined OTR chat.", mUsername);
     case SystemMessageTypeUtil::SystemMessageType::UserKeyRefreshedSuccessfully:
         return i18n("%1 key refreshed successfully", mUsername);
-    case SystemMessageTypeUtil::SystemMessageType::UserRequesterOtrKeyRefresh:
-        return i18n("%1 has requested key refresh.", mUsername);
     case SystemMessageTypeUtil::SystemMessageType::VideoConf:
         return i18n("Conference Call");
     case SystemMessageTypeUtil::SystemMessageType::UserBanned:
diff --git a/src/core/messages/systemmessagetypeutil.cpp b/src/core/messages/systemmessagetypeutil.cpp
index 7a2f62ac6d..63120bd08f 100644
--- a/src/core/messages/systemmessagetypeutil.cpp
+++ b/src/core/messages/systemmessagetypeutil.cpp
@@ -41,8 +41,6 @@ SystemMessageType SystemMessageTypeUtil::systemMessageTypeFromString(const QStri
         return MessageDeleted;
     } else if (str == "message_pinned"_L1) {
         return Pinned;
-    } else if (str == "otr"_L1) {
-        return EncryptedMessage;
     } else if (str == "user-unmuted"_L1) {
         return UserUnmuted;
     } else if (str == "user-muted"_L1) {
@@ -95,12 +93,8 @@ SystemMessageType SystemMessageTypeUtil::systemMessageTypeFromString(const QStri
         return RoomDisallowedReacting;
     } else if (str == "ujt"_L1) {
         return UserJoinedTeam;
-    } else if (str == "user_joined_otr"_L1) {
-        return UserJoinedOtr;
     } else if (str == "user_key_refreshed_successfully"_L1) {
         return UserKeyRefreshedSuccessfully;
-    } else if (str == "user_requested_otr_key_refresh"_L1) {
-        return UserRequesterOtrKeyRefresh;
     } else if (str == "videoconf"_L1) {
         return VideoConf;
     } else if (str == "user-unbanned"_L1) {
@@ -142,8 +136,6 @@ QString SystemMessageTypeUtil::systemMessageTypeStringFromEnum(SystemMessageType
         return "rm"_L1;
     case Pinned:
         return "message_pinned"_L1;
-    case EncryptedMessage:
-        return "otr"_L1;
     case UserUnmuted:
         return "user-unmuted"_L1;
     case UserMuted:
@@ -196,12 +188,8 @@ QString SystemMessageTypeUtil::systemMessageTypeStringFromEnum(SystemMessageType
         return "room-disallowed-reacting"_L1;
     case UserJoinedTeam:
         return "ujt"_L1;
-    case UserJoinedOtr:
-        return "user_joined_otr"_L1;
     case UserKeyRefreshedSuccessfully:
         return "user_key_refreshed_successfully"_L1;
-    case UserRequesterOtrKeyRefresh:
-        return "user_requested_otr_key_refresh"_L1;
     case VideoConf:
         return "videoconf"_L1;
     case UserBanned:
diff --git a/src/core/messages/systemmessagetypeutil.h b/src/core/messages/systemmessagetypeutil.h
index 46238b2054..2ac223aa39 100644
--- a/src/core/messages/systemmessagetypeutil.h
+++ b/src/core/messages/systemmessagetypeutil.h
@@ -26,7 +26,6 @@ enum SystemMessageType {
     JitsiCallStarted,
     MessageDeleted,
     Pinned,
-    EncryptedMessage,
     UserMuted,
     UserUnmuted,
     SubscriptionRoleAdded,
@@ -53,9 +52,7 @@ enum SystemMessageType {
     RoomAllowedReacting,
     RoomDisallowedReacting,
     UserJoinedTeam,
-    UserJoinedOtr,
     UserKeyRefreshedSuccessfully,
-    UserRequesterOtrKeyRefresh,
     UserUnbanned,
     UserBanned,
     VideoConf,
diff --git a/src/core/model/roommodel.cpp b/src/core/model/roommodel.cpp
index cc60db62fc..364f2b9eb0 100644
--- a/src/core/model/roommodel.cpp
+++ b/src/core/model/roommodel.cpp
@@ -161,9 +161,6 @@ QVariant RoomModel::data(const QModelIndex &index, int role) const
     case RoomModel::RoomIcon:
     case Qt::DecorationRole:
         return r->icon();
-    case RoomModel::RoomOtr:
-        // TODO implement it.
-        return {};
     case RoomModel::RoomUserMentions:
         return r->userMentions();
     case RoomModel::RoomIgnoredUsers:
diff --git a/src/core/model/roommodel.h b/src/core/model/roommodel.h
index 03967c368e..0cf81b2e88 100644
--- a/src/core/model/roommodel.h
+++ b/src/core/model/roommodel.h
@@ -37,7 +37,6 @@ public:
         RoomFavorite,
         RoomSection,
         RoomIcon,
-        RoomOtr,
         RoomUserMentions,
         RoomIgnoredUsers,
         RoomAutotranslateLanguage,
diff --git a/src/core/rocketchatmessage.cpp b/src/core/rocketchatmessage.cpp
index 49134c6e24..e39b71b145 100644
--- a/src/core/rocketchatmessage.cpp
+++ b/src/core/rocketchatmessage.cpp
@@ -230,15 +230,6 @@ RocketChatMessage::RocketChatMessageResult RocketChatMessage::generateMethod(con
     return result;
 }
 
-RocketChatMessage::RocketChatMessageResult RocketChatMessage::streamNotifyUserOtrEnd(const QString &roomId, const QString &userId, quint64 id)
-{
-    const QJsonObject endObject{{u"roomId"_s, roomId}, {u"userId"_s, userId}};
-    QString otrId = roomId;
-    otrId = otrId.remove(userId);
-    const QJsonArray params{u"%1/otr"_s.arg(otrId), u"end"_s, endObject};
-    return generateMethod(u"stream-notify-user"_s, params, id);
-}
-
 RocketChatMessage::RocketChatMessageResult RocketChatMessage::enable2fa(quint64 id)
 {
     const QJsonArray params;
@@ -263,29 +254,6 @@ RocketChatMessage::RocketChatMessageResult RocketChatMessage::validateTempToken2
     return generateMethod(u"2fa:validateTempToken"_s, params, id);
 }
 
-RocketChatMessage::RocketChatMessageResult
-RocketChatMessage::streamNotifyUserOtrHandshake(const QString &userFrom, const QString &userTo, const QString &publicKeys, quint64 id)
-{
-    const QJsonObject endObject{{u"roomId"_s, u"%1%2"_s.arg(userTo, userFrom)}, {u"userId"_s, userTo}, {u"publicKey"_s, publicKeys}};
-    const QJsonArray params{u"%1/otr"_s.arg(userFrom), u"handshake"_s, endObject};
-    return generateMethod(u"stream-notify-user"_s, params, id);
-}
-
-RocketChatMessage::RocketChatMessageResult
-RocketChatMessage::streamNotifyUserOtrAcknowledge(const QByteArray &roomId, const QByteArray &userId, const QString &publicKeys, quint64 id)
-{
-    const QJsonObject acknowledgeObject{{u"roomId"_s, QString::fromLatin1(roomId)}, {u"userId"_s, QString::fromLatin1(userId)}, {u"publicKey"_s, publicKeys}};
-    QString otrId = QString::fromLatin1(roomId);
-    otrId = otrId.remove(QString::fromLatin1(userId));
-    const QJsonArray params{u"%1/otr"_s.arg(otrId), u"acknowledge"_s, acknowledgeObject};
-    return generateMethod(u"stream-notify-user"_s, params, id);
-#if 0
-    {\"id\":\"30\",\"method\":\"stream-notify-user\",\"msg\":\"method\",\"params\":[\"4faACeGzSvG7xMcTy/otr\",\"acknowledge\",{\"publicKey\":\"{\\\"crv\\\":\\\"P-256\\\",\\\"ext\\\":true,\\\"key_ops\\\":[],\\\"kty\\\":\\\"EC\\\",\\\"x\\\":\\\"Jg7HgVygchsJSpGc1N36I7-4xlIF2Y4kBB0cKoT5rW8\\\",\\\"y\\\":\\\"rhdmHfXGihoZI0eBL1lADOm3FGrQ3qO6y2rXuV9YNC8\\\"}\",\"roomId\":\"4faACeGzSvG7xMcTyYbwG4T2uB3wZSZSKB\",\"userId\":\"4faACeGzSvG7xMcTy\"}]}"
-    {\"id\":\"30\",\"method\":\"stream-notify-user\",\"msg\":\"method\",\"params\":[\"4faACeGzSvG7xMcTy/otr\",\"acknowledge\",{\"publicKey\":\"{}\",\"roomId\":\"4faACeGzSvG7xMcTyYbwG4T2uB3wZSZSKB4faACeGzSvG7xMcTy\",\"userId\":\"4faACeGzSvG7xMcTyYbwG4T2uB3wZSZSKB\"}]}
-    {\"msg\":\"method\",\"id\":\"22\",\"method\":\"stream-notify-user\",\"params\":[\"YbwG4T2uB3wZSZSKB/otr\",\"acknowledge\",{\"roomId\":\"4faACeGzSvG7xMcTyYbwG4T2uB3wZSZSKB\",\"userId\":\"4faACeGzSvG7xMcTy\",\"publicKey\":\"{
-#endif
-}
-
 QDebug operator<<(QDebug d, const RocketChatMessage::RocketChatMessageResult &t)
 {
     d.space() << "json:" << t.jsonDocument;
diff --git a/src/core/rocketchatmessage.h b/src/core/rocketchatmessage.h
index 4cb94e7397..cf359bf0ad 100644
--- a/src/core/rocketchatmessage.h
+++ b/src/core/rocketchatmessage.h
@@ -39,14 +39,6 @@ public:
     [[nodiscard]] RocketChatMessage::RocketChatMessageResult
     inputUserAutocomplete(const QByteArray &roomId, const QString &pattern, const QString &exceptions, quint64 id);
 
-    [[nodiscard]] RocketChatMessage::RocketChatMessageResult streamNotifyUserOtrEnd(const QString &userFrom, const QString &userTo, quint64 id);
-
-    [[nodiscard]] RocketChatMessage::RocketChatMessageResult
-    streamNotifyUserOtrHandshake(const QString &userFrom, const QString &userTo, const QString &publicKeys, quint64 id);
-
-    [[nodiscard]] RocketChatMessage::RocketChatMessageResult
-    streamNotifyUserOtrAcknowledge(const QByteArray &roomId, const QByteArray &userId, const QString &publicKeys, quint64 id);
-
     [[nodiscard]] RocketChatMessage::RocketChatMessageResult uploadCustomSound(const QByteArray &sound, quint64 id);
 
     [[nodiscard]] RocketChatMessage::RocketChatMessageResult enable2fa(quint64 id);
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.