diff options
author | Julien Dessaux | 2010-05-28 22:39:45 +0200 |
---|---|---|
committer | Julien Dessaux | 2010-05-28 22:39:45 +0200 |
commit | c506c58e925383a6a19c82550d1bb458bc504f99 (patch) | |
tree | 5ff9e1beefd8058b4e791b135f2aaaf641fe2d4b /Hsbot/Types.hs | |
parent | Cleaned that ugly update message handling and added a reboot command to the i... (diff) | |
download | hsbot-c506c58e925383a6a19c82550d1bb458bc504f99.tar.gz hsbot-c506c58e925383a6a19c82550d1bb458bc504f99.tar.bz2 hsbot-c506c58e925383a6a19c82550d1bb458bc504f99.zip |
Cleaned further the bot updates handling.
Diffstat (limited to '')
-rw-r--r-- | Hsbot/Types.hs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Hsbot/Types.hs b/Hsbot/Types.hs index 9ea7ff6..49e8e6b 100644 --- a/Hsbot/Types.hs +++ b/Hsbot/Types.hs @@ -1,10 +1,14 @@ module Hsbot.Types ( Bot , BotMsg (..) + , BotResumeData , BotState (..) + , BotStatus (..) , Msg (..) , Plugin , PluginState (..) + , ResumeData + , ResumeMsg (..) ) where import Control.Concurrent @@ -24,10 +28,16 @@ data BotState = BotState , botPlugins :: M.Map String (PluginState, ThreadId) -- Loaded plugins , botChan :: Chan BotMsg -- the bot's communication channel , botConfig :: Config -- the bot's starting config - , botMVar :: MVar String -- the place where to put resume data - , botResumeData :: M.Map String String -- the necessary data to resume the bot's operations on reboot + , 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 @@ -46,5 +56,10 @@ data Msg = Msg , msgStuff :: String -- the message to be transfered } deriving (Show) -data BotMsg = InMsg Msg | OutMsg Msg | IntMsg Msg deriving (Show) +data ResumeMsg = ResMsg + { resMsgFrom :: String + , resMsgData :: ResumeData + } deriving (Show) + +data BotMsg = InMsg Msg | OutMsg Msg | IntMsg Msg | UpdMsg ResumeMsg deriving (Show) |