summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-01 22:55:46 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-01 22:55:46 +0000
commitc384697c88aa54b5a532cd2edce3c063c70d7868 (patch)
tree3fc454072b3956f241b091265f606bb9c6ca7f67 /src/commands
parent50eebfeac8ebe501b021ebf62b0b01464fd79a21 (diff)
Make rehash generate a new ServerInstance->Config object
This makes it possible to cancel a pending rehash, and fixes possible threading issues with rehash and other events. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11424 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cmd_oper.cpp20
-rw-r--r--src/commands/cmd_rehash.cpp4
-rw-r--r--src/commands/cmd_stats.cpp12
3 files changed, 17 insertions, 19 deletions
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index a98db6ca4..85af2da18 100644
--- a/src/commands/cmd_oper.cpp
+++ b/src/commands/cmd_oper.cpp
@@ -56,13 +56,13 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(),user->host.c_str());
snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(),user->GetIPString());
- for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "oper"); i++)
+ for (int i = 0; i < ServerInstance->Config->ConfValueEnum("oper"); i++)
{
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "name", i, LoginName, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "password", i, Password, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "type", i, OperType, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "host", i, HostName, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "hash", i, HashType, MAXBUF);
+ ServerInstance->Config->ConfValue("oper", "name", i, LoginName, MAXBUF);
+ ServerInstance->Config->ConfValue("oper", "password", i, Password, MAXBUF);
+ ServerInstance->Config->ConfValue("oper", "type", i, OperType, MAXBUF);
+ ServerInstance->Config->ConfValue("oper", "host", i, HostName, MAXBUF);
+ ServerInstance->Config->ConfValue("oper", "hash", i, HashType, MAXBUF);
match_login = (LoginName == parameters[0]);
match_pass = !ServerInstance->PassCompare(user, Password, parameters[1], HashType);
@@ -71,10 +71,10 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
if (match_login && match_pass && match_hosts)
{
type_invalid = true;
- for (j =0; j < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "type"); j++)
+ for (j =0; j < ServerInstance->Config->ConfValueEnum("type"); j++)
{
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type", "name", j, TypeName, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type", "class", j, ClassName, MAXBUF);
+ ServerInstance->Config->ConfValue("type", "name", j, TypeName, MAXBUF);
+ ServerInstance->Config->ConfValue("type", "class", j, ClassName, MAXBUF);
if (!strcmp(TypeName,OperType))
{
@@ -86,7 +86,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
return CMD_FAILURE;
}
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","host", j, HostName, MAXBUF);
+ ServerInstance->Config->ConfValue("type","host", j, HostName, MAXBUF);
if (*HostName)
user->ChangeDisplayedHost(HostName);
if (*ClassName)
diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp
index 9ee71838b..96313829f 100644
--- a/src/commands/cmd_rehash.cpp
+++ b/src/commands/cmd_rehash.cpp
@@ -73,9 +73,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use
FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect());
- ServerInstance->Config->RehashUserUID = user->uuid;
-
- ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, ServerInstance->Config->RehashUserUID);
+ ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, user->uuid);
ServerInstance->Threads->Start(ServerInstance->ConfigThread);
return CMD_SUCCESS;
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 4af8dcb91..f09fcf84f 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -127,9 +127,9 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
case 'U':
{
char ulined[MAXBUF];
- for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "uline"); i++)
+ for (int i = 0; i < ServerInstance->Config->ConfValueEnum("uline"); i++)
{
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "uline","server", i, ulined, MAXBUF);
+ ServerInstance->Config->ConfValue("uline","server", i, ulined, MAXBUF);
results.push_back(sn+" 248 "+user->nick+" U "+std::string(ulined));
}
}
@@ -280,14 +280,14 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str
/* stats o */
case 'o':
- for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "oper"); i++)
+ for (int i = 0; i < ServerInstance->Config->ConfValueEnum("oper"); i++)
{
char LoginName[MAXBUF];
char HostName[MAXBUF];
char OperType[MAXBUF];
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper","name", i, LoginName, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper","host", i, HostName, MAXBUF);
- ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper","type", i, OperType, MAXBUF);
+ ServerInstance->Config->ConfValue("oper","name", i, LoginName, MAXBUF);
+ ServerInstance->Config->ConfValue("oper","host", i, HostName, MAXBUF);
+ ServerInstance->Config->ConfValue("oper","type", i, OperType, MAXBUF);
results.push_back(sn+" 243 "+user->nick+" O "+HostName+" * "+LoginName+" "+OperType+" 0");
}
break;