diff --git a/docs/conf/helpop.conf.example b/docs/conf/help.conf.example similarity index 82% rename from docs/conf/helpop.conf.example rename to docs/conf/help.conf.example index 2f3035bff..d918021ec 100644 --- a/docs/conf/helpop.conf.example +++ b/docs/conf/help.conf.example @@ -1,34 +1,34 @@ -# Sample configuration file for the helpop module. +# Sample configuration file for the help module. # You can either copy this into your conf folder and set up the module to use it, # or you can customize the responses for your network and/or add more. # -# The way the new helpop system works is simple. You use one or more helpop tags. -# -# key is what the user is looking for (i.e. /helpop moo), title is the title, and +# The way the new help system works is simple. You use one or more helptopic tags. +# +# key is what the user is looking for (i.e. /HELP moo), title is the title, and # value is what they get back # (note that it can span multiple lines!). # -- w00t 16/dec/2006 # - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# HELPOP module: Provides the /HELPOP command -# +# Help module: Provides the /HELP command +# # -#-#-#-#-#-#-#-#-#-#-#-#- HELPOP CONFIGURATION -#-#-#-#-#-#-#-#-#-#-# +#-#-#-#-#-#-#-#-#-#-#-#- HELP CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # -# If you specify to use the helpop module, then specify below the # -# path to the helpop.conf file. # +# If you specify to use the help module, then specify below the path # +# to the help.conf file. # # # -# +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Help mode module: Provides oper-only user mode `h` (helpop) which diff --git a/src/modules/m_helpop.cpp b/src/modules/m_help.cpp similarity index 80% rename from src/modules/m_helpop.cpp rename to src/modules/m_help.cpp index 5e85cb968..6eb152904 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_help.cpp @@ -53,7 +53,7 @@ struct HelpTopic final typedef std::map HelpMap; -class CommandHelpop final +class CommandHelp final : public Command { private: @@ -63,8 +63,8 @@ public: HelpMap help; std::string nohelp; - CommandHelpop(Module* Creator) - : Command(Creator, "HELPOP", 0) + CommandHelp(Module* Creator) + : Command(Creator, "HELP") , startkey("start") { syntax = { "" }; @@ -84,20 +84,20 @@ public: user->WriteNumeric(RPL_HELPSTART, topic, entry.title); for (const auto& line : entry.body) user->WriteNumeric(RPL_HELPTXT, topic, line); - user->WriteNumeric(RPL_ENDOFHELP, topic, "End of /HELPOP."); + user->WriteNumeric(RPL_ENDOFHELP, topic, "End of /HELP."); return CmdResult::SUCCESS; } }; -class ModuleHelpop final +class ModuleHelp final : public Module { private: - CommandHelpop cmd; + CommandHelp cmd; public: - ModuleHelpop() - : Module(VF_VENDOR, "Adds the /HELPOP command which allows users to view help on various topics.") + ModuleHelp() + : Module(VF_VENDOR, "Adds the /HELP command which allows users to view help on various topics.") , cmd(this) { } @@ -107,25 +107,25 @@ public: size_t longestkey = 0; HelpMap newhelp; - auto tags = ServerInstance->Config->ConfTags("helpop"); + auto tags = ServerInstance->Config->ConfTags("helptopic", ServerInstance->Config->ConfTags("helpop")); if (tags.empty()) - throw ModuleException(this, "You have loaded the helpop module but not configured any help topics!"); + throw ModuleException(this, "You have loaded the help module but not configured any help topics!"); for (const auto& [_, tag] : tags) { // Attempt to read the help key. const std::string key = tag->getString("key"); if (key.empty()) - throw ModuleException(this, INSP_FORMAT(" is empty at {}", tag->source.str())); + throw ModuleException(this, INSP_FORMAT("<{}:key> is empty at {}", tag->name, tag->source.str())); else if (irc::equals(key, "index")) - throw ModuleException(this, INSP_FORMAT(" is set to \"index\" which is reserved at {}", tag->source.str())); + throw ModuleException(this, INSP_FORMAT("<{}:key> is set to \"index\" which is reserved at {}", tag->name, tag->source.str())); else if (key.length() > longestkey) longestkey = key.length(); // Attempt to read the help value. std::string value; if (!tag->readString("value", value, true) || value.empty()) - throw ModuleException(this, INSP_FORMAT(" is empty at {}", tag->source.str())); + throw ModuleException(this, INSP_FORMAT("<{}:value> is empty at {}", tag->name, tag->source.str())); // Parse the help body. Empty lines are replaced with a single // space because some clients are unable to show blank lines. @@ -138,8 +138,8 @@ public: const std::string title = tag->getString("title", INSP_FORMAT("*** Help for {}", key), 1); if (!newhelp.emplace(key, HelpTopic(helpmsg, title)).second) { - throw ModuleException(this, INSP_FORMAT(" tag with duplicate key '{}' at {}", - key, tag->source.str())); + throw ModuleException(this, INSP_FORMAT("<{}> tag with duplicate key '{}' at {}", + tag->name, key, tag->source.str())); } } @@ -169,4 +169,4 @@ public: } }; -MODULE_INIT(ModuleHelpop) +MODULE_INIT(ModuleHelp)