Archived
1
0
Fork 0

Fixed some types' functions.

This commit is contained in:
Julien Dessaux 2010-01-22 18:45:20 +01:00
parent 53870767c3
commit 047a10bc9b
4 changed files with 9 additions and 9 deletions

View file

@ -14,9 +14,9 @@ defaultPlugins = [ "Ping", "Quote" ]
-- | User server -- | User server
kro :: IrcServer kro :: IrcServer
kro = IrcServer kro = IrcServer
{ address = "kro.corp" { serverAddress = "perseus"
, port = PortNumber 6667 , serverPort = PortNumber 6667
, channels = ["#shbot"] , joinChannels = ["#shbot"]
, nickname = "hsbot" , nickname = "hsbot"
, password = "" , password = ""
, realname = "The One True bot, with it's haskell soul." , realname = "The One True bot, with it's haskell soul."

View file

@ -20,10 +20,10 @@ import Hsbot.Utils
-- Connect to the server and return the initial bot state -- Connect to the server and return the initial bot state
connectServer :: IrcServer -> IO Bot connectServer :: IrcServer -> IO Bot
connectServer server = do connectServer server = do
let name = address server let name = serverAddress server
starttime <- getClockTime starttime <- getClockTime
putStr $ "Connecting to " ++ name ++ "... " putStr $ "Connecting to " ++ name ++ "... "
handle <- connectTo name $ port server handle <- connectTo name $ serverPort server
hSetBuffering handle NoBuffering hSetBuffering handle NoBuffering
putStrLn "done." putStrLn "done."
putStr $ "Opening server communication channel... " putStr $ "Opening server communication channel... "

View file

@ -19,7 +19,7 @@ initServer = do
sendstr $ serializeIrcMsg $ IrcMsg Nothing "USER" [(nickname server), "0", "*", (realname server)] sendstr $ serializeIrcMsg $ IrcMsg Nothing "USER" [(nickname server), "0", "*", (realname server)]
when (not . null $ password server) $ do when (not . null $ password server) $ do
sendstr $ serializeIrcMsg $ IrcMsg Nothing "PRIVMSG" ["nickserv", "identify", (password server)] sendstr $ serializeIrcMsg $ IrcMsg Nothing "PRIVMSG" ["nickserv", "identify", (password server)]
mapM_ joinChan (channels server) mapM_ joinChan (joinChannels server)
-- | Run a server -- | Run a server
runServer :: IrcBot () runServer :: IrcBot ()

View file

@ -29,9 +29,9 @@ data Config = Config
-- | An IRC server -- | An IRC server
data IrcServer = IrcServer data IrcServer = IrcServer
{ address :: String -- the server's address { serverAddress :: String -- the server's address
, port :: PortID -- the server's port , serverPort :: PortID -- the server's port
, channels :: [String] -- a list of channels to join , joinChannels :: [String] -- a list of channels to join
, nickname :: String -- the hsbot's nickname , nickname :: String -- the hsbot's nickname
, password :: String -- the hsbot's password, optional , password :: String -- the hsbot's password, optional
, realname :: String -- the hsbot's real name, optional , realname :: String -- the hsbot's real name, optional