diff options
author | Peter Powell <petpow@saberuk.com> | 2018-01-27 13:05:14 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-01-29 11:52:13 +0000 |
commit | d5a6054948502625d7f0c235f6faaeea58734de5 (patch) | |
tree | a43e95ded07dca92c9d3659e331a88cb8e0b7b21 /src/mode.cpp | |
parent | 3398ce7e50f1c269e8221df04e1eefb52d54c820 (diff) |
Add ERR_INVALIDMODEPARAM for responding to invalid mode params.
Currently on invalid modes we do a combination of different things:
1. Send a custom mode-specific numeric (which often collides with
other modes).
2. Send a server notice.
3. Do absolutely nothing.
This new numeric is a generic way of handling invalid parameters
when setting a mode that avoids all of the mistakes of the previous
behaviour.
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index c07c342a3..9d17f5be8 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -89,6 +89,11 @@ void ModeHandler::DisplayEmptyList(User*, Channel*) void ModeHandler::OnParameterMissing(User* user, User* dest, Channel* channel) { + const std::string message = InspIRCd::Format("You must specify a parameter for the %s mode", name.c_str()); + if (channel) + user->WriteNumeric(Numerics::InvalidModeParameter(channel, this, "*", message)); + else + user->WriteNumeric(Numerics::InvalidModeParameter(dest, this, "*", message)); } bool ModeHandler::ResolveModeConflict(std::string& theirs, const std::string& ours, Channel*) |