summaryrefslogtreecommitdiff
path: root/Hsbot/Message.hs
diff options
context:
space:
mode:
authorJulien Dessaux2011-04-24 23:08:06 +0200
committerJulien Dessaux2011-05-01 03:28:22 +0200
commit864a364da99a0ec05f08d7cfbad4abde416a0b06 (patch)
tree40e92cdd6913aaa0121584c3c3e7436cdf38d926 /Hsbot/Message.hs
parentContinue refactoring, worked on the core loop and the plugin infrastructure. (diff)
downloadhsbot-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.hs20
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