More helpfile fixes
authorMichael Poole <mdpoole@troilus.org>
Sun, 28 Mar 2004 03:28:18 +0000 (03:28 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sun, 28 Mar 2004 03:28:18 +0000 (03:28 +0000)
* Allow a helpfile to use another module's expansion function by using
the syntax ${module:variable}, so that "set language" can be kept in
nickserv.help.

* Fix typos, unclear help entries, and add some missing entries.
git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-35

src/chanserv.help
src/helpfile.c
src/modcmd.help
src/nickserv.help
src/proto-bahamut.c
src/proto-p10.c

index 7d3229ecc26fdae32741ac5682114c47ded0b1c7..b8d59f91d4a7cdd7176df6f947e1ee5c2a214ec1 100644 (file)
@@ -5,9 +5,9 @@
         "  CHANNEL         Channel management.",
         "  BAN MANAGEMENT  Ban management.",
         "  INFORMATION     Informative commands.",
-        "  OPER            Helper/Operator commands."
+        "  OPER            Helper/IRC Operator commands."
 );
-"USER" ("$bUser commands:$b",
+"USER" ("$bUser Management Commands:$b",
         "  ACCESS      Check someone's access in a channel.",
         "  MYACCESS    Show all channels where you have access.",
         "  ADDCOOWNER  Give another person coowner status in a channel.",
         "  MDELOP             ops with accounts matching a mask.",
         "  MDELPEON           peons with accounts matching a mask.",
        "  TRIM        Remove users inactive for a certain period.",
-        "  UP          Obtain ops in a channel you have access to.",
-        "  DOWN        Remove ops",
-        "  UPALL       Obtain ops in all channels you have access to.",
-        "  DOWNALL     Remove ops in all",
+        "  UP          Give you ops in a channel you have access to.",
+        "  DOWN        Remove your ops in a channel.",
+        "  UPALL       Give you ops in all channels you have access to.",
+        "  DOWNALL     Remove your ops in all channels.",
         "  OP          Give ops to the specified user.",
         "  DEOP        Remove ops from the specified user.",
         "  VOICE       Give voice to the specified user.",
@@ -41,7 +41,7 @@
         "  KICK        Kick a user from a channel.",
         "  BAN         Ban a user from a channel.",
         "  KICKBAN     Kick and ban a user from a channel.",
-        "  BANS        List lasting bans in a channel",
+        "  BANS        List lasting bans in a channel.",
         "  ADDBAN      Add a permanent ban for a user.",
         "  ADDTIMEDBAN Add a ban that expires in the specified time.",
         "  UNBAN       Remove the specified ban from the channel.",
@@ -69,7 +69,7 @@
         "  RESYNC      Synchronize ops and voice with the channel userlist."
 );
 "INFORMATION" ("$bInformative Commands:$b",
-        "  VERSION     Check the current running version of $C",
+        "  VERSION     Check the current running version of $C.",
         "  NETINFO     Check current network-wide information.",
         "  STAFF       Get a list of all the current staff.",
         "  IRCOPS                                    IRC operators.",
 "ADDBAN" ("/msg $C ADDBAN <#channel> <mask|nick> [Reason]",
         "Adds a ban to the channels permanent ban list, remaining in effect until removed with the DELBAN command. If it exactly matches an existing ban already in the list, the reason will be updated. If the existing ban was a timed ban, it will be extended into a permanent ban.",
         "$uSee Also:$u bans, delban, mdelban");
-"ADDUSER" ("/msg $C ADDUSER <#channel><nick|*account> <level>",
+"ADDUSER" ("/msg $C ADDUSER <#channel> <nick|*account> <level>",
         "This command adds someone to the channel user list with the specified access level.  (You may only add users to levels less than your own.)",
         "The level may be one of $bpeon$b, $bop$b, $bmaster$b, $bcoowner$b, $bowner$b, or a number between 1 and 500.  Only network staff may add level 500 users (owners).",
         "$uSee Also:$u deluser, users");
         "This command responds with various pieces of information about a channel's users, status, and registration.");
 "INVITE" ("/msg $C INVITE <#channel> [nick [reason]]",
         "Invites a user into the channel, sending them a reason if one is provided. However, unless you have at least $bmaster$b access, you can only invite yourself with this command. If no nick is provided, the user issuing the command will be invited.");
+"INVITEME" ("/msg $S INVITEME <#channel>",
+        "Invites you into the channel.");
 "IRCOPS" ("/msg $C IRCOPS",
         "Lists all the IRC operators currently online. Nicknames enclosed in parentheses are away, and likely unavailable.",
         "$uSee Also:$u staff");
         "This sets a pattern that $C allows for the topic.  A $b*$b will match any number of characters (including 0); a $b?$b will match any single character -- the same as with IRC hostmasks.  A user may set a topic if either $btopicmask$b or $benftopic$b allow it.",
         "For example, $b!set topicmask Hello *$b allows anyone to set the topic to be $bHello world$b, but they must be able to override the topic (according to the $bEnfTopic$b setting) to set the topic to $bGoodbye world$b.",
         "You may \"escape\" those characters by putting a \\ before them in the topic mask; for example, $b!set topicmask Whassup\\?$b would only allow the topic to be $bWhassup?$b, while leaving out the \\ would allow the topic to be $bWhassup!$b (among other things).",
-        "For ease of use, if the TopicMask has only one * and no ?, then using $b!topic something$b will (if $bsomething$b does not match the TopicMask and you cannot override the topic lock) replace the * with the text $bsomething$b.",
+        "For ease of use, if the TopicMask has only one * and no ?, then using $b!topic something$b will (if $bsomething$b does not match the TopicMask and you cannot override the topic lock) replace the * with the text $bsomething$b.  If there is more than one * or any ? at all, $b!topic something$b will not work like that.",
         "$uSee Also:$u set, set topic, set enftopic");
 "SET TOYS" ("/msg $C SET <#channel> TOYS <value>",
        "This setting changes how $C will respond to commands like !8ball, or whether it responds at all.  Valid settings are:",
         "Displays up to a certain limit, all channels registered with $b$C$b that have not been visited within a certain duration. If a duration is not provided, a default will be used.",
         "$bSee Also:$b expire, search, durations");
 "UP" ("/msg $C UP <#channel>",
-        "For a peon, this will cause $b$C$b to voice the user executing the command. For anyone of level op on higher on the userlist, this will cause $b$C$b to op the user executing the command.");
+        "Grants you your normal channel privileges.  If your access in the channel is less than the GiveVoice setting, this does nothing.  Otherwise, if your access is less than the GiveOps setting, $b$C$b will give you voice.  If your access is at least GiveOps, $b$C$b will give you ops.");
 "UPALL" ("/msg $C UPALL",
         "Executes the $bup$b command for each channel you have access in.",
         "$uSee Also:$u up, down, downall");
         "$bGameSurge IRC Network$b - All the users and staff there bear with our shortcomings and bugs and let us know what needs to be fixed.",
         "$bIC5 Networks$b (and JohnM in particular) - Never afraid to critique things, even if we are the 800 pound gorilla.",
         "$bMeeko, eraser, hock(ey), KilledInAction, MadEwokHerd, Milon and Shoat$b - Hardcore beta testing and bug finding on the testnet.",
-        "$bCrips$b - Reading through all the boring messages and finding ways to make them clearer.");
+        "$bCrips and feigling$b - Reading through all the boring messages and finding ways to make them clearer.");
index ad8c76c96a0739598837b278bcae5198529e456e..709e37cbb516f06f8b44d85952ab8c7b0fb08bb3 100644 (file)
@@ -21,6 +21,7 @@
 #include "conf.h"
 #include "helpfile.h"
 #include "log.h"
+#include "modcmd.h"
 #include "nickserv.h"
 
 #include <dirent.h>
@@ -533,44 +534,58 @@ vsend_message(const char *dest, struct userNode *src, struct handle_info *handle
 #define SEND_LINE() do { line[pos] = 0; if (pos > 0) irc_send(src, dest, line); chars_sent += pos; pos = 0; newline_ipos = ipos; } while (0)
        /* Custom expansion handled by helpfile-specific function. */
        case '{':
-       case '(':
-           if (expand_f) {
-               char *name_end = input.list + ipos + 1;
-
-               while (*name_end != '}' && *name_end != ')' && *name_end) name_end++;
-               if (*name_end) {
-                    struct helpfile_expansion exp;
-                   *name_end = 0;
-                   exp = expand_f(input.list + ipos + 1);
-                    switch (exp.type) {
-                    case HF_STRING:
-                        free_value = value = exp.value.str;
-                        if (!value)
-                            value = "";
-                        break;
-                    case HF_TABLE:
-                        /* Must send current line, then emit table. */
-                        SEND_LINE();
-                        table_send(src, (message_dest ? message_dest->nick : dest), 0, irc_send, exp.value.table);
-                        value = "";
-                        break;
-                    default:
-                        value = "";
-                        log_module(MAIN_LOG, LOG_ERROR, "Invalid exp.type %d from expansion function %p.", exp.type, expand_f);
-                        break;
-                    }
-                   ipos = name_end - input.list;
-                   break;
-               }
-           }
-
-       /* Let it fall through when there's no expansion function or
-       terminating ')'. */
+       case '(': {
+            struct helpfile_expansion exp;
+            char *name_end = input.list + ipos + 1, *colon = NULL;
+
+            while (*name_end != '}' && *name_end != ')' && *name_end) {
+                if (*name_end == ':') {
+                    colon = name_end;
+                    *colon = '\0';
+                }
+                name_end++;
+            }
+            if (!*name_end)
+                goto fallthrough;
+            *name_end = '\0';
+            if (colon) {
+                struct module *module = module_find(input.list + ipos + 1);
+                if (module && module->expand_help)
+                    exp = module->expand_help(colon + 1);
+                else {
+                    *colon = ':';
+                    goto fallthrough;
+                }
+            } else if (expand_f)
+                exp = expand_f(input.list + ipos + 1);
+            else
+                goto fallthrough;
+            switch (exp.type) {
+            case HF_STRING:
+                free_value = value = exp.value.str;
+                if (!value)
+                    value = "";
+                break;
+            case HF_TABLE:
+                /* Must send current line, then emit table. */
+                SEND_LINE();
+                table_send(src, (message_dest ? message_dest->nick : dest), 0, irc_send, exp.value.table);
+                value = "";
+                break;
+            default:
+                value = "";
+                log_module(MAIN_LOG, LOG_ERROR, "Invalid exp.type %d from expansion function %p.", exp.type, expand_f);
+                break;
+            }
+            ipos = name_end - input.list;
+            break;
+        }
        default:
-               value = alloca(3);
-               value[0] = '$';
-               value[1] = input.list[ipos];
-               value[2] = 0;
+        fallthrough:
+            value = alloca(3);
+            value[0] = '$';
+            value[1] = input.list[ipos];
+            value[2] = 0;
        }
        ipos++;
         while ((pos + strlen(value) > size) || strchr(value, '\n')) {
index 116a3d755b1ef82a3132ed0260fae3133f08d226..a0fbe49894482b343b946a8ce42e1e039ff96f55 100644 (file)
@@ -13,7 +13,7 @@
 "help" ("/msg $S HELP [command]",
         "Help will show you the information for the given command.",
         "All help files will use the same syntax, with optional parameters listed in [] and required parameters listed in <>.",
-        "To see what commands are available for use with $S, type /msg $S help index. For help on any specific command or topic, type /msg $S help help command.");
+        "To see what commands are available for use with $S, type /msg $S help commands. For help on any specific command or topic, type /msg $S help command.");
 "readhelp" ("/msg $S READHELP <module>",
         "Re-reads the module's help file from disk.",
         "$uSee Also:$u help");
@@ -84,8 +84,5 @@
 "service remove" ("/msg $S SERVICE REMOVE <nick> [<quit reason>]",
         "Destroys a service.  If a default service is named, it will be recreated when srvx restarts.",
         "$uSee Also:$u service add, service rename, service trigger");
-"set language" ("/msg $S set language <langname>",
-        "Sets the language that $S and other services will use when sending you messages.",
-        "If a particular message is not available in your language, it will use the closest match it has.",
-        "Supported languages are: ${languages}",
-        "$uSee Also:$u set");
+"version" ("/msg $S version",
+        "Sends you version and copyright information for this software.");
index 8fe3468ef83eafc8be805ca9c02f5f69f96faaff..82a33092c25cee1539e74865309bcc087c97ecab 100644 (file)
         "$uSee Also:$u accountinfo, nickinfo, userinfo"
         );
 };
+"SET LANGUAGE" ("/msg $S SET LANGUAGE <langname>",
+        "Sets the language that $S and other services will use when sending you messages.",
+        "If a particular message is not available in your language, it will use the closest match it has.",
+        "Supported languages are: ${modcmd:languages}",
+        "$uSee Also:$u set");
 "STATUS" {
         "/services/nickserv/disable_nicks" (
         "/msg $N STATUS",
 "USERINFO" ("/msg $N USERINFO <nick>",
         "Shows what account the nick specified is authenticated to.",
         "$uSee Also:$u auth, accountinfo");
-"VERSION" ("/msg $N VERSION",
-        "Sends you the srvx version and some additional version information that is specific to $b$N$b.");
 "GHOST" ("/msg $N GHOST <nick>",
         "This disconnects an old client that is authed to your account.  This is $bnot$b the same thing as nick ownership; the user $bmust$b be authenticated to the same account you are.",
         "$uSee Also:$u auth");
         );
 };
 "MERGE" {
-        "!services/nickserv/disable_nicks" ("/msg $N MERGE <from-nick|*from-account> <to-nick|*to-account>",
+        "!/services/nickserv/disable_nicks" (
+        "/msg $N MERGE <from-nick|*from-account> <to-nick|*to-account>",
         "Merge access from $bfrom-account$b into $bto-account$b.  This includes hostmasks, registered nicks, authed users, access in channels, and $O access (if any).  If $bto-account$b has equal  or greater access than $bfrom-account$b (or more a general hostmask, etc), $bto-account$b keeps that information.",
         "This command is only accessible to helpers and IRC operators.",
         "$uSee Also:$u rename"
         );
-        "services/nickserv/disable_nicks" ("/msg $N MERGE <from-nick|*from-account> <to-nick|*to-account>",
+        "/services/nickserv/disable_nicks" ("/msg $N MERGE <from-nick|*from-account> <to-nick|*to-account>",
         "Merge access from $bfrom-account$b into $bto-account$b.  This includes hostmasks, authed users, access in channels, and $O access (if any).  If $bto-account$b has equal  or greater access than $bfrom-account$b (or more a general hostmask, etc), $bto-account$b keeps that information.",
         "This command is only accessible to helpers and IRC operators.",
         "$uSee Also:$u rename"
index 7b96a42a81019ef6a91a45f34c8332501fcd16b6..e0e9deced79873c4cdfd8f4a68e6c46b55227f26 100644 (file)
@@ -1269,6 +1269,7 @@ mod_chanmode_parse(struct chanNode *channel, char **modes, unsigned int argc, un
         default:
             if (!(flags & MCP_FROM_SERVER))
                 goto error;
+            break;
         }
     }
     change->argc = argc; /* in case any turned out to be ignored */
index d7de9896797b9e706d867b76186f5a74574f7e74..5a5e5a974e4807b332650fd6e65ac6d6cbe41180 100644 (file)
@@ -2056,6 +2056,7 @@ mod_chanmode_parse(struct chanNode *channel, char **modes, unsigned int argc, un
         default:
             if (!(flags & MCP_FROM_SERVER))
                 goto error;
+            break;
         }
     }
     change->argc = ch_arg; /* in case any turned out to be ignored */