diff --git a/TODO.md b/TODO.md index ee4f3567..63328357 100644 --- a/TODO.md +++ b/TODO.md @@ -16,8 +16,6 @@ - EventLink - EventFile & Downloading (right click on media > save as...) -- RoomMessageNotice - - Refactoring - Room header elide detection - Use HBox for Profile diff --git a/src/python/nio_callbacks.py b/src/python/nio_callbacks.py index a23fcb05..a9b1f16d 100644 --- a/src/python/nio_callbacks.py +++ b/src/python/nio_callbacks.py @@ -88,13 +88,12 @@ class NioCallbacks: await self.client.register_nio_event(room, ev, content=co) + async def onRoomMessageNotice(self, room, ev) -> None: + await self.onRoomMessageText(room, ev) + + async def onRoomMessageEmote(self, room, ev) -> None: - co = HTML_FILTER.filter_inline( - ev.formatted_body - if ev.format == "org.matrix.custom.html" else - utils.plain2html(ev.body), - ) - await self.client.register_nio_event(room, ev, content=co) + await self.onRoomMessageText(room, ev) async def onRoomMessageUnknown(self, room, ev) -> None: diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index e1836392..bf342745 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -9,7 +9,7 @@ HRowLayout { layoutDirection: onRight ? Qt.RightToLeft: Qt.LeftToRight - readonly property string eventSender: + readonly property string eventSender: // XXX hideNameLine ? "" : ( "
" + Utils.coloredNameHtml(model.sender_name, model.sender_id) + @@ -80,7 +80,10 @@ HRowLayout { leftPadding: eventContent.spacing rightPadding: leftPadding - color: theme.chat.message.body + color: model.event_type === "RoomMessageNotice" ? + theme.chat.message.noticeBody : + theme.chat.message.body + wrapMode: TextEdit.Wrap textFormat: Text.RichText text: @@ -140,6 +143,15 @@ HRowLayout { color: isOwn? theme.chat.message.ownBackground : theme.chat.message.background + + Rectangle { + visible: model.event_type === "RoomMessageNotice" + width: theme.chat.message.noticeLineWidth + height: parent.height + color: Utils.nameColor( + model.sender_name || model.sender_id.substring(1), + ) + } } } diff --git a/src/themes/Default.qpl b/src/themes/Default.qpl index 9ce77c6c..bc5a8c79 100644 --- a/src/themes/Default.qpl +++ b/src/themes/Default.qpl @@ -328,6 +328,9 @@ chat: color body: colors.text color date: colors.dimText + color noticeBody: colors.halfDimText + int noticeLineWidth: 1 + color quote: hsluv(135, colors.saturation * 2.25, 75) color link: colors.link color code: colors.code