Some API refactoring.
I can't say how I hate the Types.hs thing in Haskell!
This commit is contained in:
parent
d4be110200
commit
864a364da9
7 changed files with 47 additions and 51 deletions
|
@ -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)
|
||||
|
||||
|
|
Reference in a new issue