- if (mh->GetNumParams(true) && (paramptr < params.size()))
- mh->OnModeChange(_new, _new, NULL, params[paramptr++], true);
+ if (mh->GetNumParams(true))
+ {
+ if (paramptr >= params.size() - 1)
+ return CMD_INVALID;
+ std::string mp = params[paramptr++];
+ /* IMPORTANT NOTE:
+ * All modes are assumed to succeed here as they are being set by a remote server.
+ * Modes CANNOT FAIL here. If they DO fail, then the failure is ignored. This is important
+ * to note as all but one modules currently cannot ever fail in this situation, except for
+ * m_servprotect which specifically works this way to prevent the mode being set ANYWHERE
+ * but here, at client introduction. You may safely assume this behaviour is standard and
+ * will not change in future versions if you want to make use of this protective behaviour
+ * yourself.
+ */
+ mh->OnModeChange(_new, _new, NULL, mp, true);
+ }