summaryrefslogtreecommitdiff
path: root/include/commands.h
diff options
context:
space:
mode:
authorlethality <lethality@anope.org>2012-06-22 21:26:33 +0100
committerlethality <lethality@anope.org>2012-06-22 21:26:33 +0100
commitd8a99d619f7ae301ecf188dc460b1f5c7cb791ac (patch)
treeb327ce05b9b5cb598fbc829e48041d465bc2d579 /include/commands.h
parentba53c7eb03add30acefbbc95bbd8b4b825b465b0 (diff)
parent2dec8e767a70def4b9b04a96ae4f75e4d1013038 (diff)
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Diffstat (limited to 'include/commands.h')
-rw-r--r--include/commands.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/include/commands.h b/include/commands.h
index cfd46d644..d644ea8cb 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -33,11 +33,23 @@ struct CommandInfo
Anope::string permission;
};
+struct CommandReply
+{
+ virtual void SendMessage(const BotInfo *source, const Anope::string &msg) = 0;
+};
+
/* The source for a command */
-struct CoreExport CommandSource
+class CoreExport CommandSource
{
- /* User executing the command */
+ /* The nick executing the command */
+ Anope::string nick;
+ /* User executing the command, may be NULL */
User *u;
+ public:
+ /* The account executing the command */
+ NickCore *nc;
+ /* Where the reply should go */
+ CommandReply *reply;
/* Channel the command was executed on (fantasy) */
Channel *c;
/* The service this command is on */
@@ -49,8 +61,20 @@ struct CoreExport CommandSource
/* The permission of the command being executed */
Anope::string permission;
+ CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply);
+
+ const Anope::string &GetNick() const;
+ User *GetUser() const;
+ AccessGroup AccessFor(ChannelInfo *ci) const;
+ bool IsFounder(ChannelInfo *ci) const;
+
void Reply(const char *message, ...);
void Reply(const Anope::string &message);
+
+ bool HasCommand(const Anope::string &cmd);
+ bool HasPriv(const Anope::string &cmd);
+ bool IsServicesOper() const;
+ bool IsOper() const;
};
/** Every services command is a class, inheriting from Command.
@@ -118,4 +142,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
};
+extern void RunCommand(CommandSource &source, const Anope::string &message);
+
#endif // COMMANDS_H