summaryrefslogtreecommitdiff
path: root/Hsbot/Types.hs
diff options
context:
space:
mode:
authorJulien Dessaux2011-04-23 13:35:04 +0200
committerJulien Dessaux2011-04-23 13:35:04 +0200
commitd4be110200ba3f3a2f19236ec3c16f980ab458aa (patch)
tree832402a3a83927b0f3242b2306b4f1a79e681de8 /Hsbot/Types.hs
parentBegan a big refactoring/rewriting (again) (diff)
downloadhsbot-d4be110200ba3f3a2f19236ec3c16f980ab458aa.tar.gz
hsbot-d4be110200ba3f3a2f19236ec3c16f980ab458aa.tar.bz2
hsbot-d4be110200ba3f3a2f19236ec3c16f980ab458aa.zip
Continue refactoring, worked on the core loop and the plugin infrastructure.
Diffstat (limited to '')
-rw-r--r--Hsbot/Types.hs19
1 files changed, 13 insertions, 6 deletions
diff --git a/Hsbot/Types.hs b/Hsbot/Types.hs
index ff57c49..28ad430 100644
--- a/Hsbot/Types.hs
+++ b/Hsbot/Types.hs
@@ -5,6 +5,8 @@ module Hsbot.Types
, BotEnv (..)
, Env
, Message (..)
+ , Plugin
+ , PluginId (..)
, PluginState (..)
) where
@@ -12,11 +14,11 @@ import Control.Concurrent
import qualified Data.Map as M
import Control.Monad.Reader
import Control.Monad.State
-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
@@ -36,19 +38,24 @@ type Bot = StateT BotState
data BotState = BotState
{ botPlugins :: M.Map String (PluginState, MVar (), ThreadId)
- , botCommands :: M.Map String [String]
+ , botHooks :: [Chan Message]
, botChannels :: [String]
, botNickname :: String
}
-- The Plugin monad
+type Plugin = StateT PluginState
+
data PluginState = PluginState
+ { pluginId :: PluginId
+ , pluginChan :: Chan Message
+ , pluginMaster :: Chan Message
+ }
+
+data PluginId = PluginId
{ pluginName :: String
- , pluginChan :: Chan Message
+ , pluginEp :: PluginState -> IO ()
}
data BotStatus = BotContinue | BotExit | BotReload | BotRestart deriving (Show)
-data Message = IncomingMsg IRC.Message
- | OutgoingMsg IRC.Message
-