summaryrefslogtreecommitdiff
path: root/Plugins/Quote.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-02-04 23:34:15 +0100
committerJulien Dessaux2010-02-04 23:34:15 +0100
commit416460886da9f8d835200ca46c9062a4ebd78fe7 (patch)
treef76663fd592d13031f494674c8c602e624f1d03d /Plugins/Quote.hs
parentBegan a complete rewrite of command and plugin management. (diff)
downloadhsbot-416460886da9f8d835200ca46c9062a4ebd78fe7.tar.gz
hsbot-416460886da9f8d835200ca46c9062a4ebd78fe7.tar.bz2
hsbot-416460886da9f8d835200ca46c9062a4ebd78fe7.zip
Continue rewriting, found a problem in the way I kill plugins.
Diffstat (limited to 'Plugins/Quote.hs')
-rw-r--r--Plugins/Quote.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Plugins/Quote.hs b/Plugins/Quote.hs
index 4c6e22c..fd36e11 100644
--- a/Plugins/Quote.hs
+++ b/Plugins/Quote.hs
@@ -28,8 +28,9 @@ type QuoteBot a = StateT QuoteDB IO a
mainQuote :: Chan BotMsg -> Chan BotMsg -> IO ()
mainQuote serverChan chan = do
let plugin = PluginInstance "Quote" serverChan chan
- (runStateT run plugin) `catch` (const $ return ((), plugin))
- return ()
+ plugin' <- (execStateT run plugin) `catch` (const $ return plugin)
+ putStrLn "graou"
+ evalStateT stop plugin'
-- | The IrcPlugin monad main function
run :: IrcPlugin ()
@@ -37,6 +38,9 @@ run = do
-- TODO : init quote handling (sqlite + structure to handle temporary stuff)
sendRegisterCommand "quote"
runPlugin
+
+stop :: IrcPlugin ()
+stop = do
sendUnregisterCommand "quote"
-- TODO : send cancel messages for all temporary stuff