diff options
author | Adam <Adam@anope.org> | 2013-05-08 20:26:45 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-05-08 20:26:45 -0400 |
commit | 735e234c2c7a984b01295f86045545ed8d9838ce (patch) | |
tree | 87d7cce721eaa7a34d71b17c73f317750d87caef /src/channels.cpp | |
parent | 735f0ba6cf5602396bc2cabd6ceca0e92a0edd00 (diff) |
Fixed some issues and desyncs with creating empty permanent channels on startup & dropping empty channels
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 52303fa46..bc32781de 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -78,13 +78,10 @@ void Channel::Reset() this->SetMode(NULL, ModeManager::FindChannelModeByName(f.Modes()[i]), uc->user->GetUID(), false); } - this->CheckModes(); - for (ChanUserList::const_iterator it = this->users.begin(), it_end = this->users.end(); it != it_end; ++it) this->SetCorrectModes(it->second->user, true, false); - if (this->ci && Me && Me->IsSynced()) - this->ci->RestoreTopic(); + this->Sync(); } void Channel::Sync() @@ -153,6 +150,25 @@ void Channel::CheckModes() } } +bool Channel::CheckDelete() +{ + /* Channel is persistent, it shouldn't be deleted and the service bot should stay */ + if (this->HasExt("PERSIST") || (this->ci && this->ci->HasExt("PERSIST"))) + return false; + + /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly + * We also don't part the bot here either, if necessary we will part it after the sync + */ + if (this->HasExt("SYNCING")) + return false; + + /* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */ + if (this->HasExt("INHABIT")) + return false; + + return this->users.empty(); +} + ChanUserContainer* Channel::JoinUser(User *user) { if (user->server && user->server->IsSynced()) @@ -190,21 +206,7 @@ void Channel::DeleteUser(User *user) Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete nonexistant channel " << this->name << " from " << user->nick << "'s channel list"; delete cu; - /* Channel is persistent, it shouldn't be deleted and the service bot should stay */ - if (this->HasExt("PERSIST") || (this->ci && this->ci->HasExt("PERSIST"))) - return; - - /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly - * We also don't part the bot here either, if necessary we will part it after the sync - */ - if (this->HasExt("SYNCING")) - return; - - /* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */ - if (this->HasExt("INHABIT")) - return; - - if (this->users.empty()) + if (this->CheckDelete()) delete this; } |