mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Made config rehashing not wipe opers configured with opersev/oper
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
+3
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user