From 0096226aebc6f3ab0ec122e92dab40be5a863ec9 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 6 Mar 2023 19:21:23 -0500 Subject: [PATCH] Implement unknown msgtype functionality --- resources/qml/delegates/MessageDelegate.qml | 16 +++++++++++++++- src/Utils.cpp | 3 +++ src/Utils.h | 3 ++- src/timeline/TimelineModel.cpp | 17 ++++++++++++++--- src/timeline/TimelineModel.h | 3 ++- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml index d298fa4e..9126186e 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml @@ -51,7 +51,7 @@ Item { width: parent.width? parent.width: 0 // this should get rid of "cannot read property 'width' of null" DelegateChoice { - roleValue: MtxEvent.UnknownMessage + roleValue: MtxEvent.UnknownEvent Placeholder { typeString: d.typeString @@ -101,6 +101,20 @@ Item { } + DelegateChoice { + roleValue: MtxEvent.UnknownMessage + + TextMessage { + formatted: d.formattedBody + body: d.body + isOnlyEmoji: d.isOnlyEmoji + isReply: d.isReply + keepFullText: d.keepFullText + metadataWidth: d.metadataWidth + } + + } + DelegateChoice { roleValue: MtxEvent.ConfettiMessage diff --git a/src/Utils.cpp b/src/Utils.cpp index c5b2abd1..eca5cb29 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -221,6 +221,7 @@ utils::getMessageDescription(const TimelineEvent &event, using Image = mtx::events::RoomEvent; using Notice = mtx::events::RoomEvent; using Text = mtx::events::RoomEvent; + using Unknown = mtx::events::RoomEvent; using Video = mtx::events::RoomEvent; using Confetti = mtx::events::RoomEvent; using CallInvite = mtx::events::RoomEvent; @@ -241,6 +242,8 @@ utils::getMessageDescription(const TimelineEvent &event, return createDescriptionInfo(event, localUser, displayName); } else if (std::holds_alternative(event)) { return createDescriptionInfo(event, localUser, displayName); + } else if (std::holds_alternative(event)) { + return createDescriptionInfo(event, localUser, displayName); } else if (std::holds_alternative