Support RoomMessageNotice events
This commit is contained in:
parent
3b2ab048fb
commit
2fd2806514
2
TODO.md
2
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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -9,7 +9,7 @@ HRowLayout {
|
|||
layoutDirection: onRight ? Qt.RightToLeft: Qt.LeftToRight
|
||||
|
||||
|
||||
readonly property string eventSender:
|
||||
readonly property string eventSender: // XXX
|
||||
hideNameLine ? "" : (
|
||||
"<div class='sender'>" +
|
||||
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),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user