]> jfr.im git - irc/evilnet/x3.git/commitdiff
Fixing help to search all bound helpfiles for a topic.
authorrubin <redacted>
Tue, 24 May 2005 22:16:13 +0000 (22:16 +0000)
committerrubin <redacted>
Tue, 24 May 2005 22:16:13 +0000 (22:16 +0000)
ChangeLog.X3
src/modcmd.c
src/modcmd.help

index 1c5df12c3c2280a49fd6f758cca46b6881890e9f..9d557430452d05f2a558fe470751a2507ea76dae 100644 (file)
@@ -1,13 +1,25 @@
 /***********************************************************************
  X3 ChangeLog
 
 /***********************************************************************
  X3 ChangeLog
 
+2005-05-18  Alex Schumann  <rubin@afternet.org>
+
+       * src/modcmd.c: reed pointed out that modcmd non-command help wasnt
+       working, and pointed me to the opserv helpfiles command, which shows
+       what services search what help files.  This fixes the help command to
+       search that list as it should. Still need to modify the 'default'
+       helpfile search bindigs because I dont think chanserv should respond
+       to help from opserv's db, etc.  See opserv's 'helpfiles' command.
+
+       * src/modcmd.help: clarified 'helpfiles' help.
+
 2005-05-18  Alex Schumann  <rubin@afternet.org>
 
        * src/helpfile.c: make send_help() return true/false and not send
        errors so svccmd_send_help can 'take control' of things.
 
        * src/modcmd.c: Fixed up the help system (again) / find aliased
 2005-05-18  Alex Schumann  <rubin@afternet.org>
 
        * src/helpfile.c: make send_help() return true/false and not send
        errors so svccmd_send_help can 'take control' of things.
 
        * src/modcmd.c: Fixed up the help system (again) / find aliased
-       commands help if none exists.
+       commands help if none exists. / Display no help for that command on
+       commands (instead of topic)
 
        * src/modcmd.h: Fixed up the help system (again)
 
 
        * src/modcmd.h: Fixed up the help system (again)
 
index f3c2df6d5213231921b6c8d45cda8522286c91e3..75fb319f1f6a6165292ee9ecb072d4b32f630a09 100644 (file)
@@ -57,6 +57,7 @@ static const struct message_entry msgtab[] = {
     { "MCMSG_COMMAND_ALIASES", "%s is an alias for: %s" },
     { "MCMSG_HELP_COMMAND_ALIAS", "$uAlias for:$u %s" },
     { "MCMSG_HELP_COMMAND_HEADER", "Command help for: $b%s$b" },
     { "MCMSG_COMMAND_ALIASES", "%s is an alias for: %s" },
     { "MCMSG_HELP_COMMAND_ALIAS", "$uAlias for:$u %s" },
     { "MCMSG_HELP_COMMAND_HEADER", "Command help for: $b%s$b" },
+    { "MCMSG_HELP_COMMAND_UNKNOWN", "No help available for that command." },
     { "MCMSG_HELP_TOPIC_HEADER",   "Help topic: $b%s$b" },
     { "MCMSG_HELP_DIVIDER", "=---------------------------------------=" },
     { "MCMSG_HELP_FOOTER",  "=------------- End of Help -------------=" },
     { "MCMSG_HELP_TOPIC_HEADER",   "Help topic: $b%s$b" },
     { "MCMSG_HELP_DIVIDER", "=---------------------------------------=" },
     { "MCMSG_HELP_FOOTER",  "=------------- End of Help -------------=" },
@@ -788,7 +789,7 @@ svccmd_send_help(struct userNode *user, struct service *service, const char *top
     struct module *module;
     struct svccmd *cmd;
     char cmdname[MAXLEN];
     struct module *module;
     struct svccmd *cmd;
     char cmdname[MAXLEN];
-    unsigned int nn;
+    unsigned int nn, ii;
     int helpsent = 0;
 
     /* If there is no topic show the index */
     int helpsent = 0;
 
     /* If there is no topic show the index */
@@ -825,24 +826,33 @@ svccmd_send_help(struct userNode *user, struct service *service, const char *top
         } 
         /* If send_help still couldnt find it, tell them sorry */
         if(!helpsent)
         } 
         /* If send_help still couldnt find it, tell them sorry */
         if(!helpsent)
-            send_message(user, service->bot, "MSG_TOPIC_UNKNOWN");
+            send_message(user, service->bot, "MCMSG_HELP_COMMAND_UNKNOWN");
         send_message(user, service->bot, "MCMSG_HELP_FOOTER");
         return true;
     }
     else /* look for topic in the help files loaded to this nick/service */
     {
         send_message(user, service->bot, "MCMSG_HELP_FOOTER");
         return true;
     }
     else /* look for topic in the help files loaded to this nick/service */
     {
-        /* Check for non command help in first primary help file, then 
-         * check for help for this on another service and provide a tip */
-            module = service->modules.list[0];
-            if (module->helpfile && dict_find(module->helpfile->db, topic, NULL))
+        /* Check for non command help in first primary help file, then next and so on */ 
+        /* Note - we need to think about default bindings. see opserv.helpfiles */
+            for(ii = 0; ii < service->modules.used; ii++)
             {
             {
-
-                send_message(user, service->bot, "MCMSG_HELP_TOPIC_HEADER", cmdname);
-                send_message(user, service->bot, "MCMSG_HELP_DIVIDER");
-                if(!send_help(user, service->bot, module->helpfile, topic))
-                    send_message(user, service->bot, "MSG_TOPIC_UNKNOWN");
-                send_message(user, service->bot, "MCMSG_HELP_FOOTER");
-                return true;
+                module = service->modules.list[ii];
+                if(!module->helpfile)
+                    continue;
+                if(dict_find(module->helpfile->db, topic, NULL))
+                {
+                    if (module->helpfile && dict_find(module->helpfile->db, topic, NULL))
+                    {
+
+                        send_message(user, service->bot, "MCMSG_HELP_TOPIC_HEADER", cmdname);
+                        send_message(user, service->bot, "MCMSG_HELP_DIVIDER");
+                        /* This should never fail but maybe if something is odd? */
+                        if(!send_help(user, service->bot, module->helpfile, topic))
+                            send_message(user, service->bot, "MSG_TOPIC_UNKNOWN");
+                        send_message(user, service->bot, "MCMSG_HELP_FOOTER");
+                        return true;
+                    }
+                }
             }
     }
     /* Otherwise say we cant find it */
             }
     }
     /* Otherwise say we cant find it */
index 2512feaa3ab005dfebc6430cde5daa7d26ebd07b..5ee7a14e4c40af093f3355fa9b8228a717a23e16 100644 (file)
 
 "helpfiles" ("/msg $S HELPFILES <service> [module list]",
         "With only a service nick, shows the helpfiles used by that service.",
 
 "helpfiles" ("/msg $S HELPFILES <service> [module list]",
         "With only a service nick, shows the helpfiles used by that service.",
-        "With a list of modules, sets the order that the service will look up non-command help entries.",
+        "Give a list of modules (seperated by spaces), to set the order that the service will look up non-command help entries.",
         "$uSee Also:$u bind, unbind");
 
 "service add" ("/msg $S SERVICE ADD <nick> <hostname> <description>",
         "$uSee Also:$u bind, unbind");
 
 "service add" ("/msg $S SERVICE ADD <nick> <hostname> <description>",