diff options
author | Julien Dessaux | 2010-05-24 22:46:20 +0200 |
---|---|---|
committer | Julien Dessaux | 2010-05-24 22:46:20 +0200 |
commit | a12e4927728c9907537b221257c5e2914f5f1c48 (patch) | |
tree | 8b8f2dcaa3e796e53767531d654c7e437437ff05 /Hsbot/Irc/Command.hs | |
parent | Cleaned the definition of irc plugins' data structure. (diff) | |
download | hsbot-a12e4927728c9907537b221257c5e2914f5f1c48.tar.gz hsbot-a12e4927728c9907537b221257c5e2914f5f1c48.tar.bz2 hsbot-a12e4927728c9907537b221257c5e2914f5f1c48.zip |
Implemented ircbot update messages.
Diffstat (limited to '')
-rw-r--r-- | Hsbot/Irc/Command.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Hsbot/Irc/Command.hs b/Hsbot/Irc/Command.hs index e5c033e..ef1ef27 100644 --- a/Hsbot/Irc/Command.hs +++ b/Hsbot/Irc/Command.hs @@ -36,7 +36,7 @@ unregisterCommand cmd pluginName' = do -- | Processes an internal command processInternalCommand :: IrcBotMsg -> IrcBot () processInternalCommand (IntIrcCmd ircCmd) - | ircCmdTo ircCmd == "CORE" = processCoreCommand ircCmd + | ircCmdTo ircCmd == "CORE" = processCoreCommand ircCmd | otherwise = do plugins <- gets ircBotPlugins case M.lookup (ircCmdTo ircCmd) plugins of @@ -52,8 +52,18 @@ processCoreCommand ircCmd = do case command' of "LIST" -> listPlugins originalRequest (ircCmdFrom ircCmd) "LOAD" -> loadIrcPlugin $ ircCmdMsg ircCmd - "UNLOAD" -> unloadPlugin $ ircCmdMsg ircCmd + "UNLOAD" -> unloadIrcPlugin $ ircCmdMsg ircCmd + "UPDATE" -> processUpdateCommand ircCmd "REGISTER" -> registerCommand (ircCmdMsg ircCmd) (ircCmdFrom ircCmd) "UNREGISTER" -> unregisterCommand (ircCmdMsg ircCmd) (ircCmdFrom ircCmd) _ -> return () +-- | Process an update command +processUpdateCommand :: IrcCmd -> IrcBot () +processUpdateCommand ircCmd = do + ircbot <- get + let oldData = ircBotResumeData ircbot + from = ircCmdFrom ircCmd + stuff = ircCmdMsg ircCmd + put $ ircbot { ircBotResumeData = M.insert from stuff oldData } + |