diff options
Diffstat (limited to 'src/Erebos/Conversation.hs')
| -rw-r--r-- | src/Erebos/Conversation.hs | 12 |
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 |