X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodcmd.h;fp=src%2Fmodcmd.h;h=fdc2965ded8a26ad85a780b14f2daaec4f7a9e43;hb=f80fa658483884289cf2585790b1cf64ef722197;hp=44333b53e22c9b80075427e66dc8707a132a721d;hpb=452c081325041f5ea0f90041e66a9e98e1fd5e6f;p=NeonServV5.git diff --git a/src/modcmd.h b/src/modcmd.h index 44333b5..fdc2965 100644 --- a/src/modcmd.h +++ b/src/modcmd.h @@ -43,7 +43,7 @@ struct Event; #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; @@ -60,6 +60,7 @@ struct cmd_function { struct cmd_binding { char *cmd; int botid; + int clientid; struct cmd_function *func; unsigned int flags; char *parameters[MAXPARAMETERS]; @@ -73,6 +74,7 @@ struct cmd_binding { struct trigger_cache { int botid; + int clientid; char *trigger; struct trigger_cache *next; @@ -82,21 +84,42 @@ 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); + +#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 bind_unbound_required_functions(int botid); - void register_command_alias(int botid, char *alias); struct cmd_binding *getAllBinds(struct cmd_binding *last);