diff options
-rw-r--r-- | include/modules.h | 4 | ||||
-rw-r--r-- | src/mode.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/modules.h b/include/modules.h index 6a08aaec6..29e4313dc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1101,7 +1101,9 @@ class CoreExport Module : public Extensible * @param param The parameter for the mode or an empty string * @param adding true of the mode is being added, false if it is being removed * @param pcnt The parameter count for the mode (0 or 1) - * @return 1 to deny the mode, 0 to allow + * @return ACR_DENY to deny the mode, ACR_DEFAULT to do standard mode checking, and ACR_ALLOW + * to skip all permission checking. Please note that for remote mode changes, your return value + * will be ignored! */ virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt); diff --git a/src/mode.cpp b/src/mode.cpp index 063b14fc4..cb9779c94 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -387,6 +387,8 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser } else if (pcnt > 1) { + bool SkipAccessChecks = false; + if (targetchannel) { type = MODETYPE_CHANNEL; @@ -403,6 +405,7 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user, NULL, targetchannel, AC_GENERAL_MODE)); if (MOD_RESULT == ACR_DENY) return; + SkipAccessChecks = (MOD_RESULT == ACR_ALLOW); } } else if (targetuser) @@ -516,7 +519,7 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser if (IS_LOCAL(user) && (MOD_RESULT == ACR_DENY)) continue; - if (IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW)) + if (!SkipAccessChecks && IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW)) { ServerInstance->Log(DEBUG,"Enter minimum prefix check"); /* Check access to this mode character */ |