Added support for IRC server password
This commit is contained in:
parent
5e3b91929d
commit
c74d199047
3 changed files with 5 additions and 0 deletions
|
@ -16,6 +16,7 @@ defaultConfig = Config
|
||||||
, configTLS = noSSL
|
, configTLS = noSSL
|
||||||
, configAddress = "localhost"
|
, configAddress = "localhost"
|
||||||
, configPort = PortNumber 6667
|
, configPort = PortNumber 6667
|
||||||
|
, configPassword = Nothing
|
||||||
, configAccess = []
|
, configAccess = []
|
||||||
, configChannels = ["#hsbot"]
|
, configChannels = ["#hsbot"]
|
||||||
, configNicknames = ["hsbot"]
|
, configNicknames = ["hsbot"]
|
||||||
|
|
|
@ -70,6 +70,9 @@ runHsbot die_msgs = do
|
||||||
config = envConfig env
|
config = envConfig env
|
||||||
nickname = head $ configNicknames config
|
nickname = head $ configNicknames config
|
||||||
channels = configChannels 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.nick nickname
|
||||||
liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.user nickname hostname "*" (configRealname config)
|
liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.user nickname hostname "*" (configRealname config)
|
||||||
-- Then we join channels
|
-- Then we join channels
|
||||||
|
|
|
@ -74,6 +74,7 @@ data Config = Config
|
||||||
, configTLS :: TLSConfig
|
, configTLS :: TLSConfig
|
||||||
, configAddress :: String
|
, configAddress :: String
|
||||||
, configPort :: PortID
|
, configPort :: PortID
|
||||||
|
, configPassword :: Maybe String
|
||||||
, configAccess :: [AccessList]
|
, configAccess :: [AccessList]
|
||||||
, configChannels :: [String]
|
, configChannels :: [String]
|
||||||
, configNicknames :: [String]
|
, configNicknames :: [String]
|
||||||
|
|
Reference in a new issue