+ /* make heading str (uppercase) */
+ for (nn=0; topic[nn]; nn++)
+ cmdname[nn] = toupper(topic[nn]);
+ cmdname[nn] = 0;
+
+ /* If there is a command 'topic', send command help for the command */
+ if ((cmd = dict_find(service->commands, topic, NULL)))
+ {
+ send_message(user, service->bot, "MCMSG_HELP_COMMAND_HEADER", cmdname);
+ send_message(user, service->bot, "MCMSG_HELP_DIVIDER");
+ helpsent = send_help(user, service->bot, cmd->command->parent->helpfile, cmd->name);
+
+ /* Show if its an alias, or a binding of another command */
+ if (cmd->alias.used)
+ {
+ char alias_text[MAXLEN];
+ unsplit_string((char**)cmd->alias.list, cmd->alias.used, alias_text);
+ send_message(user, service->bot, "MCMSG_HELP_COMMAND_ALIAS", alias_text);
+ /* If send_help above didnt work, try again with the referenced command.. */
+ if(!helpsent)
+ helpsent = send_help(user, service->bot, cmd->command->parent->helpfile, alias_text);
+ }
+ else if(cmd->command->name && strcasecmp(cmd->command->name, cmd->name))
+ {
+ send_message(user, service->bot, "MCMSG_HELP_COMMAND_ALIAS", cmd->command->name);
+ /* If send_help above didnt work, try again with the referenced command.. */
+ if(!helpsent)
+ helpsent = send_help(user, service->bot, cmd->command->parent->helpfile, cmd->command->name);
+ }
+ /* If send_help still couldnt find it, tell them sorry */
+ if(!helpsent)
+ 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 */
+ {
+ /* 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++)
+ {
+ 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;
+ }
+ }
+ }