X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fnumericbuilder.h;h=4431fbc527f5bd3edd14fc22676c7c66de3f2c36;hb=9433e34b2133d8f1e77fea15447ba4d0259a5fb0;hp=17aa9e0c866bb1ceafe1bae03a30e24fd482157c;hpb=e33e8bcdf8fd3e40eba6a41b43dbc48f973efb11;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/numericbuilder.h b/include/numericbuilder.h index 17aa9e0c8..4431fbc52 100644 --- a/include/numericbuilder.h +++ b/include/numericbuilder.h @@ -196,3 +196,80 @@ class Numeric::ParamBuilder : public GenericParamBuilderGetSyntax(); + if (!syntax.empty()) + { + // If the mode has a syntax hint we include it in the message. + push(InspIRCd::Format("Invalid %s mode parameter. Syntax: %s.", mode->name.c_str(), syntax.c_str())); + } + else + { + // Otherwise, send it without. + push(InspIRCd::Format("Invalid %s mode parameter.", mode->name.c_str())); + } + } + + public: + InvalidModeParameter(Channel* chan, ModeHandler* mode, const std::string& parameter, const std::string& message = "") + : Numeric(ERR_INVALIDMODEPARAM) + { + push(chan->name); + push(mode->GetModeChar()); + push(parameter); + push_message(mode, message); + } + + InvalidModeParameter(User* user, ModeHandler* mode, const std::string& parameter, const std::string& message = "") + : Numeric(ERR_INVALIDMODEPARAM) + { + push(user->registered & REG_NICK ? user->nick : "*"); + push(mode->GetModeChar()); + push(parameter); + push_message(mode, message); + } +}; + +/** Builder for the ERR_NOSUCHCHANNEL numeric. */ +class Numerics::NoSuchChannel : public Numeric::Numeric +{ + public: + NoSuchChannel(const std::string& chan) + : Numeric(ERR_NOSUCHCHANNEL) + { + push(chan); + push("No such channel"); + } +}; + +/** Builder for the ERR_NOSUCHNICK numeric. */ +class Numerics::NoSuchNick : public Numeric::Numeric +{ + public: + NoSuchNick(const std::string& nick) + : Numeric(ERR_NOSUCHNICK) + { + push(nick); + push("No such nick"); + } +};