From 1397fda7869f5b70dd3c969c3c3c1c104cf31631 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 31 Mar 2014 20:10:51 -0400 Subject: Bump to Anope 2.0.1-git --- src/version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/version.sh b/src/version.sh index 6d6ee9066..0544e51c2 100644 --- a/src/version.sh +++ b/src/version.sh @@ -2,6 +2,6 @@ VERSION_MAJOR="2" VERSION_MINOR="0" -VERSION_PATCH="0" -VERSION_EXTRA="" +VERSION_PATCH="1" +VERSION_EXTRA="-git" -- cgit From fb5c5e3442994985af92122803db7b65ed9a4097 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 2 Apr 2014 22:37:35 -0400 Subject: Set minus no arg on +l in all proto mods Set oper modes/vhost on oper too, evan after iding Add umode +q to plexus --- src/users.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/users.cpp b/src/users.cpp index 97c850111..9b790a98c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -523,8 +523,28 @@ void User::SetModeInternal(const MessageSource &source, UserMode *um, const Anop this->modes[um->name] = param; if (um->name == "OPER") + { ++OperCount; + if (this->IsServicesOper()) + { + if (!this->nc->o->ot->modes.empty()) + { + this->SetModes(NULL, "%s", this->nc->o->ot->modes.c_str()); + this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str()); + UserMode *oper = ModeManager::FindUserModeByName("OPER"); + if (oper && !this->HasMode("OPER") && this->nc->o->ot->modes.find(oper->mchar) != Anope::string::npos) + IRCD->SendOper(this); + } + if (IRCD->CanSetVHost && !this->nc->o->vhost.empty()) + { + this->SendMessage(NULL, "Changing your vhost to \002%s\002", this->nc->o->vhost.c_str()); + this->SetDisplayedHost(this->nc->o->vhost); + IRCD->SendVhost(this, "", this->nc->o->vhost); + } + } + } + if (um->name == "CLOAK" || um->name == "VHOST") this->UpdateHost(); -- cgit From 43219d3906a6a1b980319ae993c53f7606e438a6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 6 Apr 2014 23:01:10 -0400 Subject: Do not apply module changes on rehash until after the new config has been applied. Fix renaming opertypes on reload. --- src/config.cpp | 69 ++++++++++++++++++++++++++++++++++------------------------ src/init.cpp | 4 +++- 2 files changed, 43 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/config.cpp b/src/config.cpp index 0275cb7f8..e402080db 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -525,47 +525,58 @@ Conf::Conf() : Block("") /* Check the user keys */ if (!options->Get("seed")) Log() << "Configuration option options:seed should be set. It's for YOUR safety! Remember that!"; +} - if (Config) +Conf::~Conf() +{ + for (unsigned i = 0; i < MyOperTypes.size(); ++i) + delete MyOperTypes[i]; + for (unsigned i = 0; i < Opers.size(); ++i) + delete Opers[i]; +} + +void Conf::Post(Conf *old) +{ + /* Apply module changes */ + for (unsigned i = 0; i < old->ModulesAutoLoad.size(); ++i) + if (std::find(this->ModulesAutoLoad.begin(), this->ModulesAutoLoad.end(), old->ModulesAutoLoad[i]) == this->ModulesAutoLoad.end()) + ModuleManager::UnloadModule(ModuleManager::FindModule(old->ModulesAutoLoad[i]), NULL); + for (unsigned i = 0; i < this->ModulesAutoLoad.size(); ++i) + if (std::find(old->ModulesAutoLoad.begin(), old->ModulesAutoLoad.end(), this->ModulesAutoLoad[i]) == old->ModulesAutoLoad.end()) + ModuleManager::LoadModule(this->ModulesAutoLoad[i], NULL); + + /* Apply opertype changes, as non-conf opers still point to the old oper types */ + for (unsigned i = Oper::opers.size(); i > 0; --i) { - /* Apply module chnages */ - for (unsigned i = 0; i < Config->ModulesAutoLoad.size(); ++i) - if (std::find(this->ModulesAutoLoad.begin(), this->ModulesAutoLoad.end(), Config->ModulesAutoLoad[i]) == this->ModulesAutoLoad.end()) - ModuleManager::UnloadModule(ModuleManager::FindModule(Config->ModulesAutoLoad[i]), NULL); - for (unsigned i = 0; i < this->ModulesAutoLoad.size(); ++i) - if (std::find(Config->ModulesAutoLoad.begin(), Config->ModulesAutoLoad.end(), this->ModulesAutoLoad[i]) == Config->ModulesAutoLoad.end()) - ModuleManager::LoadModule(this->ModulesAutoLoad[i], NULL); - - /* Apply opertype changes, as non-conf opers still point to the old oper types */ - for (unsigned i = Oper::opers.size(); i > 0; --i) + Oper *o = Oper::opers[i - 1]; + + /* Oper's type is in the old config, so update it */ + if (std::find(old->MyOperTypes.begin(), old->MyOperTypes.end(), o->ot) != old->MyOperTypes.end()) { - Oper *o = Oper::opers[i - 1]; + OperType *ot = o->ot; + o->ot = NULL; + + for (unsigned j = 0; j < MyOperTypes.size(); ++j) + if (ot->GetName() == MyOperTypes[j]->GetName()) + o->ot = MyOperTypes[j]; - /* Oper's type is in the old config, so update it */ - if (std::find(Config->MyOperTypes.begin(), Config->MyOperTypes.end(), o->ot) != Config->MyOperTypes.end()) + if (o->ot == NULL) { - OperType *ot = o->ot; - o->ot = NULL; + /* Oper block has lost type */ + std::vector::iterator it = std::find(old->Opers.begin(), old->Opers.end(), o); + if (it != old->Opers.end()) + old->Opers.erase(it); - for (unsigned j = 0; j < MyOperTypes.size(); ++j) - if (ot->GetName() == MyOperTypes[j]->GetName()) - o->ot = MyOperTypes[j]; + it = std::find(this->Opers.begin(), this->Opers.end(), o); + if (it != this->Opers.end()) + this->Opers.erase(it); - if (o->ot == NULL) - delete o; /* Oper block has lost type */ + delete o; } } } } -Conf::~Conf() -{ - for (unsigned i = 0; i < MyOperTypes.size(); ++i) - delete MyOperTypes[i]; - for (unsigned i = 0; i < Opers.size(); ++i) - delete Opers[i]; -} - Block *Conf::GetModule(Module *m) { if (!m) diff --git a/src/init.cpp b/src/init.cpp index f62ef083a..07f847d70 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -126,8 +126,10 @@ void Anope::HandleSignal() try { Configuration::Conf *new_config = new Configuration::Conf(); - delete Config; + Configuration::Conf *old = Config; Config = new_config; + Config->Post(old); + delete old; } catch (const ConfigException &ex) { -- cgit From c1c45a5db9ba52111978f69eea8a6823ee467459 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 7 Apr 2014 15:28:07 -0400 Subject: Do not clear all extension items tied to objects when unserializing. Instead, pass the old object to the unserialization functions and let them incrementally update the object. --- src/extensible.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/extensible.cpp b/src/extensible.cpp index 552ad5d2b..37206f7c1 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -49,9 +49,6 @@ void Extensible::ExtensibleSerialize(const Extensible *e, const Serializable *s, void Extensible::ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) { - while (!e->extension_items.empty()) - (*e->extension_items.begin())->Unset(e); - for (std::set::iterator it = extensible_items.begin(); it != extensible_items.end(); ++it) { ExtensibleBase *eb = *it; -- cgit