Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv22961/src
Modified Files:
modcmd.c modcmd.help
Log Message:
document cmd_joiner and make it look up subcommands if you don't give it any
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** modcmd.c 7 Sep 2002 02:41:49 -0000 1.23
--- modcmd.c 7 Sep 2002 02:55:18 -0000 1.24
***************
*** 75,78 ****
--- 75,79 ----
#define MSMSG_NOW_HELPING "Security override has been enabled."
#define MSMSG_NOW_NOT_HELPING "Security override has been disabled."
+ #define MCMSG_JOINER_CHOICES "Subcommands of %s: %s"
struct pending_template {
***************
*** 1191,1195 ****
char cmdname[80];
! assert(argc >= 2);
sprintf(cmdname, "%s %s", cmd->name, argv[1]);
argv[1] = cmdname;
--- 1192,1211 ----
char cmdname[80];
! if (argc < 2) {
! int len = sprintf(cmdname, "%s ", cmd->name);
! dict_iterator_t it;
! struct string_buffer sbuf;
!
! string_buffer_init(&sbuf);
! for (it = dict_first(cmd->parent->commands); it; it = iter_next(it)) {
! if (!ircncasecmp(iter_key(it), cmdname, len)) {
! if (sbuf.used) string_buffer_append_string(&sbuf, ", ");
! string_buffer_append_string(&sbuf, iter_key(it));
! }
! }
! reply(MCMSG_JOINER_CHOICES, cmd->name, sbuf.list);
! string_buffer_clean(&sbuf);
! return 1;
! }
sprintf(cmdname, "%s %s", cmd->name, argv[1]);
argv[1] = cmdname;
Index: modcmd.help
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.help,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** modcmd.help 7 Sep 2002 02:31:33 -0000 1.3
--- modcmd.help 7 Sep 2002 02:55:18 -0000 1.4
***************
*** 51,52 ****
--- 51,54 ----
" SUPPORTHELPER Allow support helpers to use the command",
"Note: If any of SUPPORTHELPER, NETWORKHELPER, OPER, any of the specified flags is considered sufficient. For example, NETWORKHELPER and OPER both specified means both network helpers and opers can use the command.");
+ "joiner" ("/msg $S JOINER [subcmd ...]",
+ "Magically looks up subcommands and redirects to them. Use the command by itself to see what subcommands are known.");
|