From 451564ef5b13302912080d58a9aee6ff0968f70e Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 25 May 2010 21:54:33 +0200 Subject: Cleaned that ugly update message handling and added a reboot command to the ircbot. --- Hsbot/Irc/Plugin/Core.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Hsbot/Irc/Plugin') diff --git a/Hsbot/Irc/Plugin/Core.hs b/Hsbot/Irc/Plugin/Core.hs index 0297e2c..114ced8 100644 --- a/Hsbot/Irc/Plugin/Core.hs +++ b/Hsbot/Irc/Plugin/Core.hs @@ -16,9 +16,9 @@ ircBotPluginCore myChan masterChan = do let plugin = IrcPluginState { ircPluginName = "Core" , ircPluginChan = myChan , ircPluginMasterChan = masterChan } - evalStateT (mapM_ sendRegisterCommand ["list", "load", "reload", "unload"]) plugin + evalStateT (mapM_ sendRegisterCommand ["list", "load", "reload", "unload", "reboot"]) plugin plugin' <- (execStateT run plugin) `catch` (\(_ :: AsyncException) -> return plugin) - evalStateT (mapM_ sendUnregisterCommand ["list", "load", "reload", "unload"]) plugin' + evalStateT (mapM_ sendUnregisterCommand ["list", "load", "reload", "unload", "reboot"]) plugin' -- | The IrcPlugin monad main function run :: IrcPlugin () @@ -36,6 +36,7 @@ run = forever $ do "load" -> loadPlugin $ tail stuff "reload" -> reloadPlugin $ tail stuff "unload" -> unloadPlugin $ tail stuff + "reboot" -> rebootBot $ tail stuff _ -> return () -- TODO : help message "ANSWER" -> let stuff = ircCmdMsg intCmd in answerMsg request ("Loaded plugins : " ++ stuff) @@ -59,3 +60,7 @@ reloadPlugin pluginNames = mapM_ (sendCommand "RELOAD" "CORE") pluginNames unloadPlugin :: [String] -> IrcPlugin () unloadPlugin pluginNames = mapM_ (sendCommand "UNLOAD" "CORE") pluginNames +-- | The reboot command +rebootBot :: [String] -> IrcPlugin () +rebootBot stuff = sendCommand "REBOOT" "CORE" $ unwords stuff + -- cgit v1.2.3