diff options
Diffstat (limited to 'src/command.cpp')
-rw-r--r-- | src/command.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/command.cpp b/src/command.cpp index db30a25f3..b7289b848 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -112,7 +112,7 @@ void CommandSource::Reply(const Anope::string &message) { const char *translated_message = Language::Translate(this->nc, message.c_str()); - sepstream sep(translated_message, '\n'); + sepstream sep(translated_message, '\n', true); Anope::string tok; while (sep.GetToken(tok)) this->reply->SendMessage(this->service, tok); @@ -150,12 +150,8 @@ void Command::SendSyntax(CommandSource &source) for (unsigned i = 1, j = this->syntax.size(); i < j; ++i) source.Reply(" \002%s %s\002", source.command.c_str(), this->syntax[i].c_str()); } -} - -void Command::SendSyntax(CommandSource &source, const Anope::string &syn) -{ - source.Reply(_("Syntax: \002%s %s\002"), source.command.c_str(), syn.c_str()); - source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str()); + else + source.Reply(_("Syntax: \002%s\002"), source.command.c_str()); } bool Command::AllowUnregistered() const @@ -178,14 +174,14 @@ void Command::RequireUser(bool b) this->require_user = b; } -const Anope::string &Command::GetDesc() const +const Anope::string Command::GetDesc(CommandSource &) const { return this->desc; } void Command::OnServHelp(CommandSource &source) { - source.Reply(" %-14s %s", source.command.c_str(), Language::Translate(source.nc, this->GetDesc().c_str())); + source.Reply(" %-14s %s", source.command.c_str(), Language::Translate(source.nc, this->GetDesc(source).c_str())); } bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { return false; } @@ -193,7 +189,9 @@ bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { r void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { this->SendSyntax(source); - source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str()); + bool has_help = source.service->commands.find("HELP") != source.service->commands.end(); + if (has_help) + source.Reply(MORE_INFO, Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); } void RunCommand(CommandSource &source, const Anope::string &message) @@ -218,7 +216,7 @@ void RunCommand(CommandSource &source, const Anope::string &message) if (it == source.service->commands.end()) { if (has_help) - source.Reply(_("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str()); + source.Reply(_("Unknown command \002%s\002. \"%s %s HELP\" for help."), message.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); else source.Reply(_("Unknown command \002%s\002."), message.c_str()); return; @@ -229,7 +227,7 @@ void RunCommand(CommandSource &source, const Anope::string &message) if (!c) { if (has_help) - source.Reply(_("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str()); + source.Reply(_("Unknown command \002%s\002. \"%s%s HELP\" for help."), message.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); else source.Reply(_("Unknown command \002%s\002."), message.c_str()); Log(source.service) << "Command " << it->first << " exists on me, but its service " << info.name << " was not found!"; |