diff options
author | Julien Dessaux | 2011-04-24 23:08:06 +0200 |
---|---|---|
committer | Julien Dessaux | 2011-05-01 03:28:22 +0200 |
commit | 864a364da99a0ec05f08d7cfbad4abde416a0b06 (patch) | |
tree | 40e92cdd6913aaa0121584c3c3e7436cdf38d926 /Hsbot/Message.hs | |
parent | Continue refactoring, worked on the core loop and the plugin infrastructure. (diff) | |
download | hsbot-864a364da99a0ec05f08d7cfbad4abde416a0b06.tar.gz hsbot-864a364da99a0ec05f08d7cfbad4abde416a0b06.tar.bz2 hsbot-864a364da99a0ec05f08d7cfbad4abde416a0b06.zip |
Some API refactoring.
I can't say how I hate the Types.hs thing in Haskell!
Diffstat (limited to 'Hsbot/Message.hs')
-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 |