mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Do not take modes from users in channels with secureops off if we are always lowering channels timestamps to their creations
This commit is contained in:
@@ -1319,6 +1319,7 @@ class CSSet : public Module
|
||||
if (noautoop.HasExt(chan->ci))
|
||||
give_modes = false;
|
||||
if (secureops.HasExt(chan->ci))
|
||||
// This overrides what chanserv does because it is loaded after chanserv
|
||||
take_modes = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +457,17 @@ class ChanServCore : public Module, public ChanServService
|
||||
if (!ci->HasExt("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->last_used != Anope::CurTime)
|
||||
info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount());
|
||||
}
|
||||
|
||||
void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
|
||||
{
|
||||
if (always_lower)
|
||||
// Since we always lower the TS, the other side will remove the modes if the channel ts lowers, so we don't
|
||||
// have to worry about it
|
||||
take_modes = false;
|
||||
else if (ModeManager::FindChannelModeByName("REGISTERED"))
|
||||
// Otherwise if the registered channel mode exists, we should remove modes if the channel is not +r
|
||||
take_modes = !chan->HasMode("REGISTERED");
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(ChanServCore)
|
||||
|
||||
+2
-7
@@ -788,14 +788,9 @@ void Channel::SetCorrectModes(User *user, bool give_modes)
|
||||
Log(LOG_DEBUG) << "Setting correct user modes for " << user->nick << " on " << this->name << " (" << (give_modes ? "" : "not ") << "giving modes)";
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(user);
|
||||
ChannelMode *registered = ModeManager::FindChannelModeByName("REGISTERED");
|
||||
|
||||
/* If this channel has secureops, or the registered channel mode exists and the channel does not have +r set (aka the channel
|
||||
* was created just now or while we were off), or the registered channel mode does not exist and channel is syncing (aka just
|
||||
* created *to us*) and the user's server is synced (aka this isn't us doing our initial uplink - without this we would be deopping all
|
||||
* users with no access on a non-secureops channel on startup), and the user's server isn't ulined, then set negative modes.
|
||||
*/
|
||||
bool take_modes = (registered && !this->HasMode("REGISTERED")) || (!registered && this->syncing && user->server->IsSynced());
|
||||
/* Initially only take modes if the channel is being created by a non netmerge */
|
||||
bool take_modes = this->syncing && user->server->IsSynced();
|
||||
|
||||
FOREACH_MOD(OnSetCorrectModes, (user, this, u_access, give_modes, take_modes));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user