diff options
author | Julien Dessaux | 2010-04-22 00:05:35 +0200 |
---|---|---|
committer | Julien Dessaux | 2010-04-22 00:10:13 +0200 |
commit | d922240e9a28680d48014604576620d7fc5aa605 (patch) | |
tree | 60185f299eebb04d8da9b79e9afd011d6147e411 /Hsbot/Plugin.hs | |
parent | Make the main thread exit cleanly in case of connection loss. (diff) | |
download | hsbot-d922240e9a28680d48014604576620d7fc5aa605.tar.gz hsbot-d922240e9a28680d48014604576620d7fc5aa605.tar.bz2 hsbot-d922240e9a28680d48014604576620d7fc5aa605.zip |
Wrote the list plugin command.
Diffstat (limited to 'Hsbot/Plugin.hs')
-rw-r--r-- | Hsbot/Plugin.hs | 12 |
1 files changed, 11 insertions, 1 deletions
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 |