summaryrefslogtreecommitdiff
path: root/Plugins/Ping.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-02-08 00:11:46 +0100
committerJulien Dessaux2010-02-08 00:16:02 +0100
commitbfc06f1ff188c9d7faa817034363a27e34eae15a (patch)
treeb775c8401982544b273da8a22e1c28854eac58d5 /Plugins/Ping.hs
parentContinue rewriting, found a problem in the way I kill plugins. (diff)
downloadhsbot-bfc06f1ff188c9d7faa817034363a27e34eae15a.tar.gz
hsbot-bfc06f1ff188c9d7faa817034363a27e34eae15a.tar.bz2
hsbot-bfc06f1ff188c9d7faa817034363a27e34eae15a.zip
Fixed the clean killing of plugin's threads, fixed exception management and cleaned plugins' main functions.
Diffstat (limited to '')
-rw-r--r--Plugins/Ping.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Plugins/Ping.hs b/Plugins/Ping.hs
index 6102fe4..8258bcf 100644
--- a/Plugins/Ping.hs
+++ b/Plugins/Ping.hs
@@ -3,7 +3,9 @@ module Plugins.Ping
) where
import Control.Concurrent.Chan
+import Control.Exception
import Control.Monad.State
+import Prelude hiding (catch)
import Hsbot.IRCPlugin
import Hsbot.Types
@@ -12,7 +14,7 @@ import Hsbot.Types
mainPing :: Chan BotMsg -> Chan BotMsg -> IO ()
mainPing serverChan chan = do
let plugin = PluginInstance "Ping" serverChan chan
- (runStateT run plugin) `catch` (const $ return ((), plugin))
+ (execStateT run plugin) `catch` (\(ex :: AsyncException) -> return plugin)
return ()
-- | The IrcPlugin monad main function