From 20c7bcad55597f17c01089ae2ec0c458bafa705f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 8 Oct 2017 11:37:09 -0400 Subject: Simplify initial burst of persistent channels Also don't create/destroy channels as persist is set on and off which no longer makes since with the live database backend --- modules/chanserv/main/chanserv.cpp | 56 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'modules/chanserv/main') diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp index 2521ee22e..3c6fe000a 100644 --- a/modules/chanserv/main/chanserv.cpp +++ b/modules/chanserv/main/chanserv.cpp @@ -43,7 +43,7 @@ class ChanServCore : public Module , public EventHook , public EventHook , public EventHook - , public EventHook + , public EventHook , public EventHook , public EventHook , public EventHook @@ -71,7 +71,7 @@ class ChanServCore : public Module , EventHook(this) , EventHook(this) , EventHook(this) - , EventHook(this) + , EventHook(this) , EventHook(this) , EventHook(this) , EventHook(this) @@ -462,42 +462,42 @@ class ChanServCore : public Module return EVENT_CONTINUE; } - void OnPreUplinkSync(Server *serv) override + void OnPostInit() override { - /* Find all persistent channels and create them, as we are about to finish burst to our uplink */ + ChannelMode *perm = ModeManager::FindChannelModeByName("PERM"); + + /* Find all persistent channels and create them, so they will be bursted to the uplink */ for (ChanServ::Channel *ci : Serialize::GetObjects()) { - if (ci->IsPersist()) - { - bool created; - Channel *c = Channel::FindOrCreate(ci->GetName(), created, ci->GetTimeRegistered()); + if (!ci->IsPersist()) + continue; - if (ModeManager::FindChannelModeByName("PERM") != NULL) + bool created; + Channel *c = Channel::FindOrCreate(ci->GetName(), created, ci->GetTimeRegistered()); + c->syncing |= created; + + if (perm != nullptr) + { + c->SetMode(NULL, perm); + } + else + { + if (!ci->GetBot()) { - if (created) - IRCD->Send(c); - c->SetMode(NULL, "PERM"); + ServiceBot *bi = ci->WhoSends(); + if (bi != nullptr) + bi->Assign(nullptr, ci); } - else - { - if (!ci->GetBot()) - { - ServiceBot *bi = ci->WhoSends(); - if (bi != nullptr) - bi->Assign(nullptr, ci); - } - if (ci->GetBot() != nullptr && c->FindUser(ci->GetBot()) == nullptr) - { - Anope::string botmodes = Config->GetModule("botserv/main")->Get("botmodes", - Config->GetModule("chanserv/main")->Get("botmodes")); - ChannelStatus status(botmodes); - ci->GetBot()->Join(c, &status); - } + if (ci->GetBot() != nullptr && c->FindUser(ci->GetBot()) == nullptr) + { + Anope::string botmodes = Config->GetModule("botserv/main")->Get("botmodes", + Config->GetModule("chanserv/main")->Get("botmodes")); + ChannelStatus status(botmodes); + ci->GetBot()->Join(c, &status); } } } - } void OnChanRegistered(ChanServ::Channel *ci) override -- cgit