[srvx-commits] CVS: services/src chanserv.c,1.386,1.387 chanserv.help,1.53,1.54 helpfile.c,1.65,1.66
Brought to you by:
entrope
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv30859/src Modified Files: chanserv.c chanserv.help helpfile.c modcmd.c modcmd.h modcmd.help nickserv.c nickserv.help.m4 Log Message: move standard "help commands" entry into modcmd.c Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.386 retrieving revision 1.387 diff -C2 -r1.386 -r1.387 *** chanserv.c 10 Oct 2003 02:52:58 -0000 1.386 --- chanserv.c 18 Oct 2003 15:52:21 -0000 1.387 *************** *** 1124,1139 **** } - static int - append_entry(const char *key, UNUSED_ARG(void *data), void *extra) - { - struct helpfile_expansion *exp = extra; - int row; - - row = exp->value.table.length++; - exp->value.table.contents[row] = calloc(1, sizeof(char*)); - exp->value.table.contents[row][0] = key; - return 0; - } - static char max_length_text[MAXLEN+1][16]; --- 1124,1127 ---- *************** *** 1143,1159 **** struct helpfile_expansion exp; ! if(!irccasecmp(variable, "index")) ! { ! exp.type = HF_TABLE; ! exp.value.table.length = 1; ! exp.value.table.width = 1; ! exp.value.table.flags = TABLE_REPEAT_ROWS; ! exp.value.table.contents = calloc(dict_size(chanserv_service->commands)+1, sizeof(char**)); ! exp.value.table.contents[0] = calloc(1, sizeof(char*)); ! exp.value.table.contents[0][0] = "Commands:"; ! dict_foreach(chanserv_service->commands, append_entry, &exp); ! return exp; ! } ! else if(!irccasecmp(variable, "notes")) { dict_iterator_t it; --- 1131,1135 ---- struct helpfile_expansion exp; ! if(!irccasecmp(variable, "notes")) { dict_iterator_t it; *************** *** 3579,3582 **** --- 3555,3559 ---- tmp_table.width = list->table.width; tmp_table.flags = list->table.flags; + list->table.contents[0][0] = " "; for(start = curr = 1; curr < list->table.length; ++curr) { *************** *** 3674,3678 **** ary = malloc(lData.table.width*sizeof(**lData.table.contents)); lData.table.contents[0] = ary; ! ary[0] = " "; ary[1] = "Account"; ary[2] = "Last Seen"; --- 3651,3655 ---- ary = malloc(lData.table.width*sizeof(**lData.table.contents)); lData.table.contents[0] = ary; ! ary[0] = "Access"; ary[1] = "Account"; ary[2] = "Last Seen"; Index: chanserv.help =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.help,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** chanserv.help 1 Sep 2003 14:52:45 -0000 1.53 --- chanserv.help 18 Oct 2003 15:52:21 -0000 1.54 *************** *** 8,12 **** " OPER Helper/Operator commands." ); - "COMMANDS" "${index}"; "USER" ("$bUser commands:$b", " ACCESS Check your own or another person's access to a channel.", --- 8,11 ---- Index: helpfile.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpfile.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -r1.65 -r1.66 *** helpfile.c 10 Oct 2003 02:41:01 -0000 1.65 --- helpfile.c 18 Oct 2003 15:52:21 -0000 1.66 *************** *** 31,34 **** --- 31,35 ---- extern struct userNode *global, *chanserv, *opserv, *nickserv; struct userNode *message_dest; + struct userNode *message_source; void *************** *** 52,55 **** --- 53,57 ---- #endif } + message_source = from; /* If size or irc_send are 0, we should try to use a default. */ *************** *** 170,173 **** --- 172,176 ---- #endif } + message_source = src; /* fill in a buffer with the string */ input.used = 0; Index: modcmd.c =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -r1.70 -r1.71 *** modcmd.c 7 Oct 2003 03:42:06 -0000 1.70 --- modcmd.c 18 Oct 2003 15:52:21 -0000 1.71 *************** *** 1825,1828 **** --- 1825,1860 ---- } + static int + append_entry(const char *key, UNUSED_ARG(void *data), void *extra) { + struct helpfile_expansion *exp = extra; + int row = exp->value.table.length++; + exp->value.table.contents[row] = calloc(1, sizeof(char*)); + exp->value.table.contents[row][0] = key; + return 0; + } + + static struct helpfile_expansion + modcmd_expand(const char *variable) { + struct helpfile_expansion exp; + extern struct userNode *message_source; + struct service *service; + + service = dict_find(services, message_source->nick, NULL); + if (!irccasecmp(variable, "index")) { + exp.type = HF_TABLE; + exp.value.table.length = 1; + exp.value.table.width = 1; + exp.value.table.flags = TABLE_REPEAT_ROWS; + exp.value.table.contents = calloc(dict_size(service->commands)+1, sizeof(char**)); + exp.value.table.contents[0] = calloc(1, sizeof(char*)); + exp.value.table.contents[0][0] = "Commands:"; + dict_foreach(service->commands, append_entry, &exp); + return exp; + } + exp.type = HF_STRING; + exp.value.str = NULL; + return exp; + } + void modcmd_init(void) { *************** *** 1835,1839 **** reg_exit_func(modcmd_cleanup); ! modcmd_module = module_register("modcmd", MAIN_LOG, "modcmd.help", NULL); bind_command = modcmd_register(modcmd_module, "bind", cmd_bind, 4, MODCMD_KEEP_BOUND, "access", "800", NULL); help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, "flags", "+nolog", NULL); --- 1867,1871 ---- reg_exit_func(modcmd_cleanup); ! modcmd_module = module_register("modcmd", MAIN_LOG, "modcmd.help", modcmd_expand); bind_command = modcmd_register(modcmd_module, "bind", cmd_bind, 4, MODCMD_KEEP_BOUND, "access", "800", NULL); help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, "flags", "+nolog", NULL); *************** *** 2130,2134 **** saxdb_register("modcmd", modcmd_saxdb_read, modcmd_saxdb_write); create_default_binds(); ! if (!saxdb_present) import_aliases_db(); /* Resolve command rule-templates. */ --- 2162,2167 ---- saxdb_register("modcmd", modcmd_saxdb_read, modcmd_saxdb_write); create_default_binds(); ! if (!saxdb_present) ! import_aliases_db(); /* Resolve command rule-templates. */ Index: modcmd.h =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** modcmd.h 7 Oct 2003 03:42:07 -0000 1.21 --- modcmd.h 18 Oct 2003 15:52:21 -0000 1.22 *************** *** 99,103 **** struct module_list modules; dict_t commands; /* contains struct svccmd* */ - struct helpserv_bot *hs; unsigned int privileged : 1; char trigger; --- 99,102 ---- Index: modcmd.help =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.help,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** modcmd.help 26 Sep 2003 15:27:17 -0000 1.11 --- modcmd.help 18 Oct 2003 15:52:21 -0000 1.12 *************** *** 8,11 **** --- 8,12 ---- "(A command binding is very similar to an alias, but only pays the speed penalty for alias expansion when there are additional arguments in the binding.)", "$uSee also:$u unbind"); + "commands" "${index}"; "god" ("/msg $C GOD [on|off]", "Toggles security override, which grants you complete access to all channels. Please use carefully."); Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.263 retrieving revision 1.264 diff -C2 -r1.263 -r1.264 *** nickserv.c 8 Oct 2003 03:46:35 -0000 1.263 --- nickserv.c 18 Oct 2003 15:52:21 -0000 1.264 *************** *** 2559,2592 **** } - static struct helpfile_expansion - nickserv_help_expand(const char *variable) - { - struct helpfile_expansion exp; - dict_iterator_t it; - int row; - const char *cmdname; - - if (!irccasecmp(variable, "index")) { - exp.type = HF_TABLE; - exp.value.table.length = 1; - exp.value.table.width = 1; - exp.value.table.flags = TABLE_REPEAT_ROWS; - exp.value.table.contents = calloc(dict_size(nickserv_service->commands)+1, sizeof(char**)); - exp.value.table.contents[0] = calloc(1, sizeof(char*)); - exp.value.table.contents[0][0] = "Commands:"; - for (it=dict_first(nickserv_service->commands); it; it=iter_next(it)) { - cmdname = iter_key(it); - if (strchr(cmdname, ' ')) continue; - row = exp.value.table.length++; - exp.value.table.contents[row] = calloc(1, sizeof(char*)); - exp.value.table.contents[row][0] = cmdname; - } - } else { - exp.type = HF_STRING; - exp.value.str = NULL; - } - return exp; - } - static handle_merge_func_t *handle_merge_func_list; static unsigned int handle_merge_func_size = 0, handle_merge_func_used = 0; --- 2559,2562 ---- *************** *** 3507,3511 **** dict_set_free_data(nickserv_email_dict, nickserv_free_email_addr); ! nickserv_module = module_register("NickServ", NS_LOG, "nickserv.help", nickserv_help_expand); modcmd_register(nickserv_module, "AUTH", cmd_auth, 2, MODCMD_KEEP_BOUND, "flags", "+qualified,+loghostmask", NULL); nickserv_define_func("ALLOWAUTH", cmd_allowauth, 0, 1, 0); --- 3477,3481 ---- dict_set_free_data(nickserv_email_dict, nickserv_free_email_addr); ! nickserv_module = module_register("NickServ", NS_LOG, "nickserv.help", NULL); modcmd_register(nickserv_module, "AUTH", cmd_auth, 2, MODCMD_KEEP_BOUND, "flags", "+qualified,+loghostmask", NULL); nickserv_define_func("ALLOWAUTH", cmd_allowauth, 0, 1, 0); Index: nickserv.help.m4 =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.help.m4,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** nickserv.help.m4 10 Oct 2003 03:27:35 -0000 1.20 --- nickserv.help.m4 18 Oct 2003 15:52:21 -0000 1.21 *************** *** 11,15 **** " OTHERS Other functions.", " COMMANDS A list of all available commands."); - "COMMANDS" ("$({i}ndex)"); "HANDLE" ("The term $uhandle$u from earlier versions was confusing to many new users. Therefore, it has been changed to $uaccount$u."); --- 11,14 ---- |