From d922240e9a28680d48014604576620d7fc5aa605 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 22 Apr 2010 00:05:35 +0200 Subject: Wrote the list plugin command. --- Hsbot/Plugin.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Hsbot/Plugin.hs') diff --git a/Hsbot/Plugin.hs b/Hsbot/Plugin.hs index 34c6603..43ce0fb 100644 --- a/Hsbot/Plugin.hs +++ b/Hsbot/Plugin.hs @@ -1,5 +1,6 @@ module Hsbot.Plugin - ( loadPlugin + ( listPlugins + , loadPlugin , sendToPlugin , unloadPlugin ) where @@ -31,6 +32,15 @@ effectivelyLoadPlugin name entryPoint serverChan = do threadId <- forkIO $ entryPoint serverChan chan return $ Plugin name threadId chan +-- | Sends a list of loaded plugins +listPlugins :: Maybe IrcMsg -> String -> IrcBot () +listPlugins originalRequest dest = do + plugins <- gets botPlugins + let listing = unwords $ M.keys plugins + case M.lookup dest plugins of + Just plugin -> sendToPlugin (InternalCmd $ IntCmd "ANSWER" "CORE" dest listing originalRequest) plugin + Nothing -> return () + -- | Unloads a plugin unloadPlugin :: String -> IrcBot () unloadPlugin name = do -- cgit v1.2.3