summaryrefslogtreecommitdiff
path: root/Hsbot/Irc/Command.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Hsbot/Irc/Command.hs')
-rw-r--r--Hsbot/Irc/Command.hs14
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 }
+