+void bind_botwise_unbound_required_functions(int botid, int clientid) {
+ struct cmd_function *cmdfunc;
+ int i, found;
+ struct cmd_binding *cbind;
+ for(cmdfunc = cmd_functions; cmdfunc; cmdfunc = cmdfunc->next) {
+ if((cmdfunc->flags & CMDFLAG_REQUIRED)) {
+ found = 0;
+ for(i = 0; i < 27; i++) {
+ for(cbind = cmd_binds[i]; cbind; cbind = cbind->next) {
+ if(cbind->botid == botid && (botid || clientid == cbind->clientid) && cbind->func == cmdfunc) {
+ found = 1;
+ break;
+ }
+ }
+ if(found)
+ break;
+ }
+ if(!found && bind_botwise_cmd_to_function(botid, clientid, cmdfunc->name, cmdfunc)) {
+ cbind = find_botwise_cmd_binding(botid, clientid, cmdfunc->name);
+ cbind->flags |= CMDFLAG_TEMPONARY_BIND;
+ }
+ }
+ }
+}
+
+void register_command_alias(int botid, char *alias) {
+ struct cmd_bot_alias *botalias;
+ for(botalias = bot_aliases; botalias; botalias = botalias->next) {
+ if(!stricmp(botalias->alias, alias))
+ return;
+ }
+ botalias = malloc(sizeof(*botalias));
+ if (!botalias) {
+ perror("malloc() failed");
+ return;
+ }
+ botalias->botid = botid;
+ botalias->alias = strdup(alias);
+ botalias->next = bot_aliases;
+ bot_aliases = botalias;
+}
+
+struct cmd_binding *getAllBinds(struct cmd_binding *last) {
+ int bind_index;
+ if(last) {
+ if(last->next)
+ return last->next;
+ bind_index = get_binds_index(last->cmd[0]) + 1;
+ if(bind_index > 26)
+ return NULL;
+ } else
+ bind_index = 0;
+ do {
+ if(cmd_binds[bind_index])
+ return cmd_binds[bind_index];
+ bind_index++;
+ } while(bind_index < 27);
+ return NULL;
+}