]> jfr.im git - irc/quakenet/newserv.git/commitdiff
More help system stuff.
authorsplidge <redacted>
Fri, 7 Mar 2008 12:08:07 +0000 (12:08 +0000)
committersplidge <redacted>
Fri, 7 Mar 2008 12:08:07 +0000 (12:08 +0000)
mkcommandlist.pl will now pick out lines tagged CMDHELP: and add their content to the default help string for that command.  Added help for LOGIN as proof of concept/test.

chanserv/authcmds/commandlist.c
chanserv/authcmds/login.c
chanserv/mkcommandlist.pl

index 3cfd5e2baa4518a0af2a8743b70b8f7875a273eb..ce707d210a8930d91f712fb620f8a8dec13b08b1 100644 (file)
@@ -24,7 +24,7 @@ void _init() {
   chanservaddcommand("checkhashpass", QCMD_OPER, 3, csa_docheckhashpass, "Checks supplied password against a version hashed in the database.", "");
   chanservaddcommand("email", QCMD_SECURE | QCMD_AUTHED, 3, csa_doemail, "Change your email address.", "");
   chanservaddcommand("hello", QCMD_NOTAUTHED, 2, csa_dohello, "Creates a new user account.", "");
-  chanservaddcommand("login", QCMD_SECURE | QCMD_NOTAUTHED, 2, csa_doauth, "Authenticates you on the bot.", "");
+  chanservaddcommand("login", QCMD_SECURE | QCMD_NOTAUTHED, 2, csa_doauth, "Authenticates you on the bot.", "Usage: login <username> <password>\nAuthenticates using the supplied username and password.\n");
   chanservaddcommand("newpass", QCMD_SECURE | QCMD_AUTHED, 3, csa_donewpw, "Change your password.", "");
   chanservaddcommand("requestpassword", QCMD_NOTAUTHED, 2, csa_doreqpw, "Requests the current password by email.", "");
   chanservaddcommand("setemail", QCMD_OPER, 2, csa_dosetmail, "Set the email address.", "");
index 5a8d1b579cfb9d587d4c8bb8fd9464c56a213047..60c18baeb3cda95b7a15c7b421e22a3c09f80d05 100644 (file)
@@ -7,6 +7,8 @@
  * CMDDESC: Authenticates you on the bot.
  * CMDFUNC: csa_doauth
  * CMDPROTO: int csa_doauth(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: login <username> <password>
+ * CMDHELP: Authenticates using the supplied username and password.
  */
 
 #include "../chanserv.h"
index b8d6484c0d52ab686637afdce740a29558ef8f44..224ded30c4224bfad0d52f985f718be7c48f3023 100755 (executable)
@@ -9,6 +9,7 @@ my @cmddesc;
 my @cmdfunc;
 my @protos;
 my @files;
+my @help;
 
 my @filelist = <*.c>;
 
@@ -25,7 +26,8 @@ for (@filelist) {
   next if (/commandlist.c/);
   
   my $fname = $_;
-  my ($cn, $cl, $ca, $cd, $cf, $cp);
+  my ($cn, $cl, $ca, $cd, $cf, $cp, $ch);
+  $ch="";
 
   open INFILE,"<$fname";
   
@@ -55,6 +57,10 @@ for (@filelist) {
     if (/CMDPROTO: (.*)/) {
       $cp=$1;
     }
+    
+    if (/CMDHELP: (.*)/) {
+      $ch.=$1."\\n";
+    }
   }
   
   if (defined $cn and defined $cl and defined $ca and defined $cd and defined $cf and defined $cp) {
@@ -66,6 +72,7 @@ for (@filelist) {
     push @cmddesc, $cd;
     push @cmdfunc, $cf;
     push @protos, $cp;
+    push @help, $ch;
   } else {
     print "Warning: found source file $fname without complete tags, skipping...\n";
   }
@@ -96,7 +103,7 @@ print CL "\nvoid _init() {\n";
 
 while (my $cn = shift @cmdnames) {
   print CL "  chanservaddcommand(\"".$cn."\", ".(shift @cmdlevels).", ".(shift @cmdargs).", ";
-  print CL (shift @cmdfunc).", \"".(shift @cmddesc)."\", \"\");\n";
+  print CL (shift @cmdfunc).", \"".(shift @cmddesc)."\", \"".(shift @help),"\");\n";
 }
 
 print CL "}\n\nvoid _fini() {\n";