1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 04:06:41 +02:00

Use channel mode +r to determine if a channel has either been newly created or

created while we were offline (eg, during the inital burst to the
uplink). Fixes not knowing whether or not channels ops in non-secureop
non-persistent channels obtained op while we were offline by creating
the channel or legitimately by being set op by another channel op.
This commit is contained in:
Adam
2013-02-07 21:44:37 -05:00
parent 9d1fe6102c
commit 01413dd3cc
2 changed files with 12 additions and 4 deletions
+8 -3
View File
@@ -928,7 +928,8 @@ void Channel::SetCorrectModes(User *user, bool give_modes, bool check_noop)
*admin = ModeManager::FindChannelModeByName("PROTECT"),
*op = ModeManager::FindChannelModeByName("OP"),
*halfop = ModeManager::FindChannelModeByName("HALFOP"),
*voice = ModeManager::FindChannelModeByName("VOICE");
*voice = ModeManager::FindChannelModeByName("VOICE"),
*registered = ModeManager::FindChannelModeByName("REGISTERED");
if (user == NULL)
return;
@@ -954,8 +955,12 @@ void Channel::SetCorrectModes(User *user, bool give_modes, bool check_noop)
else if (voice && u_access.HasPriv("AUTOVOICE"))
this->SetMode(NULL, "VOICE", user->GetUID());
}
/* If this channel has secureops or the channel is syncing and they are not ulined, check to remove modes */
if ((ci->HasExt("SECUREOPS") || (this->HasExt("SYNCING") && user->server->IsSynced())) && !user->server->IsULined())
/* 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.
*/
if ((ci->HasExt("SECUREOPS") || (registered && !this->HasMode("REGISTERED")) || (!registered && this->HasExt("SYNCING") && user->server->IsSynced())) && !user->server->IsULined())
{
if (owner && !u_access.HasPriv("AUTOOWNER") && !u_access.HasPriv("OWNERME"))
this->RemoveMode(NULL, "OWNER", user->GetUID());