summaryrefslogtreecommitdiff
path: root/HsbotIrcBot/Hsbot/Irc/Server.hs
diff options
context:
space:
mode:
authorJulien Dessaux2011-04-13 20:15:55 +0200
committerJulien Dessaux2011-04-13 20:15:55 +0200
commitff07633fb8f81577ffec409cbf0a3c7361990f6c (patch)
tree5021a2e13f878c6b29ad3ec835f694d0726b7e9c /HsbotIrcBot/Hsbot/Irc/Server.hs
parentRegressed from parsec3 to parsec2 to solve a cabal install weird dependency p... (diff)
downloadhsbot-ff07633fb8f81577ffec409cbf0a3c7361990f6c.tar.gz
hsbot-ff07633fb8f81577ffec409cbf0a3c7361990f6c.tar.bz2
hsbot-ff07633fb8f81577ffec409cbf0a3c7361990f6c.zip
Began a big refactoring/rewriting (again)
Diffstat (limited to '')
-rw-r--r--HsbotIrcBot/Hsbot/Irc/Server.hs35
1 files changed, 0 insertions, 35 deletions
diff --git a/HsbotIrcBot/Hsbot/Irc/Server.hs b/HsbotIrcBot/Hsbot/Irc/Server.hs
deleted file mode 100644
index 3c20e6d..0000000
--- a/HsbotIrcBot/Hsbot/Irc/Server.hs
+++ /dev/null
@@ -1,35 +0,0 @@
-module Hsbot.Irc.Server
- ( initServerConnection
- , sendIrcMsg
- ) where
-
-import Control.Concurrent.Chan
-import Control.Monad.State
-
-import Hsbot.Irc.Config
-import Hsbot.Irc.Message
-import Hsbot.Irc.Types
-
--- | Setup a newly connected server by sending nick and join stuff
-initServerConnection :: IrcConfig -> IrcServer ()
-initServerConnection config = do
- sendIrcMsg $ IrcMsg Nothing "NICK" [(ircConfigNickname config)]
- sendIrcMsg $ IrcMsg Nothing "USER" [(ircConfigNickname config), "0", "*", (ircConfigRealname config)]
- when (not . null $ ircConfigPassword config) $ do
- sendIrcMsg $ IrcMsg Nothing "PRIVMSG" ["nickserv", "identify", (ircConfigPassword config)]
- mapM_ joinChan (ircConfigChannels config)
-
--- | Joins a chan
-joinChan :: String -> IrcServer ()
-joinChan channel = do
- ircServer <- get
- let oldChannels = ircServerChannels ircServer
- sendIrcMsg $ IrcMsg Nothing "JOIN" [channel]
- put $ ircServer { ircServerChannels = channel : oldChannels }
-
--- | Sends an IrcMsg
-sendIrcMsg :: IrcMsg -> IrcServer ()
-sendIrcMsg ircMsg = do
- chan <- gets ircServerChan
- liftIO $ writeChan chan (OutIrcMsg ircMsg)
-