]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/mode.cpp
Release v3.0.0 alpha 8.
[user/henk/code/inspircd.git] / src / mode.cpp
index e2129b55a46ce03a9466d169b2bed3886c5d082b..9d17f5be8b8eda5cae8a329fd550ef2d3d6d6b08 100644 (file)
@@ -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*)
@@ -449,6 +454,12 @@ unsigned int ModeParser::ProcessSingle(User* user, Channel* targetchannel, User*
                Modes::Change& item = *i;
                ModeHandler* mh = item.mh;
 
+               // If a mode change has been given for a mode that does not exist then reject
+               // it. This can happen when core_reloadmodule attempts to restore a mode that
+               // no longer exists.
+               if (!mh)
+                       continue;
+
                // If the mode is supposed to have a parameter then we first take a look at item.param
                // and, if we were asked to, also handle mode merges now
                if (mh->NeedsParam(item.adding))