From 416460886da9f8d835200ca46c9062a4ebd78fe7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 4 Feb 2010 23:34:15 +0100 Subject: Continue rewriting, found a problem in the way I kill plugins. --- Hsbot/Command.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Hsbot/Command.hs') diff --git a/Hsbot/Command.hs b/Hsbot/Command.hs index 054653d..76f1d04 100644 --- a/Hsbot/Command.hs +++ b/Hsbot/Command.hs @@ -67,7 +67,9 @@ processInternalCommand (InternalCmd intCmd) = do plugins <- gets botPlugins if intCmdTo intCmd == "CORE" then processCoreCommand intCmd - else sendToPlugin (InternalCmd intCmd) $ fromMaybe [] (M.lookup plugins (intCmdTo intCmd)) + else case M.lookup (intCmdTo intCmd) plugins of + Just plugin -> sendToPlugin (InternalCmd intCmd) plugin + Nothing -> errorM $ "Invalid destination in message : " ++ (show intCmd) processInternalCommand _ = return () -- | Processes a core command @@ -76,8 +78,11 @@ processCoreCommand intCmd = do let command' = intCmdCmd intCmd case command' of "LOAD" -> loadPlugin $ intCmdMsg intCmd + "RELOAD" -> reloadPlugin $ intCmdMsg intCmd "UNLOAD" -> unloadPlugin $ intCmdMsg intCmd "REGISTER" -> registerCommand (intCmdMsg intCmd) (intCmdFrom intCmd) "UNREGISTER" -> unregisterCommand (intCmdMsg intCmd) (intCmdFrom intCmd) _ -> traceM $ inColor ("Invalid command : " ++ (show intCmd)) [31] + bot' <- get + traceM $ show bot' -- cgit v1.2.3