|
|
|
@ -40,7 +40,7 @@ listen = forever $ do
@@ -40,7 +40,7 @@ listen = forever $ do
|
|
|
|
|
line <- liftIO $ hGetLine h |
|
|
|
|
let tokens = words line |
|
|
|
|
-- Debug print |
|
|
|
|
liftIO $ putStrLn line |
|
|
|
|
liftIO $ putStrLn $ "< " ++ line |
|
|
|
|
tokenDispatch (parseUser $ tail line) (parseChannel tokens) tokens |
|
|
|
|
where parseUser str = username |
|
|
|
|
where username = getName str |
|
|
|
@ -75,7 +75,7 @@ tokenDispatch (Just username) (Just chn) ts = if elem "PRIVMSG" ts
@@ -75,7 +75,7 @@ tokenDispatch (Just username) (Just chn) ts = if elem "PRIVMSG" ts
|
|
|
|
|
"!tz" -> if "!tz" == last tokens |
|
|
|
|
then timezone chn username |
|
|
|
|
else timezone chn $ head $ tail tokens |
|
|
|
|
"!eval" -> evalScheme chn $ join $ intersperse " " $ tail tokens |
|
|
|
|
-- "!eval" -> evalScheme chn $ join $ intersperse " " $ tail tokens |
|
|
|
|
"!rollcall" -> rollcall chn |
|
|
|
|
"!anna" -> anna chn |
|
|
|
|
_ -> return () |
|
|
|
@ -154,7 +154,9 @@ anna = rollcall
@@ -154,7 +154,9 @@ anna = rollcall
|
|
|
|
|
write :: String -> String -> Net () |
|
|
|
|
write cmd args = do |
|
|
|
|
h <- asks socket |
|
|
|
|
liftIO $ hPutStr h $ cmd ++ " " ++ args ++ "\r\n" |
|
|
|
|
liftIO $ hPutStr h $ output |
|
|
|
|
liftIO $ putStr $ "> " ++ output |
|
|
|
|
where output = cmd ++ " " ++ args ++ "\r\n" |
|
|
|
|
|
|
|
|
|
sendNick :: Net () |
|
|
|
|
sendNick = write "NICK" name |
|
|
|
|