mirror of
https://github.com/inspircd/inspircd.git
synced 2025-04-21 15:31:27 -04:00
Fixed to use new methods of ServerConfig
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2414 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
e0e8b0df5a
commit
c08ea9f1ad
@ -1346,9 +1346,9 @@ void handle_stats(char **parameters, int pcnt, userrec *user)
|
|||||||
if (*parameters[0] == 'U')
|
if (*parameters[0] == 'U')
|
||||||
{
|
{
|
||||||
char ulined[MAXBUF];
|
char ulined[MAXBUF];
|
||||||
for (int i = 0; i < ConfValueEnum("uline",&Config->config_f); i++)
|
for (int i = 0; i < Config->ConfValueEnum("uline",&Config->config_f); i++)
|
||||||
{
|
{
|
||||||
ConfValue("uline","server",i,ulined,&Config->config_f);
|
Config->ConfValue("uline","server",i,ulined,&Config->config_f);
|
||||||
WriteServ(user->fd,"248 %s U %s",user->nick,ulined);
|
WriteServ(user->fd,"248 %s U %s",user->nick,ulined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1444,14 +1444,14 @@ void handle_stats(char **parameters, int pcnt, userrec *user)
|
|||||||
/* stats o */
|
/* stats o */
|
||||||
if (*parameters[0] == 'o')
|
if (*parameters[0] == 'o')
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ConfValueEnum("oper",&Config->config_f); i++)
|
for (int i = 0; i < Config->ConfValueEnum("oper",&Config->config_f); i++)
|
||||||
{
|
{
|
||||||
char LoginName[MAXBUF];
|
char LoginName[MAXBUF];
|
||||||
char HostName[MAXBUF];
|
char HostName[MAXBUF];
|
||||||
char OperType[MAXBUF];
|
char OperType[MAXBUF];
|
||||||
ConfValue("oper","name",i,LoginName,&Config->config_f);
|
Config->ConfValue("oper","name",i,LoginName,&Config->config_f);
|
||||||
ConfValue("oper","host",i,HostName,&Config->config_f);
|
Config->ConfValue("oper","host",i,HostName,&Config->config_f);
|
||||||
ConfValue("oper","type",i,OperType,&Config->config_f);
|
Config->ConfValue("oper","type",i,OperType,&Config->config_f);
|
||||||
WriteServ(user->fd,"243 %s O %s * %s %s 0",user->nick,HostName,LoginName,OperType);
|
WriteServ(user->fd,"243 %s O %s * %s %s 0",user->nick,HostName,LoginName,OperType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1532,9 +1532,9 @@ bool is_uline(const char* server)
|
|||||||
if (!(*server))
|
if (!(*server))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < ConfValueEnum("uline",&Config->config_f); i++)
|
for (int i = 0; i < Config->ConfValueEnum("uline",&Config->config_f); i++)
|
||||||
{
|
{
|
||||||
ConfValue("uline","server",i,ServName,&Config->config_f);
|
Config->ConfValue("uline","server",i,ServName,&Config->config_f);
|
||||||
if (!strcasecmp(server,ServName))
|
if (!strcasecmp(server,ServName))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -1569,23 +1569,23 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
|
|||||||
|
|
||||||
snprintf(TheHost,MAXBUF,"%s@%s",user->ident,user->host);
|
snprintf(TheHost,MAXBUF,"%s@%s",user->ident,user->host);
|
||||||
|
|
||||||
for (int i = 0; i < ConfValueEnum("oper",&Config->config_f); i++)
|
for (int i = 0; i < Config->ConfValueEnum("oper",&Config->config_f); i++)
|
||||||
{
|
{
|
||||||
ConfValue("oper","name",i,LoginName,&Config->config_f);
|
Config->ConfValue("oper","name",i,LoginName,&Config->config_f);
|
||||||
ConfValue("oper","password",i,Password,&Config->config_f);
|
Config->ConfValue("oper","password",i,Password,&Config->config_f);
|
||||||
ConfValue("oper","type",i,OperType,&Config->config_f);
|
Config->ConfValue("oper","type",i,OperType,&Config->config_f);
|
||||||
ConfValue("oper","host",i,HostName,&Config->config_f);
|
Config->ConfValue("oper","host",i,HostName,&Config->config_f);
|
||||||
if ((!strcmp(LoginName,parameters[0])) && (!operstrcmp(Password,parameters[1])) && (match(TheHost,HostName)))
|
if ((!strcmp(LoginName,parameters[0])) && (!operstrcmp(Password,parameters[1])) && (match(TheHost,HostName)))
|
||||||
{
|
{
|
||||||
fail2 = true;
|
fail2 = true;
|
||||||
for (j =0; j < ConfValueEnum("type",&Config->config_f); j++)
|
for (j =0; j < Config->ConfValueEnum("type",&Config->config_f); j++)
|
||||||
{
|
{
|
||||||
ConfValue("type","name",j,TypeName,&Config->config_f);
|
Config->ConfValue("type","name",j,TypeName,&Config->config_f);
|
||||||
|
|
||||||
if (!strcmp(TypeName,OperType))
|
if (!strcmp(TypeName,OperType))
|
||||||
{
|
{
|
||||||
/* found this oper's opertype */
|
/* found this oper's opertype */
|
||||||
ConfValue("type","host",j,HostName,&Config->config_f);
|
Config->ConfValue("type","host",j,HostName,&Config->config_f);
|
||||||
if (*HostName)
|
if (*HostName)
|
||||||
ChangeDisplayedHost(user,HostName);
|
ChangeDisplayedHost(user,HostName);
|
||||||
strlcpy(user->oper,TypeName,NICKMAX);
|
strlcpy(user->oper,TypeName,NICKMAX);
|
||||||
@ -1816,8 +1816,8 @@ bool host_matches_everyone(std::string mask, userrec* user)
|
|||||||
char insanemasks[MAXBUF];
|
char insanemasks[MAXBUF];
|
||||||
char buffer[MAXBUF];
|
char buffer[MAXBUF];
|
||||||
char itrigger[MAXBUF];
|
char itrigger[MAXBUF];
|
||||||
ConfValue("insane","hostmasks",0,insanemasks,&Config->config_f);
|
Config->ConfValue("insane","hostmasks",0,insanemasks,&Config->config_f);
|
||||||
ConfValue("insane","trigger",0,itrigger,&Config->config_f);
|
Config->ConfValue("insane","trigger",0,itrigger,&Config->config_f);
|
||||||
if (*itrigger == 0)
|
if (*itrigger == 0)
|
||||||
strlcpy(itrigger,"95.5",MAXBUF);
|
strlcpy(itrigger,"95.5",MAXBUF);
|
||||||
if ((*insanemasks == 'y') || (*insanemasks == 't') || (*insanemasks == '1'))
|
if ((*insanemasks == 'y') || (*insanemasks == 't') || (*insanemasks == '1'))
|
||||||
@ -1844,8 +1844,8 @@ bool ip_matches_everyone(std::string ip, userrec* user)
|
|||||||
{
|
{
|
||||||
char insanemasks[MAXBUF];
|
char insanemasks[MAXBUF];
|
||||||
char itrigger[MAXBUF];
|
char itrigger[MAXBUF];
|
||||||
ConfValue("insane","ipmasks",0,insanemasks,&Config->config_f);
|
Config->ConfValue("insane","ipmasks",0,insanemasks,&Config->config_f);
|
||||||
ConfValue("insane","trigger",0,itrigger,&Config->config_f);
|
Config->ConfValue("insane","trigger",0,itrigger,&Config->config_f);
|
||||||
if (*itrigger == 0)
|
if (*itrigger == 0)
|
||||||
strlcpy(itrigger,"95.5",MAXBUF);
|
strlcpy(itrigger,"95.5",MAXBUF);
|
||||||
if ((*insanemasks == 'y') || (*insanemasks == 't') || (*insanemasks == '1'))
|
if ((*insanemasks == 'y') || (*insanemasks == 't') || (*insanemasks == '1'))
|
||||||
@ -1869,8 +1869,8 @@ bool nick_matches_everyone(std::string nick, userrec* user)
|
|||||||
{
|
{
|
||||||
char insanemasks[MAXBUF];
|
char insanemasks[MAXBUF];
|
||||||
char itrigger[MAXBUF];
|
char itrigger[MAXBUF];
|
||||||
ConfValue("insane","nickmasks",0,insanemasks,&Config->config_f);
|
Config->ConfValue("insane","nickmasks",0,insanemasks,&Config->config_f);
|
||||||
ConfValue("insane","trigger",0,itrigger,&Config->config_f);
|
Config->ConfValue("insane","trigger",0,itrigger,&Config->config_f);
|
||||||
if (*itrigger == 0)
|
if (*itrigger == 0)
|
||||||
strlcpy(itrigger,"95.5",MAXBUF);
|
strlcpy(itrigger,"95.5",MAXBUF);
|
||||||
if ((*insanemasks == 'y') || (*insanemasks == 't') || (*insanemasks == '1'))
|
if ((*insanemasks == 'y') || (*insanemasks == 't') || (*insanemasks == '1'))
|
||||||
|
@ -736,7 +736,7 @@ ConfigReader::ConfigReader()
|
|||||||
Config->ClearStack();
|
Config->ClearStack();
|
||||||
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
||||||
this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
||||||
this->readerror = LoadConf(CONFIG_FILE,this->cache,this->errorlog);
|
this->readerror = Config->LoadConf(CONFIG_FILE,this->cache,this->errorlog);
|
||||||
if (!this->readerror)
|
if (!this->readerror)
|
||||||
this->error = CONF_FILE_NOT_FOUND;
|
this->error = CONF_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -756,7 +756,7 @@ ConfigReader::ConfigReader(std::string filename)
|
|||||||
Config->ClearStack();
|
Config->ClearStack();
|
||||||
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
||||||
this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
this->errorlog = new std::stringstream(std::stringstream::in | std::stringstream::out);
|
||||||
this->readerror = LoadConf(filename.c_str(),this->cache,this->errorlog);
|
this->readerror = Config->LoadConf(filename.c_str(),this->cache,this->errorlog);
|
||||||
if (!this->readerror)
|
if (!this->readerror)
|
||||||
this->error = CONF_FILE_NOT_FOUND;
|
this->error = CONF_FILE_NOT_FOUND;
|
||||||
};
|
};
|
||||||
@ -768,7 +768,7 @@ std::string ConfigReader::ReadValue(std::string tag, std::string name, int index
|
|||||||
char n[MAXBUF];
|
char n[MAXBUF];
|
||||||
strlcpy(t,tag.c_str(),MAXBUF);
|
strlcpy(t,tag.c_str(),MAXBUF);
|
||||||
strlcpy(n,name.c_str(),MAXBUF);
|
strlcpy(n,name.c_str(),MAXBUF);
|
||||||
int res = ReadConf(cache,t,n,index,val);
|
int res = Config->ReadConf(cache,t,n,index,val);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
this->error = CONF_VALUE_NOT_FOUND;
|
this->error = CONF_VALUE_NOT_FOUND;
|
||||||
@ -784,7 +784,7 @@ bool ConfigReader::ReadFlag(std::string tag, std::string name, int index)
|
|||||||
char n[MAXBUF];
|
char n[MAXBUF];
|
||||||
strlcpy(t,tag.c_str(),MAXBUF);
|
strlcpy(t,tag.c_str(),MAXBUF);
|
||||||
strlcpy(n,name.c_str(),MAXBUF);
|
strlcpy(n,name.c_str(),MAXBUF);
|
||||||
int res = ReadConf(cache,t,n,index,val);
|
int res = Config->ReadConf(cache,t,n,index,val);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
this->error = CONF_VALUE_NOT_FOUND;
|
this->error = CONF_VALUE_NOT_FOUND;
|
||||||
@ -801,7 +801,7 @@ long ConfigReader::ReadInteger(std::string tag, std::string name, int index, boo
|
|||||||
char n[MAXBUF];
|
char n[MAXBUF];
|
||||||
strlcpy(t,tag.c_str(),MAXBUF);
|
strlcpy(t,tag.c_str(),MAXBUF);
|
||||||
strlcpy(n,name.c_str(),MAXBUF);
|
strlcpy(n,name.c_str(),MAXBUF);
|
||||||
int res = ReadConf(cache,t,n,index,val);
|
int res = Config->ReadConf(cache,t,n,index,val);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
this->error = CONF_VALUE_NOT_FOUND;
|
this->error = CONF_VALUE_NOT_FOUND;
|
||||||
@ -865,12 +865,12 @@ void ConfigReader::DumpErrors(bool bail, userrec* user)
|
|||||||
|
|
||||||
int ConfigReader::Enumerate(std::string tag)
|
int ConfigReader::Enumerate(std::string tag)
|
||||||
{
|
{
|
||||||
return EnumConf(cache,tag.c_str());
|
return Config->EnumConf(cache,tag.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigReader::EnumerateValues(std::string tag, int index)
|
int ConfigReader::EnumerateValues(std::string tag, int index)
|
||||||
{
|
{
|
||||||
return EnumValues(cache, tag.c_str(), index);
|
return Config->EnumValues(cache, tag.c_str(), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigReader::Verify()
|
bool ConfigReader::Verify()
|
||||||
|
@ -160,21 +160,21 @@ bool userrec::HasPermission(char* command)
|
|||||||
// are they even an oper at all?
|
// are they even an oper at all?
|
||||||
if (strchr(this->modes,'o'))
|
if (strchr(this->modes,'o'))
|
||||||
{
|
{
|
||||||
for (int j =0; j < ConfValueEnum("type",&Config->config_f); j++)
|
for (int j =0; j < Config->ConfValueEnum("type",&Config->config_f); j++)
|
||||||
{
|
{
|
||||||
ConfValue("type","name",j,TypeName,&Config->config_f);
|
Config->ConfValue("type","name",j,TypeName,&Config->config_f);
|
||||||
if (!strcmp(TypeName,this->oper))
|
if (!strcmp(TypeName,this->oper))
|
||||||
{
|
{
|
||||||
ConfValue("type","classes",j,Classes,&Config->config_f);
|
Config->ConfValue("type","classes",j,Classes,&Config->config_f);
|
||||||
char* myclass = strtok_r(Classes," ",&savept);
|
char* myclass = strtok_r(Classes," ",&savept);
|
||||||
while (myclass)
|
while (myclass)
|
||||||
{
|
{
|
||||||
for (int k =0; k < ConfValueEnum("class",&Config->config_f); k++)
|
for (int k =0; k < Config->ConfValueEnum("class",&Config->config_f); k++)
|
||||||
{
|
{
|
||||||
ConfValue("class","name",k,ClassName,&Config->config_f);
|
Config->ConfValue("class","name",k,ClassName,&Config->config_f);
|
||||||
if (!strcmp(ClassName,myclass))
|
if (!strcmp(ClassName,myclass))
|
||||||
{
|
{
|
||||||
ConfValue("class","commands",k,CommandList,&Config->config_f);
|
Config->ConfValue("class","commands",k,CommandList,&Config->config_f);
|
||||||
mycmd = strtok_r(CommandList," ",&savept2);
|
mycmd = strtok_r(CommandList," ",&savept2);
|
||||||
while (mycmd)
|
while (mycmd)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user