X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=include%2Fnumericbuilder.h;h=9feceb7cbe51bb74739370db8005b5361fa6b982;hb=131f659d91953c51823ef70c8314aa3170ce7a7e;hp=4431fbc527f5bd3edd14fc22676c7c66de3f2c36;hpb=9433e34b2133d8f1e77fea15447ba4d0259a5fb0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/numericbuilder.h b/include/numericbuilder.h index 4431fbc52..9feceb7cb 100644 --- a/include/numericbuilder.h +++ b/include/numericbuilder.h @@ -1,6 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2018-2020 Sadie Powell * Copyright (C) 2015-2016 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -199,11 +200,55 @@ class Numeric::ParamBuilder : public GenericParamBuildername); + push(message); + } + + CannotSendTo(Channel* chan, const std::string& what, ModeHandler* mh) + : Numeric(ERR_CANNOTSENDTOCHAN) + { + push(chan->name); + push(InspIRCd::Format("You cannot send %s to this channel whilst the +%c (%s) mode is set.", + what.c_str(), mh->GetModeChar(), mh->name.c_str())); + } + + CannotSendTo(Channel* chan, const std::string& what, char extban, const std::string& extbandesc) + : Numeric(ERR_CANNOTSENDTOCHAN) + { + push(chan->name); + push(InspIRCd::Format("You cannot send %s to this channel whilst %s %c: (%s) extban is set matching you.", + what.c_str(), strchr("AEIOUaeiou", extban) ? "an" : "a", extban, extbandesc.c_str())); + } + + CannotSendTo(User* user, const std::string& message) + : Numeric(ERR_CANTSENDTOUSER) + { + push(user->registered & REG_NICK ? user->nick : "*"); + push(message); + } + + CannotSendTo(User* user, const std::string& what, ModeHandler* mh, bool self = false) + : Numeric(ERR_CANTSENDTOUSER) + { + push(user->registered & REG_NICK ? user->nick : "*"); + push(InspIRCd::Format("You cannot send %s to this user whilst %s have the +%c (%s) mode set.", + what.c_str(), self ? "you" : "they", mh->GetModeChar(), mh->name.c_str())); + } +}; + /* Builder for the ERR_INVALIDMODEPARAM numeric. */ class Numerics::InvalidModeParameter : public Numeric::Numeric { @@ -257,7 +302,7 @@ class Numerics::NoSuchChannel : public Numeric::Numeric NoSuchChannel(const std::string& chan) : Numeric(ERR_NOSUCHCHANNEL) { - push(chan); + push(chan.empty() ? "*" : chan); push("No such channel"); } }; @@ -269,7 +314,7 @@ class Numerics::NoSuchNick : public Numeric::Numeric NoSuchNick(const std::string& nick) : Numeric(ERR_NOSUCHNICK) { - push(nick); + push(nick.empty() ? "*" : nick); push("No such nick"); } };