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) --- HsbotMaster/Hsbot/Types.hs | 72 ---------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 HsbotMaster/Hsbot/Types.hs (limited to 'HsbotMaster/Hsbot/Types.hs') diff --git a/HsbotMaster/Hsbot/Types.hs b/HsbotMaster/Hsbot/Types.hs deleted file mode 100644 index ce1432b..0000000 --- a/HsbotMaster/Hsbot/Types.hs +++ /dev/null @@ -1,72 +0,0 @@ -module Hsbot.Types - ( Bot - , BotMsg (..) - , BotResumeData - , BotState (..) - , BotStatus (..) - , ExitMsg (..) - , Msg (..) - , Plugin - , PluginState (..) - , RebootMsg (..) - , ResumeData - , ResumeMsg (..) - ) where - -import Control.Concurrent -import Control.Monad.State -import qualified Data.Map as M -import Data.Time -import System.IO - --- | The Bot monad -type Bot = StateT BotState IO - --- | An Hsbot state -data BotState = BotState - { botStartTime :: UTCTime -- the bot's uptime - , botPlugins :: M.Map String (PluginState, MVar (), ThreadId) -- Loaded plugins - , botChan :: Chan BotMsg -- the bot's communication channel - , botResumeData :: MVar BotResumeData -- the necessary data to resume the bot's operations on reboot - } - --- | how we exit from the botLoop -data BotStatus = BotExit | BotReboot | BotContinue deriving (Eq) - --- | Types to factorise resume data -type ResumeData = M.Map String String -type BotResumeData = M.Map String ResumeData - --- | The Plugin monad -type Plugin = StateT PluginState IO - --- | A plugin state -data PluginState = PluginState - { pluginName :: String -- The plugin's name - , pluginChan :: Chan BotMsg -- The plugin chan - , pluginHandles :: M.Map String Handle -- the plugins's handles - } - --- | A hsbot message -data Msg = Msg - { msgType :: String -- the message type - , msgFrom :: String -- who issues it - , msgTo :: String -- who it is destinated to - , msgStuff :: String -- the message to be transfered - } deriving (Show) - -data ResumeMsg = ResMsg - { resMsgFrom :: String - , resMsgData :: ResumeData - } deriving (Show) - -data RebootMsg = RebootMsg - { rebMsgFrom :: String - } deriving (Show) - -data ExitMsg = ExitMsg - { exiMsgFrom :: String - } deriving (Show) - -data BotMsg = IntMsg Msg | UpdMsg ResumeMsg | RebMsg RebootMsg | ExiMsg ExitMsg deriving (Show) - -- cgit v1.2.3