core: add custom chat event

This commit is contained in:
Evgeny Poberezkin
2025-05-23 10:40:04 +01:00
parent 1b75ca5258
commit e8968653ef
2 changed files with 2 additions and 0 deletions

View File

@@ -854,6 +854,7 @@ data ChatEvent
| CEvtChatErrors {chatErrors :: [ChatError]}
| CEvtTimedAction {action :: String, durationMilliseconds :: Int64}
| CEvtTerminalEvent TerminalEvent
| CEvtCustomChatEvent {user_ :: Maybe User, response :: Text}
deriving (Show)
data TerminalEvent

View File

@@ -532,6 +532,7 @@ chatEventToView hu ChatConfig {logLevel, showReactions, showReceipts, testView}
ttyUser u ["sent file " <> sShow fileId <> " (" <> plain fileName <> ") error: " <> sShow e]
TERcvFileSubError u RcvFileTransfer {fileId, fileInvitation = FileInvitation {fileName}} e ->
ttyUser u ["received file " <> sShow fileId <> " (" <> plain fileName <> ") error: " <> sShow e]
CEvtCustomChatEvent u r -> ttyUser' u $ map plain $ T.lines r
where
ttyUser :: User -> [StyledString] -> [StyledString]
ttyUser user@User {showNtfs, activeUser, viewPwdHash} ss