summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2010-04-21 22:39:03 +0200
committerJulien Dessaux2010-04-21 22:39:03 +0200
commit8551832bd29508f36b6820e19d4af0525b1cba50 (patch)
tree2a99933414aee751f3843be901940ab44dd4189e
parentRemoved all the dynamic module loading stuff. (diff)
downloadhsbot-8551832bd29508f36b6820e19d4af0525b1cba50.tar.gz
hsbot-8551832bd29508f36b6820e19d4af0525b1cba50.tar.bz2
hsbot-8551832bd29508f36b6820e19d4af0525b1cba50.zip
Add the IrcMsg as an optional parameter for an internal command.
-rw-r--r--Hsbot/Command.hs2
-rw-r--r--Hsbot/IRCPlugin.hs2
-rw-r--r--Hsbot/Types.hs9
-rw-r--r--TODO1
4 files changed, 7 insertions, 7 deletions
diff --git a/Hsbot/Command.hs b/Hsbot/Command.hs
index f42db98..1eaee82 100644
--- a/Hsbot/Command.hs
+++ b/Hsbot/Command.hs
@@ -56,7 +56,7 @@ dispatchMessage (InputMsg inputMsg) = do
, (head getMsgContent) == (commandPrefix config) ]
sendRunCommand :: String -> Plugin -> IrcBot ()
sendRunCommand cmd plugin = do
- sendToPlugin (InternalCmd $ IntCmd "RUN" "CORE" (pluginName plugin) cmd) plugin
+ sendToPlugin (InternalCmd $ IntCmd "RUN" "CORE" (pluginName plugin) cmd (Just inputMsg)) plugin
getMsgContent :: String
getMsgContent = unwords . tail $ parameters inputMsg
dispatchMessage _ = return ()
diff --git a/Hsbot/IRCPlugin.hs b/Hsbot/IRCPlugin.hs
index d4dcb82..568eb1d 100644
--- a/Hsbot/IRCPlugin.hs
+++ b/Hsbot/IRCPlugin.hs
@@ -28,7 +28,7 @@ sendCommand :: String -> String -> String -> IrcPlugin ()
sendCommand cmd to params = do
serverChan <- gets instanceServerChan
from <- gets instanceName
- liftIO $ writeChan serverChan $ InternalCmd $ IntCmd cmd from to params
+ liftIO $ writeChan serverChan $ InternalCmd $ IntCmd cmd from to params Nothing
sendRegisterCommand :: String -> IrcPlugin ()
sendRegisterCommand cmd = sendCommand "REGISTER" "CORE" cmd
diff --git a/Hsbot/Types.hs b/Hsbot/Types.hs
index 6b85af5..436bbdf 100644
--- a/Hsbot/Types.hs
+++ b/Hsbot/Types.hs
@@ -90,10 +90,11 @@ data IrcMsg = IrcMsg
-- | An internal command
data IntCmd = IntCmd
- { intCmdCmd :: String -- the internal command
- , intCmdFrom :: String -- who issues it
- , intCmdTo :: String -- who it is destinated to
- , intCmdMsg :: String -- the IrcMsg associated with the command
+ { intCmdCmd :: String -- the internal command
+ , intCmdFrom :: String -- who issues it
+ , intCmdTo :: String -- who it is destinated to
+ , intCmdMsg :: String -- the message to be transfered
+ , intCmdBotMsg :: Maybe IrcMsg -- An IrcMsg attached to the command
} deriving (Show)
data BotMsg = InputMsg IrcMsg | OutputMsg IrcMsg | InternalCmd IntCmd deriving (Show)
diff --git a/TODO b/TODO
index 3aedb52..d2a37d5 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,5 @@
:julien!~julien@ogu21.corp PRIVMSG #shbot :@quote graou snif
-* Add the IrcMsg as an optional parameter for an internal command
* Solve the catching that never happen in main
* throwto exception to main thread
* write a safe reload : try reload before unloading