diff options
Diffstat (limited to '')
-rw-r--r-- | Hsbot/Message.hs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Hsbot/Message.hs b/Hsbot/Message.hs index 5ec35ed..067a740 100644 --- a/Hsbot/Message.hs +++ b/Hsbot/Message.hs @@ -1,9 +1,21 @@ module Hsbot.Message - ( Message (..) + ( readMsg + , writeMsg ) where -import qualified Network.IRC as IRC +import Control.Concurrent +import Control.Monad.State -data Message = IncomingMsg IRC.Message - | OutgoingMsg IRC.Message +import Hsbot.Types + +-- Plugin Utils +readMsg :: Plugin IO (Message) +readMsg = do + chan <- gets pluginChan + liftIO $ readChan chan >>= return + +writeMsg :: Message -> Plugin IO () +writeMsg msg = do + chan <- gets pluginMaster + liftIO $ writeChan chan msg |