From 237aa5bfb1b15735658f6623386746d1593add9b Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 5 Apr 2014 13:21:50 -0400 Subject: Fixed stair-stepping. --- Presence/ConsoleWriter.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Presence/ConsoleWriter.hs b/Presence/ConsoleWriter.hs index 5ed4f1df..b5040ba7 100644 --- a/Presence/ConsoleWriter.hs +++ b/Presence/ConsoleWriter.hs @@ -230,6 +230,7 @@ readEnvFile var file = fmap parse $ readFile file writeActiveTTY :: ConsoleWriter -> Stanza -> IO Bool writeActiveTTY cw msg = do putStrLn $ "writeActiveTTY" + -- TODO: Do not deliver if the detination user does not own the active tty! (tty, mbu) <- atomically $ do num <- readTVar $ csActiveTTY cw utmp <- readTVar $ csUtmp cw @@ -281,7 +282,7 @@ deliverTerminalMessage cw tty utmp msg = do t <- messageText msg return $ Text.unpack $ case stanzaFrom msg of - Just from -> from <> " says...\r\n" <> crlf t <> "\r\n" + Just from -> "\r\n" <> from <> " says...\r\n" <> crlf t <> "\r\n" Nothing -> crlf t <> "\r\n" writeFile (Text.unpack tty) text return True -- return True if a message was delivered @@ -289,6 +290,7 @@ deliverTerminalMessage cw tty utmp msg = do -- | Deliver the given message to all a user's PTYs. writeAllPty :: ConsoleWriter -> Stanza -> IO Bool writeAllPty cw msg = do + -- TODO: filter only ptys owned by the destination user. us <- atomically $ readTVar (csUtmp cw) let ptys = Map.filterWithKey ispty us ispty k _ = "pts/" `Text.isPrefixOf` k -- cgit v1.2.3