summaryrefslogtreecommitdiff
path: root/Hsbot/IRC.hs
diff options
context:
space:
mode:
authorJulien Dessaux2009-08-07 00:10:45 +0200
committerJulien Dessaux2009-08-07 00:10:45 +0200
commit2f270f8bdf0e5f226e9e54881ec71a2bde465b71 (patch)
tree7e127a649f508554ee36d036f5fae34028cd8dfa /Hsbot/IRC.hs
parentAdded IRC connection and initialisation stuff. (diff)
downloadhsbot-2f270f8bdf0e5f226e9e54881ec71a2bde465b71.tar.gz
hsbot-2f270f8bdf0e5f226e9e54881ec71a2bde465b71.tar.bz2
hsbot-2f270f8bdf0e5f226e9e54881ec71a2bde465b71.zip
Refactored some minor stuff
Diffstat (limited to '')
-rw-r--r--Hsbot/IRC.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/Hsbot/IRC.hs b/Hsbot/IRC.hs
index ead044c..d397456 100644
--- a/Hsbot/IRC.hs
+++ b/Hsbot/IRC.hs
@@ -25,14 +25,15 @@ data IrcInput = Cmd User Channel (Command, Maybe String) -- a regular command
deriving (Eq,Show)
-- | Data that can go over the remote channel
-data IrcOutput = Str String -- a regular string
+data IrcOutput = Str String -- a regular string
| Quit (IrcServer, Handle) -- a quit message from a server
| Join (IrcServer, Channel) -- joined a channel
| Part (IrcServer, Channel) -- parted the channel
- | Reboot -- reboot message sent
- | Nil -- signifies thread death, only happens after reboot
+ | Reboot -- reboot message sent
+ | Nil -- signifies thread death, only happens after reboot
deriving (Eq,Show)
+-- | Parses an IrcInput
parseIrcMsg :: String -> IrcInput
parseIrcMsg _ = Err "Parsing not yet implemented"
@@ -48,9 +49,9 @@ connectServer server = do
-- | Setup a newly connected server by sending nick and join stuff
initServer :: (IrcServer, Handle) -> IO ()
initServer (server, handle) = do
- sendstr handle (IRC.encode $ IRC.nick (nickname server))
+ sendstr handle (IRC.encode . IRC.nick $ nickname server)
sendstr handle (IRC.encode $ IRC.user (nickname server) "0" "*" (realname server))
- when (not . null $ (password server)) $ do
+ when (not . null $ password server) $ do
sendstr handle (IRC.encode $ IRC.privmsg "nickserv" ("identify" ++ (password server)))
mapM_ (sendstr handle . IRC.encode . IRC.joinChan) (channels server)
return ()