summaryrefslogtreecommitdiff
path: root/Presence
diff options
context:
space:
mode:
Diffstat (limited to 'Presence')
-rw-r--r--Presence/ConsoleWriter.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Presence/ConsoleWriter.hs b/Presence/ConsoleWriter.hs
index e295a72b..2a77394f 100644
--- a/Presence/ConsoleWriter.hs
+++ b/Presence/ConsoleWriter.hs
@@ -237,6 +237,12 @@ deliverGUIMessage cw tty utmp msg = do
237 exitImmediately ExitSuccess 237 exitImmediately ExitSuccess
238 return True 238 return True
239 239
240crlf :: Text -> Text
241crlf t = Text.unlines $ map cr (Text.lines t)
242 where
243 cr t | Text.last t == '\r' = t
244 | otherwise = t <> "\r"
245
240deliverTerminalMessage cw tty utmp msg = do 246deliverTerminalMessage cw tty utmp msg = do
241 mode <- fmap fileMode (getFileStatus $ Text.unpack tty) 247 mode <- fmap fileMode (getFileStatus $ Text.unpack tty)
242 let mesgy = mode .&. 0o020 /= 0 -- verify mode g+w 248 let mesgy = mode .&. 0o020 /= 0 -- verify mode g+w
@@ -245,8 +251,8 @@ deliverTerminalMessage cw tty utmp msg = do
245 t <- messageText msg 251 t <- messageText msg
246 return $ Text.unpack 252 return $ Text.unpack
247 $ case stanzaFrom msg of 253 $ case stanzaFrom msg of
248 Just from -> from <> " says...\n" <> t <> "\n" 254 Just from -> from <> " says...\r\n" <> crlf t <> "\r\n"
249 Nothing -> t <> "\n" 255 Nothing -> crlf t <> "\r\n"
250 writeFile (Text.unpack tty) text 256 writeFile (Text.unpack tty) text
251 return True -- return True if a message was delivered 257 return True -- return True if a message was delivered
252 258