break;
}
*args_ptr = args;
- if(cbind->func->func == modcmd_linker) {
+ if(cbind && cbind->func->func == modcmd_linker) {
return modcmd_linker_command(client, user, cbind, bind_index, args_ptr);
}
return cbind;
int subcompos = 0;
for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) {
if(cbind->botid == client->botid && (cbind->botid || cbind->clientid == client->clientid) && stricmplen(cbind->cmd, command, commandlen) == 0) {
+ if(strstr(cbind->cmd + commandlen, " ")) continue; //ignore if there is another space in the command (sub-sub-command :D)
subcompos += sprintf(subcommands + subcompos, (subcompos ? ", %s" : "%s"), cbind->cmd + commandlen);
}
}
str_b = cbind->channel_access;
access_list[0] = '\0';
if(str_b) {
+ struct ChanUser *chanuser = getChanUser(user, chan);
str_c = strdup(str_b);
str_b = str_c;
while((str_a = str_b)) {
*str_b = '\0';
str_b++;
}
+ if(*str_a == '@' || *str_a == '+') {
+ //privs can override this access requirement
+ int priv = 0;
+ if(*str_a == '@') priv = CHANUSERFLAG_OPPED;
+ else if(*str_a == '%') priv = CHANUSERFLAG_HALFOPPED;
+ else if(*str_a == '+') priv = CHANUSERFLAG_VOICED;
+ if(chanuser && (chanuser->flags & priv)) continue;
+ str_a++;
+ }
if(*str_a == '#') {
str_a++;
access_pos += sprintf(access_list+access_pos, ", `%s`", str_a);