diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/commands.h | 24 | ||||
| -rw-r--r-- | include/modules.h | 5 |
2 files changed, 24 insertions, 5 deletions
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<CommandFlag> @@ -73,9 +92,10 @@ class CoreExport Command : public Flags<CommandFlag> 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<Anope::string> &); + virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶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<Anope::string> ¶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<Anope::string> ¶ms) { } + virtual void OnPostCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { } /** Called after the core has finished loading the databases, but before * we connect to the server |
