From 37eb3fc850cb28bcf72d971b4fff99902bbce811 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 29 Apr 2017 15:13:44 -0400 Subject: use developer control window to tell when write access is granted --- ControlWindow.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ControlWindow.hs') diff --git a/ControlWindow.hs b/ControlWindow.hs index 02cffd6..edd493e 100644 --- a/ControlWindow.hs +++ b/ControlWindow.hs @@ -29,6 +29,10 @@ import Prelude winDesc :: String winDesc = "debug-me session control and chat window" +displayInControlWindow :: TMChan ControlInput -> String -> IO () +displayInControlWindow ichan msg = atomically $ + writeTMChan ichan (ControlWindowMessage msg) + controlWindow :: ControlOpts -> IO () controlWindow _ = do putStrLn $ "** " ++ winDesc @@ -92,6 +96,9 @@ displayInput ochan ichan promptchan responsechan = loop where loop = go =<< atomically (readTMChan ichan) go Nothing = return () + go (Just (ControlWindowMessage m)) = do + putStrLn m + loop go (Just (ControlInputAction (SessionKey k))) = do askToAllow ochan promptchan responsechan k loop -- cgit v1.2.3