From 864a364da99a0ec05f08d7cfbad4abde416a0b06 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 24 Apr 2011 23:08:06 +0200 Subject: Some API refactoring. I can't say how I hate the Types.hs thing in Haskell! --- Hsbot/Types.hs | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'Hsbot/Types.hs') diff --git a/Hsbot/Types.hs b/Hsbot/Types.hs index 28ad430..e906a10 100644 --- a/Hsbot/Types.hs +++ b/Hsbot/Types.hs @@ -3,23 +3,24 @@ module Hsbot.Types , BotState (..) , BotStatus (..) , BotEnv (..) + , Config (..) , Env , Message (..) , Plugin , PluginId (..) , PluginState (..) + , TLSConfig (..) ) where import Control.Concurrent import qualified Data.Map as M import Control.Monad.Reader import Control.Monad.State +import Network +import qualified Network.IRC as IRC import Network.TLS import System.IO -import Hsbot.Config -import Hsbot.Message - -- The bot environment type Env = ReaderT BotEnv @@ -57,5 +58,30 @@ data PluginId = PluginId , pluginEp :: PluginState -> IO () } +-- Messaging +data Message = IncomingMsg IRC.Message + | OutgoingMsg IRC.Message + data BotStatus = BotContinue | BotExit | BotReload | BotRestart deriving (Show) +-- Config +data Config = Config + { configErrors :: Maybe String + , configTLS :: TLSConfig + , configAddress :: String + , configPort :: PortID + , configChannels :: [String] + , configNicknames :: [String] + , configRealname :: String + , configPlugins :: [(String, Chan Message -> Chan Message -> IO ())] + } + +data TLSConfig = TLSConfig + { sslOn :: Bool + , sslCert :: String + , sslKey :: String + , sslVersions :: [Network.TLS.Version] + , sslCiphers :: [Network.TLS.Cipher] + , sslVerify :: Bool + } deriving (Show) + -- cgit v1.2.3