summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2012-02-26 14:15:49 +0100
committerJulien Dessaux2012-02-26 14:15:49 +0100
commitc74d199047825b737cb00ca83360f9d410af6a75 (patch)
treea47fb6350bdbbae1586124d293ffcdab83534f02
parentUpdated for the latest acidstate api. (diff)
downloadhsbot-c74d199047825b737cb00ca83360f9d410af6a75.tar.gz
hsbot-c74d199047825b737cb00ca83360f9d410af6a75.tar.bz2
hsbot-c74d199047825b737cb00ca83360f9d410af6a75.zip
Added support for IRC server password
-rw-r--r--Hsbot/Config.hs1
-rw-r--r--Hsbot/Core.hs3
-rw-r--r--Hsbot/Types.hs1
3 files changed, 5 insertions, 0 deletions
diff --git a/Hsbot/Config.hs b/Hsbot/Config.hs
index b8dad68..4539090 100644
--- a/Hsbot/Config.hs
+++ b/Hsbot/Config.hs
@@ -16,6 +16,7 @@ defaultConfig = Config
, configTLS = noSSL
, configAddress = "localhost"
, configPort = PortNumber 6667
+ , configPassword = Nothing
, configAccess = []
, configChannels = ["#hsbot"]
, configNicknames = ["hsbot"]
diff --git a/Hsbot/Core.hs b/Hsbot/Core.hs
index 89f4471..1668f62 100644
--- a/Hsbot/Core.hs
+++ b/Hsbot/Core.hs
@@ -70,6 +70,9 @@ runHsbot die_msgs = do
config = envConfig env
nickname = head $ configNicknames config
channels = configChannels config
+ case configPassword config of
+ Just pass -> liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.Message Nothing "PASS" [pass]
+ Nothing -> return ()
liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.nick nickname
liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.user nickname hostname "*" (configRealname config)
-- Then we join channels
diff --git a/Hsbot/Types.hs b/Hsbot/Types.hs
index 3201caf..d138402 100644
--- a/Hsbot/Types.hs
+++ b/Hsbot/Types.hs
@@ -74,6 +74,7 @@ data Config = Config
, configTLS :: TLSConfig
, configAddress :: String
, configPort :: PortID
+ , configPassword :: Maybe String
, configAccess :: [AccessList]
, configChannels :: [String]
, configNicknames :: [String]