From 187b1b545362457a63350a2620a9b76301d20830 Mon Sep 17 00:00:00 2001 From: pk910 Date: Tue, 28 Aug 2012 02:38:04 +0200 Subject: [PATCH] fixed modcmd.c: made all command functions case insensitive --- src/modcmd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modcmd.c b/src/modcmd.c index 53d65fd..cbc30af 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -598,7 +598,7 @@ static void got_privmsg(struct UserNode *user, struct UserNode *target, char *me int register_command(int botid, char *name, int module_id, cmd_bind_t *func, int paramcount, char *channel_access, int global_access, unsigned int flags) { struct cmd_function *cmdfunc; for(cmdfunc = cmd_functions; cmdfunc; cmdfunc = cmdfunc->next) { - if((cmdfunc->botid == botid || cmdfunc->botid == 0) && strcmp(cmdfunc->name, name) == 0) + if((cmdfunc->botid == botid || cmdfunc->botid == 0) && !stricmp(cmdfunc->name, name)) return 0; } cmdfunc = malloc(sizeof(*cmdfunc)); @@ -677,7 +677,7 @@ int bind_botwise_cmd_to_function(int botid, int clientid, char *cmd, struct cmd_ int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(((botid && cbind->botid == botid) || (botid == 0 && clientid == cbind->clientid)) && strcmp(cbind->cmd, cmd) == 0) + if(((botid && cbind->botid == botid) || (botid == 0 && clientid == cbind->clientid)) && !stricmp(cbind->cmd, cmd)) return 0; } cbind = malloc(sizeof(*cbind)); @@ -716,14 +716,14 @@ int bind_botwise_cmd_to_command(int botid, int clientid, char *cmd, char *func) func = c+1; } for(cmdfunc = cmd_functions; cmdfunc; cmdfunc = cmdfunc->next) { - if((cmdfunc->botid == fbotid || cmdfunc->botid == 0) && strcmp(cmdfunc->name, func) == 0) + if((cmdfunc->botid == fbotid || cmdfunc->botid == 0) && !stricmp(cmdfunc->name, func)) break; } if(!cmdfunc) return 0; int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(((botid && cbind->botid == botid) || (botid == 0 && clientid == cbind->clientid)) && strcmp(cbind->cmd, cmd) == 0) + if(((botid && cbind->botid == botid) || (botid == 0 && clientid == cbind->clientid)) && !stricmp(cbind->cmd, cmd)) return 0; } cbind = malloc(sizeof(*cbind)); @@ -749,7 +749,7 @@ int unbind_botwise_cmd(int botid, int clientid, char *cmd) { int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind, *last = NULL; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(cbind->botid == botid && (botid || clientid == cbind->clientid) && strcmp(cbind->cmd, cmd) == 0) { + if(cbind->botid == botid && (botid || clientid == cbind->clientid) && !stricmp(cbind->cmd, cmd)) { if(last) last->next = cbind->next; else @@ -871,7 +871,7 @@ void bind_botwise_set_parameters(int botid, int clientid, char *cmd, char *param int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(cbind->botid == botid && (botid || clientid == cbind->clientid) && strcmp(cbind->cmd, cmd) == 0) { + if(cbind->botid == botid && (botid || clientid == cbind->clientid) && !stricmp(cbind->cmd, cmd)) { if(cbind->paramcount) { int i; for(i = 0; i < cbind->paramcount; i++) @@ -896,7 +896,7 @@ void bind_botwise_set_global_access(int botid, int clientid, char *cmd, int gacc int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(cbind->botid == botid && (botid || clientid == cbind->clientid) && strcmp(cbind->cmd, cmd) == 0) { + if(cbind->botid == botid && (botid || clientid == cbind->clientid) && !stricmp(cbind->cmd, cmd)) { if(gaccess > -1) { cbind->global_access = gaccess; cbind->flags |= CMDFLAG_OVERRIDE_GLOBAL_ACCESS; @@ -912,7 +912,7 @@ void bind_botwise_set_channel_access(int botid, int clientid, char *cmd, char *c int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(cbind->botid == botid && (botid || clientid == cbind->clientid) && strcmp(cbind->cmd, cmd) == 0) { + if(cbind->botid == botid && (botid || clientid == cbind->clientid) && !stricmp(cbind->cmd, cmd)) { if(cbind->channel_access) free(cbind->channel_access); if(chanaccess) { @@ -931,7 +931,7 @@ void bind_botwise_set_bind_flags(int botid, int clientid, char *cmd, unsigned in int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(cbind->botid == botid && (botid || clientid == cbind->clientid) && strcmp(cbind->cmd, cmd) == 0) { + if(cbind->botid == botid && (botid || clientid == cbind->clientid) && !stricmp(cbind->cmd, cmd)) { cbind->flags |= flags; return; } @@ -942,7 +942,7 @@ struct cmd_binding *find_botwise_cmd_binding(int botid, int clientid, char *cmd) int bind_index = get_binds_index(cmd[0]); struct cmd_binding *cbind; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { - if(cbind->botid == botid && (botid || clientid == cbind->clientid) && strcmp(cbind->cmd, cmd) == 0) { + if(cbind->botid == botid && (botid || clientid == cbind->clientid) && !stricmp(cbind->cmd, cmd)) { return cbind; } } -- 2.20.1