diff options
author | Adam <Adam@anope.org> | 2011-08-29 16:03:33 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-08-29 16:03:33 -0400 |
commit | 5cf3ddb7b196173fbac848322bf0ed8e4dfd524b (patch) | |
tree | db07e34ac56822826169cc9d8208a7e2aca34773 | |
parent | 1e1a41f0e7bd81bd3eee67281cad2bd284d97b86 (diff) |
Made config rehashing not wipe opers configured with opersev/oper
-rw-r--r-- | include/opertype.h | 3 | ||||
-rw-r--r-- | modules/commands/os_oper.cpp | 10 | ||||
-rw-r--r-- | src/config.cpp | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/include/opertype.h b/include/opertype.h index f76fc07b1..ca2d81ac5 100644 --- a/include/opertype.h +++ b/include/opertype.h @@ -18,9 +18,10 @@ struct CoreExport Oper Anope::string password; Anope::string certfp; OperType *ot; + bool config; Oper(const Anope::string &n, const Anope::string &p, const Anope::string &c, OperType *o) : - name(n), password(p), certfp(c), ot(o) { } + name(n), password(p), certfp(c), ot(o), config(false) { } /** Find an oper block by name * @param name The name diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp index 237c0b5bc..57b2dbde8 100644 --- a/modules/commands/os_oper.cpp +++ b/modules/commands/os_oper.cpp @@ -37,6 +37,8 @@ class CommandOSOper : public Command NickAlias *na = findnick(oper); if (na == NULL) source.Reply(NICK_X_NOT_REGISTERED, oper.c_str()); + else if (na->nc->o) + source.Reply(_("Nick \2%s\2 is already an operator."), na->nick.c_str()); else { OperType *ot = OperType::Find(type); @@ -44,8 +46,7 @@ class CommandOSOper : public Command source.Reply(_("Oper type \2%s\2 has not been configured."), type.c_str()); else { - if (na->nc->o) - delete na->nc->o; + delete na->nc->o; na->nc->o = new Oper(na->nc->display, "", "", ot); Log(LOG_ADMIN, source.u, this) << "ADD " << na->nick << " as type " << ot->GetName(); @@ -82,9 +83,8 @@ class CommandOSOper : public Command continue; source.Reply(_("%-8s %s"), nc->o->name.c_str(), nc->o->ot->GetName().c_str()); - for (std::list<NickAlias *>::const_iterator it2 = nc->aliases.begin(), it2_end = nc->aliases.end(); it2 != it2_end; ++it2) - if (Oper::Find((*it2)->nick) != NULL) - source.Reply(_(" This oper is configured in the configuration file as %s"), (*it2)->nick.c_str()); + if (nc->o->config) + source.Reply(_(" This oper is configured in the configuration file.")); for (std::list<User *>::iterator uit = nc->Users.begin(); uit != nc->Users.end(); ++uit) { User *u = *uit; diff --git a/src/config.cpp b/src/config.cpp index d7bbb6696..fc3fd3db1 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -642,7 +642,8 @@ static bool DoneOperTypes(ServerConfig *, const Anope::string &) static bool InitOpers(ServerConfig *config, const Anope::string &) { for (nickcore_map::const_iterator it = NickCoreList.begin(), it_end = NickCoreList.end(); it != it_end; ++it) - it->second->o = NULL; + if (it->second->o && it->second->o->config) + it->second->o = NULL; for (unsigned i = 0; i < config->Opers.size(); ++i) delete config->Opers[i]; @@ -674,6 +675,7 @@ static bool DoOper(ServerConfig *config, const Anope::string &, const Anope::str throw ConfigException("Oper block for " + name + " has invalid oper type " + type); Oper *o = new Oper(name, password, certfp, ot); + o->config = true; config->Opers.push_back(o); return true; |