From cb6ef574e3df5cc846247450b74ca37d265f319e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 24 Nov 2010 21:40:56 -0600 Subject: Send replies from fantasy commands back to the channel, this will be expanded on later --- include/commands.h | 24 ++++++++++++++++++++++-- include/modules.h | 5 ++--- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/commands.h b/include/commands.h index 5c0b5315c..e247fc388 100644 --- a/include/commands.h +++ b/include/commands.h @@ -43,6 +43,25 @@ enum CommandFlag CFLAG_DISABLE_FANTASY }; +/* The source for a command */ +struct CommandSource +{ + /* User executing the command */ + User *u; + /* Channel (if applicable) */ + ChannelInfo *ci; + /* The service this command is on */ + BotInfo *owner; + /* The service the reply should come from, *not* necessarily the service the command is on */ + BotInfo *service; + /* Whether or not this was a fantasy command */ + bool fantasy; + + void Reply(LanguageString message, ...); + void Reply(const char *message, ...); + void Reply(const Anope::string &message); +}; + /** Every services command is a class, inheriting from Command. */ class CoreExport Command : public Flags @@ -73,9 +92,10 @@ class CoreExport Command : public Flags virtual ~Command(); /** Execute this command. - * @param u The user executing the command. + * @param source The source + * @param params Command parameters */ - virtual CommandReturn Execute(User *u, const std::vector &); + virtual CommandReturn Execute(CommandSource &source, const std::vector ¶ms) = 0; /** Called when HELP is requsted for the client this command is on. * @param u The user requesting help diff --git a/include/modules.h b/include/modules.h index ac74a7372..cd3ba20a4 100644 --- a/include/modules.h +++ b/include/modules.h @@ -380,12 +380,11 @@ class CoreExport Module : public Extensible virtual EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector ¶ms) { return EVENT_CONTINUE; } /** Called after a command has been executed. - * @param u The user executing the command - * @param service The service the command is associated with + * @param source The source of the command * @param command The command the user executed * @param params The parameters the user sent */ - virtual void OnPostCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector ¶ms) { } + virtual void OnPostCommand(CommandSource &source, Command *command, const std::vector ¶ms) { } /** Called after the core has finished loading the databases, but before * we connect to the server -- cgit