X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodcmd.h;h=52c272c53e6f8acd6c9425cd3519292592c7a100;hb=391260f64a1dfb35bf0a55e7044fe1b8d83f2561;hp=40ad373ea3a403691ec341e43d9fb627e269f9da;hpb=b9f6cb8dbf93da79626a34f3d090db35d16b60c0;p=NeonServV5.git diff --git a/src/modcmd.h b/src/modcmd.h index 40ad373..52c272c 100644 --- a/src/modcmd.h +++ b/src/modcmd.h @@ -33,6 +33,8 @@ #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; @@ -41,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; @@ -58,41 +60,69 @@ 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; }; +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_bot_alias(int botid, char *alias); +void register_command_alias(int botid, char *alias); struct cmd_binding *getAllBinds(struct cmd_binding *last); #endif \ No newline at end of file