summaryrefslogtreecommitdiff
path: root/src/Erebos/Conversation.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-06-23 21:43:56 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-06-24 22:10:58 +0200
commite5d8ca9c124c4f8805bba9212845f0e21de5d9fc (patch)
treeddd83d83591d5cd4f23c593095f101f48a6581ae /src/Erebos/Conversation.hs
parent32d93542af615cd5d7853916623b5c39c54abd1e (diff)
Format chatroom messages with Conversation module
Diffstat (limited to 'src/Erebos/Conversation.hs')
-rw-r--r--src/Erebos/Conversation.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Erebos/Conversation.hs b/src/Erebos/Conversation.hs
index 0e6690e..78774bd 100644
--- a/src/Erebos/Conversation.hs
+++ b/src/Erebos/Conversation.hs
@@ -74,11 +74,15 @@ formatMessage :: TimeZone -> Message -> String
formatMessage tzone = T.unpack . renderPlainText . formatMessageFT tzone
formatMessageFT :: TimeZone -> Message -> FormattedText
-formatMessageFT tzone msg = mconcat
- [ PlainText $ T.pack $ formatTime defaultTimeLocale "[%H:%M] " $ utcToLocalTime tzone $ zonedTimeToUTC $ messageTime msg
- , maybe "<unnamed>" PlainText $ idName $ messageFrom msg
- , maybe "" ((": " <>) . PlainText) $ messageText msg
+formatMessageFT tzone msg = mconcat $ concat
+ [ [ PlainText $ T.pack $ formatTime defaultTimeLocale "[%H:%M] " $ utcToLocalTime tzone $ zonedTimeToUTC $ messageTime msg ]
+ , [ maybe "<unnamed>" PlainText $ idName $ messageFrom msg ]
+ , map formatExtra $ withMessage convMessageExtra msg
+ , [ maybe "" ((": " <>) . PlainText) $ messageText msg ]
]
+ where
+ formatExtra UserJoined = " " <> withStyle (setForegroundColor BrightMagenta noStyle) (plainText "joined")
+ formatExtra UserLeft = " " <> withStyle (setForegroundColor Magenta noStyle) (plainText "left")
data Conversation