#include "inspircd.h"
+#include "modules/whois.h"
+
+enum
+{
+ // From UnrealIRCd.
+ RPL_WHOISHELPOP = 310
+};
typedef std::map<std::string, std::string, irc::insensitive_swo> HelpopMap;
static HelpopMap helpop_map;
syntax = "<any-text>";
}
- CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
+ CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
{
const std::string& parameter = (!parameters.empty() ? parameters[0] : startkey);
if (parameter == "index")
{
/* iterate over all helpop items */
- user->WriteNumeric(290, ":HELPOP topic index");
+ user->WriteNumeric(290, "HELPOP topic index");
for (HelpopMap::const_iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++)
- user->WriteNumeric(292, ": %s", iter->first.c_str());
- user->WriteNumeric(292, ":*** End of HELPOP topic index");
+ user->WriteNumeric(292, InspIRCd::Format(" %s", iter->first.c_str()));
+ user->WriteNumeric(292, "*** End of HELPOP topic index");
}
else
{
- user->WriteNumeric(290, ":*** HELPOP for %s", parameter.c_str());
- user->WriteNumeric(292, ": -");
+ user->WriteNumeric(290, InspIRCd::Format("*** HELPOP for %s", parameter.c_str()));
+ user->WriteNumeric(292, " -");
HelpopMap::const_iterator iter = helpop_map.find(parameter);
{
// Writing a blank line will not work with some clients
if (token.empty())
- user->WriteNumeric(292, ": ");
+ user->WriteNumeric(292, ' ');
else
- user->WriteNumeric(292, ":%s", token.c_str());
+ user->WriteNumeric(292, token);
}
- user->WriteNumeric(292, ": -");
- user->WriteNumeric(292, ":*** End of HELPOP");
+ user->WriteNumeric(292, " -");
+ user->WriteNumeric(292, "*** End of HELPOP");
}
return CMD_SUCCESS;
}
{
if (whois.GetTarget()->IsModeSet(ho))
{
- whois.SendLine(310, ":is available for help.");
+ whois.SendLine(RPL_WHOISHELPOP, "is available for help.");
}
}