X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmode.cpp;h=306d39c5d00a7033dd621a3d84420f82405e1d38;hb=b3449b8763139602efc568f46631299476d5979f;hp=1c17a659862752eb70ef1f22ba542115a0b29dad;hpb=aa692dc1039b63deef7886e914ec499abe7facaf;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/mode.cpp b/src/mode.cpp index 1c17a6598..306d39c5d 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2019 Matt Schatz * Copyright (C) 2017 B00mX0r - * Copyright (C) 2016-2019 Sadie Powell + * Copyright (C) 2016-2019, 2021 Sadie Powell * Copyright (C) 2012-2016, 2018 Attila Molnar * Copyright (C) 2012, 2019 Robby * Copyright (C) 2012 Shawn Smith @@ -104,6 +104,14 @@ void ModeHandler::OnParameterMissing(User* user, User* dest, Channel* channel) user->WriteNumeric(Numerics::InvalidModeParameter(dest, this, "*", message)); } +void ModeHandler::OnParameterInvalid(User* user, Channel* targetchannel, User* targetuser, const std::string& parameter) +{ + if (targetchannel) + user->WriteNumeric(Numerics::InvalidModeParameter(targetchannel, this, "*")); + else + user->WriteNumeric(Numerics::InvalidModeParameter(targetuser, this, "*")); +} + bool ModeHandler::ResolveModeConflict(std::string& theirs, const std::string& ours, Channel*) { return (theirs < ours); @@ -403,7 +411,10 @@ static bool IsModeParamValid(User* user, Channel* targetchannel, User* targetuse // The parameter cannot begin with a ':' character or contain a space if ((item.param[0] == ':') || (item.param.find(' ') != std::string::npos)) + { + item.mh->OnParameterInvalid(user, targetchannel, targetuser, item.param); return false; + } return true; }