-/* cmd_global_commands.c - NeonServ v5.2
- * Copyright (C) 2011 Philipp Kreil (pk910)
+/* cmd_global_commands.c - NeonServ v5.3
+ * Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
struct cmd_binding *cbind;
int bindcount = 0;
for(cbind = getAllBinds(NULL); cbind; cbind = getAllBinds(cbind)) {
- if(cbind->botid == client->botid && !(cbind->func->flags & CMDFLAG_FUNCMD))
+ if(cbind->botid == client->botid && (cbind->botid || cbind->clientid == client->clientid) && !(cbind->func->flags & CMDFLAG_FUNCMD))
bindcount++;
}
struct cmd_binding *binds[bindcount];
bindcount = 0;
for(cbind = getAllBinds(NULL); cbind; cbind = getAllBinds(cbind)) {
- if(cbind->botid == client->botid && !(cbind->func->flags & CMDFLAG_FUNCMD))
+ if(cbind->botid == client->botid && (cbind->botid || cbind->clientid == client->clientid) && !(cbind->func->flags & CMDFLAG_FUNCMD))
binds[bindcount++] = cbind;
}
qsort(binds, bindcount, sizeof(struct cmd_binding *), global_cmd_commands_sort);
for(i = 0; i < table->entrys; i++) {
reply(getTextBot(), user, table_lines[i]);
}
-
+ table_free(table);
}
static int global_cmd_commands_sort(const void *a, const void *b) {
*str_b = '\0';
str_b++;
}
+ if(*str_a == '@' || *str_a == '+') {
+ //privs can override this access requirement
+ str_a++;
+ }
if(*str_a == '#') {
str_a++;
access_pos += sprintf(access_list+access_pos, (access_pos ? ", `%s`" : "`%s`"), str_a);