#define CMDFLAG_LOG 0x0100
#define CMDFLAG_OPLOG 0x0200
#define CMDFLAG_EMPTY_ARGS 0x0400
+#define CMDFLAG_REQUIRED 0x0800
+#define CMDFLAG_TEMPONARY_BIND 0x1000
+#define CMDFLAG_FUNCMD 0x2000
+#define CMDFLAG_ESCAPE_ARGS 0x4000
struct ClientSocket;
struct UserNode;
#define CMD_BIND(NAME) void NAME(UNUSED_ARG(struct ClientSocket *client), UNUSED_ARG(struct UserNode *user), UNUSED_ARG(struct ChanNode *chan), UNUSED_ARG(char **argv), UNUSED_ARG(char argc), UNUSED_ARG(struct Event *event))
typedef void cmd_bind_t(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, char **argv, char argc, struct Event *event);
-typedef void trigger_callback_t(struct ChanNode *chan, char *trigger);
+typedef void trigger_callback_t(int clientid, struct ChanNode *chan, char *trigger);
struct cmd_function {
char *name;
struct cmd_binding {
char *cmd;
int botid;
+ int clientid;
struct cmd_function *func;
unsigned int flags;
char *parameters[MAXPARAMETERS];
int paramcount;
int global_access;
char *channel_access;
+ int triggered;
struct cmd_binding *next;
};
struct trigger_cache {
int botid;
+ int clientid;
char *trigger;
struct trigger_cache *next;
};
+extern int statistics_commands;
+
void init_modcmd();
void free_modcmd();
-struct ClientSocket* get_prefered_bot(int botid);
+
+#define get_prefered_bot(BOTID) get_botwise_prefered_bot(BOTID, 0)
+struct ClientSocket* get_botwise_prefered_bot(int botid, int clientid);
+
int register_command(int botid, char *name, cmd_bind_t *func, int paramcount, char *channel_access, int global_access, unsigned int flags);
int set_trigger_callback(int botid, trigger_callback_t *func);
-int changeChannelTrigger(int botid, struct ChanNode *chan, char *new_trigger);
-int bind_cmd_to_function(int botid, char *cmd, struct cmd_function *func);
-int bind_cmd_to_command(int botid, char *cmd, char *func);
-int unbind_cmd(int botid, char *cmd);
+
+#define changeChannelTrigger(BOTID,CHAN,NEW) changeBotwiseChannelTrigger(BOTID, 0, CHAN, NEW)
+int changeBotwiseChannelTrigger(int botid, int clientid, struct ChanNode *chan, char *new_trigger);
+
+#define bind_cmd_to_function(BOTID,CMD,FUNC) bind_botwise_cmd_to_function(BOTID, 0, CMD, FUNC)
+int bind_botwise_cmd_to_function(int botid, int clientid, char *cmd, struct cmd_function *func);
+
+#define bind_cmd_to_command(BOTID,CMD,FUNC) bind_botwise_cmd_to_command(BOTID, 0, CMD, FUNC)
+int bind_botwise_cmd_to_command(int botid, int clientid, char *cmd, char *func);
+
+#define unbind_cmd(BOTID,CMD) unbind_botwise_cmd(BOTID, 0, CMD)
+int unbind_botwise_cmd(int botid, int clientid, char *cmd);
+
+int unbind_botwise_allcmd(int clientid);
+
+#define bind_set_parameters(BOTID,CMD,PARAMETERS) bind_botwise_set_parameters(BOTID, 0, CMD, PARAMETERS)
+void bind_botwise_set_parameters(int botid, int clientid, char *cmd, char *parameters);
+
+#define bind_set_global_access(BOTID,CMD,GACCESS) bind_botwise_set_global_access(BOTID, 0, CMD, GACCESS)
+void bind_botwise_set_global_access(int botid, int clientid, char *cmd, int gaccess);
+
+#define bind_set_channel_access(BOTID,CMD,CACCESS) bind_botwise_set_channel_access(BOTID, 0, CMD, CACCESS)
+void bind_botwise_set_channel_access(int botid, int clientid, char *cmd, char *chanaccess);
+
+#define find_cmd_binding(BOTID,CMD) find_botwise_cmd_binding(BOTID, 0, CMD)
+struct cmd_binding *find_botwise_cmd_binding(int botid, int clientid, char *cmd);
+
+#define bind_unbound_required_functions(BOTID) bind_botwise_unbound_required_functions(BOTID, 0)
+void bind_botwise_unbound_required_functions(int botid, int clientid);
+
struct cmd_function *find_cmd_function(int botid, char *name);
struct ClientSocket *getTextBot();
-void bind_set_parameters(int botid, char *cmd, char *parameters);
-void bind_set_global_access(int botid, char *cmd, int gaccess);
-void bind_set_channel_access(int botid, char *cmd, char *chanaccess);
-struct cmd_binding *find_cmd_binding(int botid, char *cmd);
+void register_command_alias(int botid, char *alias);
+struct cmd_binding *getAllBinds(struct cmd_binding *last);
#endif
\ No newline at end of file