Archived
1
0
Fork 0

Wrote the list plugin command.

This commit is contained in:
Julien Dessaux 2010-04-22 00:05:35 +02:00
parent 50b21c21ee
commit d922240e9a
6 changed files with 40 additions and 15 deletions

View file

@ -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