X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodcmd.h;h=52c272c53e6f8acd6c9425cd3519292592c7a100;hb=391260f64a1dfb35bf0a55e7044fe1b8d83f2561;hp=4f0616269e1696263604e8f772e3aca4c2383215;hpb=410cb79dd46afc2da46d2ac3fc2010a77ccb9f0e;p=NeonServV5.git diff --git a/src/modcmd.h b/src/modcmd.h index 4f06162..52c272c 100644 --- a/src/modcmd.h +++ b/src/modcmd.h @@ -34,6 +34,7 @@ #define CMDFLAG_REQUIRED 0x0800 #define CMDFLAG_TEMPONARY_BIND 0x1000 #define CMDFLAG_FUNCMD 0x2000 +#define CMDFLAG_ESCAPE_ARGS 0x4000 struct ClientSocket; struct UserNode; @@ -42,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; @@ -52,7 +53,6 @@ struct cmd_function { int paramcount; int global_access; char *channel_access; - int triggered; struct cmd_function *next; }; @@ -60,18 +60,21 @@ struct cmd_function { 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; @@ -81,21 +84,44 @@ 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 bind_unbound_required_functions(int botid); - void register_command_alias(int botid, char *alias); struct cmd_binding *getAllBinds(struct cmd_binding *last);