From ff07633fb8f81577ffec409cbf0a3c7361990f6c Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 13 Apr 2011 20:15:55 +0200 Subject: Began a big refactoring/rewriting (again) --- Hsbot/Config.hs | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Hsbot/Config.hs (limited to 'Hsbot/Config.hs') diff --git a/Hsbot/Config.hs b/Hsbot/Config.hs new file mode 100644 index 0000000..7ab23f5 --- /dev/null +++ b/Hsbot/Config.hs @@ -0,0 +1,63 @@ +module Hsbot.Config + ( Config (..) + , TLSConfig (..) + , defaultConfig + , defaultTLSConfig + , noSSL + ) where + +import Network +import Network.TLS +import Network.TLS.Extra + +data Config = Config + { configErrors :: Maybe String + , configTLS :: TLSConfig + , configAddress :: String + , configPort :: PortID + , configChannels :: [String] + , configNicknames :: [String] + , configRealname :: String + , configPlugins :: [String] + } + +defaultConfig :: Config +defaultConfig = Config + { configErrors = Nothing + , configTLS = noSSL + , configAddress = "localhost" + , configPort = PortNumber 6667 + , configChannels = ["#hsbot"] + , configNicknames = ["hsbot"] + , configRealname = "The One True bot, with it's haskell soul." + , configPlugins = ["Ping", "Core"] } + +data TLSConfig = TLSConfig + { sslOn :: Bool + , sslCert :: String + , sslKey :: String + , sslVersions :: [Network.TLS.Version] + , sslCiphers :: [Network.TLS.Cipher] + , sslVerify :: Bool + } deriving (Show) + +defaultTLSConfig :: TLSConfig +defaultTLSConfig = TLSConfig + { sslOn = True + , sslCert = "" + , sslKey = "" + , sslVersions = [SSL3, TLS10, TLS11, TLS12] + , sslCiphers = [ cipher_null_MD5 + , cipher_null_SHA1 + , cipher_AES128_SHA1 + , cipher_AES256_SHA1 + , cipher_RC4_128_MD5 + , cipher_RC4_128_SHA1 + , cipher_AES256_SHA1 + , cipher_AES128_SHA256 + , cipher_AES256_SHA256 ] + , sslVerify = True } + +noSSL :: TLSConfig +noSSL = defaultTLSConfig { sslOn = False } + -- cgit v1.2.3