summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hirc.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/hirc.hs b/hirc.hs
index b6ce8cf..6a629fd 100644
--- a/hirc.hs
+++ b/hirc.hs
@@ -63,18 +63,18 @@ run = do
Config{..} <- asks config
write "NICK" nick
write "USER" (nick++" 0 * :hirc bot")
- asks socket >>= listen
+ ask >>= listen
-- Process each line from the server
-listen :: Handle -> Net ()
-listen h = forever $ do
- c@Config{..} <- asks config
- let filename = server <> (':' : show port)
+listen :: Bot -> Net ()
+listen Bot{config=c@Config{..},socket=h} = forever $ do
s <- init `fmap` io (hGetLine h)
io (putStrLn s)
case parse P.message filename s of
Right m -> eval m
x -> io $ putStrLn $ show x
+ where
+ filename = server <> (':' : show port)
-- Dispatch a command
eval :: Message -> Net ()