From b1c34faf49a74d5fe9db4d2601f78eb2e6b93ee1 Mon Sep 17 00:00:00 2001 From: Adam- Date: Wed, 31 Mar 2010 04:42:00 +0000 Subject: Fixed cs_xop to not add its commands until after it knows what modes as supported by the IRCd git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2849 5417fbe8-f217-4b02-8779-1006273d7864 --- src/core/cs_xop.c | 25 +++++++++++++++++++------ src/servers.c | 6 ++++++ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index 0f5f863dc..2fe9daf30 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -541,17 +541,30 @@ class CSXOP : public Module this->SetVersion("$Id$"); this->SetType(CORE); - if (ModeManager::FindChannelModeByName(CMODE_OWNER)) - this->AddCommand(CHANSERV, new CommandCSQOP()); - if (ModeManager::FindChannelModeByName(CMODE_PROTECT)) - this->AddCommand(CHANSERV, new CommandCSAOP()); - if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) - this->AddCommand(CHANSERV, new CommandCSHOP()); this->AddCommand(CHANSERV, new CommandCSSOP()); + this->AddCommand(CHANSERV, new CommandCSAOP()); this->AddCommand(CHANSERV, new CommandCSVOP()); + if (serv_uplink && is_sync(serv_uplink)) + OnUplinkSync(); + else + { + /* We don't want to add some commands until we are synced, so we know what modes + * exist and what dont + */ + ModuleManager::Attach(I_OnUplinkSync, this); + } ModuleManager::Attach(I_OnChanServHelp, this); } + + void OnUplinkSync() + { + if (ModeManager::FindChannelModeByName(CMODE_OWNER)) + this->AddCommand(CHANSERV, new CommandCSQOP()); + if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) + this->AddCommand(CHANSERV, new CommandCSHOP()); + } + void OnChanServHelp(User *u) { if (ModeManager::FindChannelModeByName(CMODE_OWNER)) diff --git a/src/servers.c b/src/servers.c index 959e2be2d..c16305c1d 100644 --- a/src/servers.c +++ b/src/servers.c @@ -566,6 +566,12 @@ void finish_sync(Server * serv, int sync_links) // Perhaps this should be done if serv == serv_uplink? restore_unsynced_topics(); Alog() << "Server " << serv->name << " is done syncing"; + + FOREACH_MOD(I_OnServerSync, OnServerSync(s)); + if (serv == serv_uplink) + { + FOREACH_MOD(I_OnUplinkSync, OnUplinkSync()); + } } /*******************************************************************/ -- cgit