diff options
| author | 2020-11-30 18:47:19 +0000 | |
|---|---|---|
| committer | 2020-11-30 18:47:19 +0000 | |
| commit | fbb7675c663cb71ff618ec7fe94e00da619d8025 (patch) | |
| tree | 597bee2f2003621db8e2e438eaae18064ab238ae /src | |
| parent | Rename ChanMax to MaxChannel for consistency with the other limits. (diff) | |
Move ban checking to core_channel.
Diffstat (limited to 'src')
| -rw-r--r-- | src/channels.cpp | 14 | ||||
| -rw-r--r-- | src/coremods/core_channel/core_channel.cpp | 7 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 151bc62ba..4fe1d1e56 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -232,20 +232,6 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co // describing the situation, so we may stop here without sending anything if (MOD_RESULT == MOD_RES_DENY) return NULL; - - // If no module returned MOD_RES_DENY or MOD_RES_ALLOW (which is the case - // most of the time) then proceed to check channel bans. - // - // If a module explicitly allowed the join (by returning MOD_RES_ALLOW), - // then this entire section is skipped - if (MOD_RESULT == MOD_RES_PASSTHRU) - { - if (chan->IsBanned(user)) - { - user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (you're banned)"); - return NULL; - } - } } } diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp index 4d5484924..e6a928bc2 100644 --- a/src/coremods/core_channel/core_channel.cpp +++ b/src/coremods/core_channel/core_channel.cpp @@ -279,6 +279,13 @@ class CoreModChannel } } + // Check whether the user is banned from joining the channel. + if (chan->IsBanned(user)) + { + user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (you're banned)"); + return MOD_RES_DENY; + } + // Everything looks okay. return MOD_RES_PASSTHRU; } |
