diff options
author | Julien Dessaux | 2010-05-16 00:01:00 +0200 |
---|---|---|
committer | Julien Dessaux | 2010-05-16 00:01:00 +0200 |
commit | c1662ba7b982a8502dc9f32031b7cb518df7f60e (patch) | |
tree | f00dbd9cb39bf0fbc20949105ea2b93d9e868070 /Hsbot/IRC.hs | |
parent | Added the quote module. (diff) | |
download | hsbot-c1662ba7b982a8502dc9f32031b7cb518df7f60e.tar.gz hsbot-c1662ba7b982a8502dc9f32031b7cb518df7f60e.tar.bz2 hsbot-c1662ba7b982a8502dc9f32031b7cb518df7f60e.zip |
Rewrote nearly everything!v0.2.0
* Rewrote the whole architecture to achieve extreme modularity
* Added the ability to build a multiprotocol bot
* Added cabal integration
* Added configuration handling the XMonad style
* Added configuration in ~/.hsbot
* Refactored many many named and functions
* Refactored data structures
* Cleaned a big bunch of stuff
Diffstat (limited to 'Hsbot/IRC.hs')
-rw-r--r-- | Hsbot/IRC.hs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/Hsbot/IRC.hs b/Hsbot/IRC.hs deleted file mode 100644 index 4a0e5f8..0000000 --- a/Hsbot/IRC.hs +++ /dev/null @@ -1,45 +0,0 @@ -module Hsbot.IRC - ( initServer - , runServer - ) where - -import Control.Concurrent.Chan -import Control.Monad.State - -import Hsbot.Command -import Hsbot.IRCParser -import Hsbot.Types -import Hsbot.Utils - --- | Setup a newly connected server by sending nick and join stuff -initServer :: IrcBot () -initServer = do - server <- gets serverConfig - sendstr . serializeIrcMsg $ IrcMsg Nothing "NICK" [(nickname server)] - sendstr . serializeIrcMsg $ IrcMsg Nothing "USER" [(nickname server), "0", "*", (realname server)] - when (not . null $ password server) $ do - sendstr . serializeIrcMsg $ IrcMsg Nothing "PRIVMSG" ["nickserv", "identify", (password server)] - mapM_ joinChan (joinChannels server) - --- | Run a server -runServer :: IrcBot () -runServer = forever $ do - chan <- gets botChannel - let input = readChan chan - msg <- liftIO input - case msg of - InputMsg inputMsg -> dispatchMessage $ InputMsg inputMsg - OutputMsg outputMsg -> sendstr (serializeIrcMsg outputMsg) - InternalCmd internalCmd -> processInternalCommand $ InternalCmd internalCmd - --- | Joins a chan -joinChan :: String -> IrcBot () -joinChan name = do - bot <- get - let oldChannels = chans bot - newChannel = Channel name - (nickname $ serverConfig bot) - (administrators $ serverConfig bot) - sendstr . serializeIrcMsg $ IrcMsg Nothing "JOIN" [name] - put $ bot { chans = newChannel : oldChannels } - |