diff options
author | Adam <Adam@anope.org> | 2013-02-07 21:44:37 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-02-07 21:49:49 -0500 |
commit | 01413dd3cc5e9984b5278b613bc2ef8abc1267d7 (patch) | |
tree | 9df562b049157a3cc2b3245eac64940df3ecd253 /src/channels.cpp | |
parent | 9d1fe6102c403e1d66f05463c5088e47682f9e01 (diff) |
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.
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index d9075282c..9265fdacf 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -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()); |