summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-18 16:01:33 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-18 16:01:33 +0000
commita59d08fffd3dc8a9850ce34c9928fb6382b9b37f (patch)
tree1d5debd7915dddc122feec50443f42d535cba311 /src
parentda6e45397e4ee86d6caf86d2fd5fd8f77af48a1e (diff)
Remove VF_SERVICEPROVIDER, prevent heap allocation of ConfigReader
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11904 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/logger.cpp4
-rw-r--r--src/modules/extra/m_mysql.cpp56
-rw-r--r--src/modules/extra/m_pgsql.cpp2
-rw-r--r--src/modules/extra/m_regex_pcre.cpp2
-rw-r--r--src/modules/extra/m_regex_posix.cpp2
-rw-r--r--src/modules/extra/m_regex_tre.cpp2
-rw-r--r--src/modules/extra/m_sqlite3.cpp2
-rw-r--r--src/modules/m_censor.cpp10
-rw-r--r--src/modules/m_conn_join.cpp5
-rw-r--r--src/modules/m_connflood.cpp15
-rw-r--r--src/modules/m_dccallow.cpp22
-rw-r--r--src/modules/m_deaf.cpp8
-rw-r--r--src/modules/m_denychans.cpp40
-rw-r--r--src/modules/m_dnsbl.cpp28
-rw-r--r--src/modules/m_httpd.cpp2
-rw-r--r--src/modules/m_md5.cpp4
-rwxr-xr-xsrc/modules/m_nationalchars.cpp9
-rw-r--r--src/modules/m_operjoin.cpp21
-rw-r--r--src/modules/m_operlevels.cpp38
-rw-r--r--src/modules/m_opermodes.cpp47
-rw-r--r--src/modules/m_opermotd.cpp13
-rw-r--r--src/modules/m_randquote.cpp11
-rw-r--r--src/modules/m_regex_glob.cpp2
-rw-r--r--src/modules/m_restrictchans.cpp20
-rw-r--r--src/modules/m_ripemd160.cpp2
-rw-r--r--src/modules/m_securelist.cpp9
-rw-r--r--src/modules/m_sha256.cpp4
-rw-r--r--src/modules/m_spanningtree/utils.cpp62
-rw-r--r--src/modules/m_sqlutils.cpp2
-rw-r--r--src/modules/m_sslinfo.cpp2
-rw-r--r--src/modules/m_vhost.cpp21
31 files changed, 198 insertions, 269 deletions
diff --git a/src/logger.cpp b/src/logger.cpp
index c9b1cf9e4..be28bf836 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -68,7 +68,7 @@ void LogManager::OpenFileLogs()
{
return;
}
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader Conf;
std::map<std::string, FileWriter*> logmap;
std::map<std::string, FileWriter*>::iterator i;
for (int index = 0;; ++index)
@@ -106,7 +106,7 @@ void LogManager::OpenFileLogs()
loglevel = NONE;
}
FileWriter* fw;
- std::string target = Conf->ReadValue("log", "target", index);
+ std::string target = Conf.ReadValue("log", "target", index);
if ((i = logmap.find(target)) == logmap.end())
{
FILE* f = fopen(target.c_str(), "a");
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 90a2d95dc..47de25ee4 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -87,8 +87,6 @@ unsigned long count(const char * const str, char a)
class ModuleSQL : public Module
{
public:
-
- ConfigReader *Conf;
int currid;
bool rehashing;
DispatcherThread* Dispatcher;
@@ -549,30 +547,31 @@ bool HasHost(const SQLhost &host)
return false;
}
-bool HostInConf(ConfigReader* conf, const SQLhost &h)
+bool HostInConf(const SQLhost &h)
{
- for(int i = 0; i < conf->Enumerate("database"); i++)
+ ConfigReader conf;
+ for(int i = 0; i < conf.Enumerate("database"); i++)
{
SQLhost host;
- host.id = conf->ReadValue("database", "id", i);
- host.host = conf->ReadValue("database", "hostname", i);
- host.port = conf->ReadInteger("database", "port", i, true);
- host.name = conf->ReadValue("database", "name", i);
- host.user = conf->ReadValue("database", "username", i);
- host.pass = conf->ReadValue("database", "password", i);
- host.ssl = conf->ReadFlag("database", "ssl", i);
+ host.id = conf.ReadValue("database", "id", i);
+ host.host = conf.ReadValue("database", "hostname", i);
+ host.port = conf.ReadInteger("database", "port", i, true);
+ host.name = conf.ReadValue("database", "name", i);
+ host.user = conf.ReadValue("database", "username", i);
+ host.pass = conf.ReadValue("database", "password", i);
+ host.ssl = conf.ReadFlag("database", "ssl", i);
if (h == host)
return true;
}
return false;
}
-void ClearOldConnections(ConfigReader* conf)
+void ClearOldConnections()
{
ConnMap::iterator i,safei;
for (i = Connections.begin(); i != Connections.end(); i++)
{
- if (!HostInConf(conf, i->second->GetConfHost()))
+ if (!HostInConf(i->second->GetConfHost()))
{
delete i->second;
safei = i;
@@ -611,21 +610,22 @@ void ConnectDatabases(ModuleSQL* Parent)
}
}
-void LoadDatabases(ConfigReader* conf, ModuleSQL* Parent)
+void LoadDatabases(ModuleSQL* Parent)
{
+ ConfigReader conf;
Parent->ConnMutex.Lock();
- ClearOldConnections(conf);
- for (int j =0; j < conf->Enumerate("database"); j++)
+ ClearOldConnections();
+ for (int j =0; j < conf.Enumerate("database"); j++)
{
SQLhost host;
- host.id = conf->ReadValue("database", "id", j);
- host.host = conf->ReadValue("database", "hostname", j);
- host.port = conf->ReadInteger("database", "port", j, true);
- host.name = conf->ReadValue("database", "name", j);
- host.user = conf->ReadValue("database", "username", j);
- host.pass = conf->ReadValue("database", "password", j);
- host.ssl = conf->ReadFlag("database", "ssl", j);
- std::string initquery = conf->ReadValue("database", "initialquery", j);
+ host.id = conf.ReadValue("database", "id", j);
+ host.host = conf.ReadValue("database", "hostname", j);
+ host.port = conf.ReadInteger("database", "port", j, true);
+ host.name = conf.ReadValue("database", "name", j);
+ host.user = conf.ReadValue("database", "username", j);
+ host.pass = conf.ReadValue("database", "password", j);
+ host.ssl = conf.ReadFlag("database", "ssl", j);
+ std::string initquery = conf.ReadValue("database", "initialquery", j);
if (HasHost(host))
continue;
@@ -683,7 +683,6 @@ ModuleSQL::ModuleSQL() : rehashing(false)
{
ServerInstance->Modules->UseInterface("SQLutils");
- Conf = new ConfigReader;
currid = 0;
Dispatcher = new DispatcherThread(this);
@@ -706,7 +705,6 @@ ModuleSQL::~ModuleSQL()
{
delete Dispatcher;
ClearAllConnections();
- delete Conf;
ServerInstance->Modules->UnpublishInterface("SQL", this);
ServerInstance->Modules->UnpublishFeature("SQL");
ServerInstance->Modules->DoneWithInterface("SQLutils");
@@ -756,12 +754,12 @@ void ModuleSQL::OnRehash(User* user)
Version ModuleSQL::GetVersion()
{
- return Version("SQL Service Provider module for all other m_sql* modules", VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("SQL Service Provider module for all other m_sql* modules", VF_VENDOR);
}
void DispatcherThread::Run()
{
- LoadDatabases(Parent->Conf, Parent);
+ LoadDatabases(Parent);
SQLConnection* conn = NULL;
@@ -771,7 +769,7 @@ void DispatcherThread::Run()
if (Parent->rehashing)
{
Parent->rehashing = false;
- LoadDatabases(Parent->Conf, Parent);
+ LoadDatabases(Parent);
}
conn = NULL;
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 5d2fe106b..b5beea0b0 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -954,7 +954,7 @@ class ModulePgSQL : public Module
virtual Version GetVersion()
{
- return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR|VF_SERVICEPROVIDER);
+ return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR);
}
};
diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp
index 8f2284ce6..9e8aff159 100644
--- a/src/modules/extra/m_regex_pcre.cpp
+++ b/src/modules/extra/m_regex_pcre.cpp
@@ -76,7 +76,7 @@ public:
virtual Version GetVersion()
{
- return Version("Regex Provider Module for PCRE", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("Regex Provider Module for PCRE", VF_COMMON | VF_VENDOR);
}
virtual ~ModuleRegexPCRE()
diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp
index 1bcd32187..ea016ae64 100644
--- a/src/modules/extra/m_regex_posix.cpp
+++ b/src/modules/extra/m_regex_posix.cpp
@@ -85,7 +85,7 @@ public:
virtual Version GetVersion()
{
- return Version("Regex Provider Module for POSIX Regular Expressions", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("Regex Provider Module for POSIX Regular Expressions", VF_COMMON | VF_VENDOR);
}
virtual ~ModuleRegexPOSIX()
diff --git a/src/modules/extra/m_regex_tre.cpp b/src/modules/extra/m_regex_tre.cpp
index ef0ed91a4..01c6ebf4a 100644
--- a/src/modules/extra/m_regex_tre.cpp
+++ b/src/modules/extra/m_regex_tre.cpp
@@ -82,7 +82,7 @@ public:
virtual Version GetVersion()
{
- return Version("Regex Provider Module for TRE Regular Expressions", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("Regex Provider Module for TRE Regular Expressions", VF_COMMON | VF_VENDOR);
}
virtual ~ModuleRegexTRE()
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index aba3c0930..234f89ea2 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -723,7 +723,7 @@ class ModuleSQLite3 : public Module
virtual Version GetVersion()
{
- return Version("sqlite3 provider", VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("sqlite3 provider", VF_VENDOR);
}
};
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 398241475..faf2a4200 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -114,17 +114,15 @@ class ModuleCensor : public Module
* reload our config file on rehash - we must destroy and re-allocate the classes
* to call the constructor again and re-read our data.
*/
- ConfigReader* MyConf = new ConfigReader;
+ ConfigReader MyConf;
censors.clear();
- for (int index = 0; index < MyConf->Enumerate("badword"); index++)
+ for (int index = 0; index < MyConf.Enumerate("badword"); index++)
{
- irc::string pattern = (MyConf->ReadValue("badword","text",index)).c_str();
- irc::string replace = (MyConf->ReadValue("badword","replace",index)).c_str();
+ irc::string pattern = (MyConf.ReadValue("badword","text",index)).c_str();
+ irc::string replace = (MyConf.ReadValue("badword","replace",index)).c_str();
censors[pattern] = replace;
}
-
- delete MyConf;
}
virtual Version GetVersion()
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index b1f12e1eb..ef834e55a 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -57,12 +57,11 @@ class ModuleConnJoin : public Module
virtual void OnRehash(User* user)
{
- ConfigReader* conf = new ConfigReader;
- JoinChan = conf->ReadValue("autojoin", "channel", 0);
+ ConfigReader conf;
+ JoinChan = conf.ReadValue("autojoin", "channel", 0);
Joinchans.clear();
if (!JoinChan.empty())
tokenize(JoinChan,Joinchans);
- delete conf;
}
virtual ~ModuleConnJoin()
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index ae9fcf0e5..b2aaab45a 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -24,9 +24,6 @@ private:
time_t first;
std::string quitmsg;
- ConfigReader* conf;
-
-
public:
ModuleConnFlood() {
@@ -47,15 +44,15 @@ public:
void InitConf()
{
/* read configuration variables */
- conf = new ConfigReader;
+ ConfigReader conf;
/* throttle configuration */
- seconds = conf->ReadInteger("connflood", "seconds", 0, true);
- maxconns = conf->ReadInteger("connflood", "maxconns", 0, true);
- timeout = conf->ReadInteger("connflood", "timeout", 0, true);
- quitmsg = conf->ReadValue("connflood", "quitmsg", 0);
+ seconds = conf.ReadInteger("connflood", "seconds", 0, true);
+ maxconns = conf.ReadInteger("connflood", "maxconns", 0, true);
+ timeout = conf.ReadInteger("connflood", "timeout", 0, true);
+ quitmsg = conf.ReadValue("connflood", "quitmsg", 0);
/* seconds to wait when the server just booted */
- boot_wait = conf->ReadInteger("connflood", "bootwait", 0, true);
+ boot_wait = conf.ReadInteger("connflood", "bootwait", 0, true);
first = ServerInstance->Time();
}
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index d4be35ceb..fb05283fc 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -15,8 +15,6 @@
/* $ModDesc: Povides support for the /DCCALLOW command */
-static ConfigReader *Conf;
-
class BannedFileList
{
public:
@@ -140,7 +138,8 @@ class CommandDccallow : public Command
}
std::string mask = std::string(target->nick)+"!"+std::string(target->ident)+"@"+std::string(target->dhost);
- std::string default_length = Conf->ReadValue("dccallow", "length", 0);
+ ConfigReader Conf;
+ std::string default_length = Conf.ReadValue("dccallow", "length", 0);
long length;
if (parameters.size() < 2)
@@ -242,7 +241,6 @@ class ModuleDCCAllow : public Module
ModuleDCCAllow()
: cmd(this)
{
- Conf = new ConfigReader;
ext = new SimpleExtItem<dccallowlist>("dccallow", this);
ServerInstance->Extensions.Register(ext);
ServerInstance->AddCommand(&cmd);
@@ -254,8 +252,6 @@ class ModuleDCCAllow : public Module
virtual void OnRehash(User* user)
{
- delete Conf;
- Conf = new ConfigReader;
ReadFileConf();
}
@@ -325,11 +321,12 @@ class ModuleDCCAllow : public Module
irc::string type = tokens[1].c_str();
- bool blockchat = Conf->ReadFlag("dccallow", "blockchat", 0);
+ ConfigReader Conf;
+ bool blockchat = Conf.ReadFlag("dccallow", "blockchat", 0);
if (type == "SEND")
{
- std::string defaultaction = Conf->ReadValue("dccallow", "action", 0);
+ std::string defaultaction = Conf.ReadValue("dccallow", "action", 0);
std::string filename = tokens[2];
bool found = false;
@@ -449,12 +446,13 @@ class ModuleDCCAllow : public Module
void ReadFileConf()
{
+ ConfigReader Conf;
bfl.clear();
- for (int i = 0; i < Conf->Enumerate("banfile"); i++)
+ for (int i = 0; i < Conf.Enumerate("banfile"); i++)
{
BannedFileList bf;
- std::string fileglob = Conf->ReadValue("banfile", "pattern", i);
- std::string action = Conf->ReadValue("banfile", "action", i);
+ std::string fileglob = Conf.ReadValue("banfile", "pattern", i);
+ std::string action = Conf.ReadValue("banfile", "action", i);
bf.filemask = fileglob;
bf.action = action;
bfl.push_back(bf);
@@ -464,9 +462,7 @@ class ModuleDCCAllow : public Module
virtual ~ModuleDCCAllow()
{
- delete Conf;
delete ext;
- Conf = NULL;
}
virtual Version GetVersion()
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index f52702bca..fb6720ca9 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -67,11 +67,9 @@ class ModuleDeaf : public Module
virtual void OnRehash(User* user)
{
- ConfigReader* conf = new ConfigReader;
- deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0);
- deaf_bypasschars_uline = conf->ReadValue("deaf", "bypasscharsuline", 0);
-
- delete conf;
+ ConfigReader conf;
+ deaf_bypasschars = conf.ReadValue("deaf", "bypasschars", 0);
+ deaf_bypasschars_uline = conf.ReadValue("deaf", "bypasscharsuline", 0);
}
virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 4493b6240..4988c8daa 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -17,28 +17,20 @@
class ModuleDenyChannels : public Module
{
- private:
-
-
- ConfigReader *Conf;
-
public:
ModuleDenyChannels() {
-
- Conf = new ConfigReader;
Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual void OnRehash(User* user)
{
- delete Conf;
- Conf = new ConfigReader;
+ ConfigReader Conf;
/* check for redirect validity and loops/chains */
- for (int i =0; i < Conf->Enumerate("badchan"); i++)
+ for (int i =0; i < Conf.Enumerate("badchan"); i++)
{
- std::string name = Conf->ReadValue("badchan","name",i);
- std::string redirect = Conf->ReadValue("badchan","redirect",i);
+ std::string name = Conf.ReadValue("badchan","name",i);
+ std::string redirect = Conf.ReadValue("badchan","redirect",i);
if (!redirect.empty())
{
@@ -50,14 +42,14 @@ class ModuleDenyChannels : public Module
throw ModuleException("Invalid badchan redirect, not a channel");
}
- for (int j =0; j < Conf->Enumerate("badchan"); j++)
+ for (int j =0; j < Conf.Enumerate("badchan"); j++)
{
- if (InspIRCd::Match(redirect, Conf->ReadValue("badchan","name",j)))
+ if (InspIRCd::Match(redirect, Conf.ReadValue("badchan","name",j)))
{
bool goodchan = false;
- for (int k =0; k < Conf->Enumerate("goodchan"); k++)
+ for (int k =0; k < Conf.Enumerate("goodchan"); k++)
{
- if (InspIRCd::Match(redirect, Conf->ReadValue("goodchan","name",k)))
+ if (InspIRCd::Match(redirect, Conf.ReadValue("goodchan","name",k)))
goodchan = true;
}
@@ -76,7 +68,6 @@ class ModuleDenyChannels : public Module
virtual ~ModuleDenyChannels()
{
- delete Conf;
}
virtual Version GetVersion()
@@ -87,22 +78,23 @@ class ModuleDenyChannels : public Module
virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
- for (int j =0; j < Conf->Enumerate("badchan"); j++)
+ ConfigReader Conf;
+ for (int j =0; j < Conf.Enumerate("badchan"); j++)
{
- if (InspIRCd::Match(cname, Conf->ReadValue("badchan","name",j)))
+ if (InspIRCd::Match(cname, Conf.ReadValue("badchan","name",j)))
{
- if (IS_OPER(user) && Conf->ReadFlag("badchan","allowopers",j))
+ if (IS_OPER(user) && Conf.ReadFlag("badchan","allowopers",j))
{
return MOD_RES_PASSTHRU;
}
else
{
- std::string reason = Conf->ReadValue("badchan","reason",j);
- std::string redirect = Conf->ReadValue("badchan","redirect",j);
+ std::string reason = Conf.ReadValue("badchan","reason",j);
+ std::string redirect = Conf.ReadValue("badchan","redirect",j);
- for (int i = 0; i < Conf->Enumerate("goodchan"); i++)
+ for (int i = 0; i < Conf.Enumerate("goodchan"); i++)
{
- if (InspIRCd::Match(cname, Conf->ReadValue("goodchan", "name", i)))
+ if (InspIRCd::Match(cname, Conf.ReadValue("goodchan", "name", i)))
{
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 5fedf08dd..d97ea940a 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -24,7 +24,7 @@
/* $ModDesc: Provides handling of DNS blacklists */
/* Class holding data for a single entry */
-class DNSBLConfEntry : public classbase
+class DNSBLConfEntry
{
public:
enum EnumBanaction { I_UNKNOWN, I_KILL, I_ZLINE, I_KLINE, I_GLINE, I_MARK };
@@ -245,36 +245,36 @@ class ModuleDNSBL : public Module
*/
virtual void ReadConf()
{
- ConfigReader *MyConf = new ConfigReader;
+ ConfigReader MyConf;
ClearEntries();
- for (int i=0; i< MyConf->Enumerate("dnsbl"); i++)
+ for (int i=0; i< MyConf.Enumerate("dnsbl"); i++)
{
DNSBLConfEntry *e = new DNSBLConfEntry();
- e->name = MyConf->ReadValue("dnsbl", "name", i);
- e->ident = MyConf->ReadValue("dnsbl", "ident", i);
- e->host = MyConf->ReadValue("dnsbl", "host", i);
- e->reason = MyConf->ReadValue("dnsbl", "reason", i);
- e->domain = MyConf->ReadValue("dnsbl", "domain", i);
+ e->name = MyConf.ReadValue("dnsbl", "name", i);
+ e->ident = MyConf.ReadValue("dnsbl", "ident", i);
+ e->host = MyConf.ReadValue("dnsbl", "host", i);
+ e->reason = MyConf.ReadValue("dnsbl", "reason", i);
+ e->domain = MyConf.ReadValue("dnsbl", "domain", i);
- if (MyConf->ReadValue("dnsbl", "type", i) == "bitmask")
+ if (MyConf.ReadValue("dnsbl", "type", i) == "bitmask")
{
e->type = DNSBLConfEntry::A_BITMASK;
- e->bitmask = MyConf->ReadInteger("dnsbl", "bitmask", i, false);
+ e->bitmask = MyConf.ReadInteger("dnsbl", "bitmask", i, false);
}
else
{
memset(e->records, 0, sizeof(e->records));
e->type = DNSBLConfEntry::A_RECORD;
- irc::portparser portrange(MyConf->ReadValue("dnsbl", "records", i), false);
+ irc::portparser portrange(MyConf.ReadValue("dnsbl", "records", i), false);
long item = -1;
while ((item = portrange.GetToken()))
e->records[item] = 1;
}
- e->banaction = str2banaction(MyConf->ReadValue("dnsbl", "action", i));
- e->duration = ServerInstance->Duration(MyConf->ReadValue("dnsbl", "duration", "60", i));
+ e->banaction = str2banaction(MyConf.ReadValue("dnsbl", "action", i));
+ e->duration = ServerInstance->Duration(MyConf.ReadValue("dnsbl", "duration", "60", i));
/* Use portparser for record replies */
@@ -315,8 +315,6 @@ class ModuleDNSBL : public Module
/* delete and drop it, error somewhere */
delete e;
}
-
- delete MyConf;
}
virtual void OnRehash(User* user)
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 84d48cc38..2991b524e 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -421,7 +421,7 @@ class ModuleHttpServer : public Module
virtual Version GetVersion()
{
- return Version("Provides HTTP serving facilities to modules", VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("Provides HTTP serving facilities to modules", VF_VENDOR);
}
};
diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp
index 7669d63d7..6ac9c3d87 100644
--- a/src/modules/m_md5.cpp
+++ b/src/modules/m_md5.cpp
@@ -39,7 +39,7 @@ typedef unsigned char byte;
/** An MD5 context, used by m_opermd5
*/
-class MD5Context : public classbase
+class MD5Context
{
public:
word32 buf[4];
@@ -296,7 +296,7 @@ class ModuleMD5 : public Module
Version GetVersion()
{
- return Version("Allows for MD5 encrypted oper passwords",VF_VENDOR|VF_SERVICEPROVIDER);
+ return Version("Allows for MD5 encrypted oper passwords",VF_VENDOR);
}
};
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index af6e962cf..5e919dad6 100755
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -243,15 +243,14 @@ class ModuleNationalChars : public Module
virtual void OnRehash(User* user)
{
- ConfigReader* conf = new ConfigReader;
- charset = conf->ReadValue("nationalchars", "file", 0);
- casemapping = conf->ReadValue("nationalchars", "casemapping", charset, 0, false);
+ ConfigReader conf;
+ charset = conf.ReadValue("nationalchars", "file", 0);
+ casemapping = conf.ReadValue("nationalchars", "casemapping", charset, 0, false);
charset.insert(0, "../locales/");
unsigned char * tables[8] = { m_additional, m_additionalMB, m_additionalUp, m_lower, m_upper, m_additionalUtf8, m_additionalUtf8range, m_additionalUtf8interval };
loadtables(charset, tables, 8, 5);
- forcequit = conf->ReadFlag("nationalchars", "forcequit", 0);
+ forcequit = conf.ReadFlag("nationalchars", "forcequit", 0);
CheckForceQuit("National character set changed");
- delete conf;
}
void CheckForceQuit(const char * message)
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index 772bef525..42b30f6fb 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -43,36 +43,35 @@ class ModuleOperjoin : public Module
}
public:
- ModuleOperjoin() {
+ ModuleOperjoin()
+ {
OnRehash(NULL);
- Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual void OnRehash(User* user)
{
- ConfigReader* conf = new ConfigReader;
+ ConfigReader conf;
- operChan = conf->ReadValue("operjoin", "channel", 0);
- override = conf->ReadFlag("operjoin", "override", "0", 0);
+ operChan = conf.ReadValue("operjoin", "channel", 0);
+ override = conf.ReadFlag("operjoin", "override", "0", 0);
operChans.clear();
if (!operChan.empty())
tokenize(operChan,operChans);
std::map<std::string, std::vector<std::string> >().swap(operTypeChans);
- int olines = conf->Enumerate("type");
+ int olines = conf.Enumerate("type");
for (int index = 0; index < olines; ++index)
{
- std::string chanList = conf->ReadValue("type", "autojoin", index);
+ std::string chanList = conf.ReadValue("type", "autojoin", index);
if (!chanList.empty())
{
- tokenize(chanList, operTypeChans[conf->ReadValue("type", "name", index)]);
+ tokenize(chanList, operTypeChans[conf.ReadValue("type", "name", index)]);
}
}
-
- delete conf;
}
virtual ~ModuleOperjoin()
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 6ed0c2a53..7a18991c1 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -16,26 +16,20 @@
/* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
class ModuleOperLevels : public Module
{
- private:
- ConfigReader* conf;
public:
ModuleOperLevels()
- {
- conf = new ConfigReader;
+ {
Implementation eventlist[] = { I_OnRehash, I_OnKill };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual ~ModuleOperLevels()
{
- delete conf;
}
virtual void OnRehash(User* user)
{
- delete conf;
- conf = new ConfigReader;
}
virtual Version GetVersion()
@@ -45,29 +39,19 @@ class ModuleOperLevels : public Module
virtual ModResult OnKill(User* source, User* dest, const std::string &reason)
{
- long dest_level = 0,source_level = 0;
-
// oper killing an oper?
if (IS_OPER(dest) && IS_OPER(source))
{
- for (int j =0; j < conf->Enumerate("type"); j++)
- {
- std::string typen = conf->ReadValue("type","name",j);
- if (typen == dest->oper)
- {
- dest_level = conf->ReadInteger("type","level",j,true);
- break;
- }
- }
- for (int k =0; k < conf->Enumerate("type"); k++)
- {
- std::string typen = conf->ReadValue("type","name",k);
- if (typen == source->oper)
- {
- source_level = conf->ReadInteger("type","level",k,true);
- break;
- }
- }
+ TagIndex::iterator dest_type = ServerInstance->Config->opertypes.find(dest->oper);
+ TagIndex::iterator src_type = ServerInstance->Config->opertypes.find(source->oper);
+
+ if (dest_type == ServerInstance->Config->opertypes.end())
+ return MOD_RES_PASSTHRU;
+ if (src_type == ServerInstance->Config->opertypes.end())
+ return MOD_RES_PASSTHRU;
+
+ long dest_level = dest_type->second->getInt("level");
+ long source_level = src_type->second->getInt("level");
if (dest_level > source_level)
{
if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str());
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index d4b873918..9db0b5b4a 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -17,16 +17,9 @@
class ModuleModesOnOper : public Module
{
- private:
-
-
- ConfigReader *Conf;
-
public:
ModuleModesOnOper()
- {
-
- Conf = new ConfigReader;
+ {
Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
@@ -34,13 +27,10 @@ class ModuleModesOnOper : public Module
virtual void OnRehash(User* user)
{
- delete Conf;
- Conf = new ConfigReader;
}
virtual ~ModuleModesOnOper()
{
- delete Conf;
}
virtual Version GetVersion()
@@ -50,36 +40,33 @@ class ModuleModesOnOper : public Module
virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername)
{
+ TagIndex::iterator typetag = ServerInstance->Config->opertypes.find(opertype);
+ if (typetag == ServerInstance->Config->opertypes.end())
+ return;
// whenever a user opers, go through the oper types, find their <type:modes>,
// and if they have one apply their modes. The mode string can contain +modes
// to add modes to the user or -modes to take modes from the user.
- for (int j =0; j < Conf->Enumerate("type"); j++)
+ std::string ThisOpersModes = typetag->second->getString("modes");
+ if (!ThisOpersModes.empty())
{
- std::string typen = Conf->ReadValue("type","name",j);
- if (typen == user->oper)
- {
- std::string ThisOpersModes = Conf->ReadValue("type","modes",j);
- if (!ThisOpersModes.empty())
- {
- ApplyModes(user, ThisOpersModes);
- }
- break;
- }
+ ApplyModes(user, ThisOpersModes);
}
if (!opername.empty()) // if user is local ..
{
- for (int j = 0; j < Conf->Enumerate("oper"); j++)
+ for (int i = 0;; i++)
{
- if (opername == Conf->ReadValue("oper", "name", j))
- {
- std::string ThisOpersModes = Conf->ReadValue("oper", "modes", j);
- if (!ThisOpersModes.empty())
- {
- ApplyModes(user, ThisOpersModes);
- }
+ ConfigTag* tag = ServerInstance->Config->ConfValue("oper", i);
+ if (!tag)
break;
+ if (tag->getString("name") != opername)
+ continue;
+ ThisOpersModes = tag->getString("modes");
+ if (!ThisOpersModes.empty())
+ {
+ ApplyModes(user, ThisOpersModes);
}
+ break;
}
}
}
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index a9f7b3b07..a4956f05f 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -63,17 +63,12 @@ class ModuleOpermotd : public Module
void LoadOperMOTD()
{
- ConfigReader* conf = new ConfigReader;
+ ConfigReader conf;
std::string filename;
- filename = conf->ReadValue("opermotd","file",0);
- if (opermotd)
- {
- delete opermotd;
- opermotd = NULL;
- }
+ filename = conf.ReadValue("opermotd","file",0);
+ delete opermotd;
opermotd = new FileReader(filename);
- onoper = conf->ReadFlag("opermotd","onoper","yes",0);
- delete conf;
+ onoper = conf.ReadFlag("opermotd","onoper","yes",0);
}
ModuleOpermotd()
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 3cdf4f30d..f6925e974 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -55,19 +55,17 @@ class ModuleRandQuote : public Module
{
private:
CommandRandquote cmd;
- ConfigReader *conf;
public:
ModuleRandQuote()
: cmd(this)
{
-
- conf = new ConfigReader;
+ ConfigReader conf;
// Sort the Randomizer thingie..
srand(ServerInstance->Time());
- q_file = conf->ReadValue("randquote","file",0);
- prefix = conf->ReadValue("randquote","prefix",0);
- suffix = conf->ReadValue("randquote","suffix",0);
+ q_file = conf.ReadValue("randquote","file",0);
+ prefix = conf.ReadValue("randquote","prefix",0);
+ suffix = conf.ReadValue("randquote","suffix",0);
if (q_file.empty())
{
@@ -91,7 +89,6 @@ class ModuleRandQuote : public Module
virtual ~ModuleRandQuote()
{
- delete conf;
delete quotes;
}
diff --git a/src/modules/m_regex_glob.cpp b/src/modules/m_regex_glob.cpp
index a3923205f..42cc0abd1 100644
--- a/src/modules/m_regex_glob.cpp
+++ b/src/modules/m_regex_glob.cpp
@@ -42,7 +42,7 @@ public:
virtual Version GetVersion()
{
- return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR);
}
virtual ~ModuleRegexGlob()
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index 12c373ab8..8cc882d90 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -17,28 +17,24 @@
class ModuleRestrictChans : public Module
{
-
-
- std::map<irc::string,int> allowchans;
+ std::set<irc::string> allowchans;
void ReadConfig()
{
- ConfigReader* MyConf = new ConfigReader;
allowchans.clear();
- for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++)
+ for (int i = 0;; i++)
{
- std::string txt;
- txt = MyConf->ReadValue("allowchannel", "name", i);
- irc::string channel = txt.c_str();
- allowchans[channel] = 1;
+ ConfigTag* tag = ServerInstance->Config->ConfValue("allowchannel", i);
+ if (!tag)
+ return;
+ std::string txt = tag->getString("name");
+ allowchans.insert(txt.c_str());
}
- delete MyConf;
}
public:
ModuleRestrictChans()
- {
-
+ {
ReadConfig();
Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp
index b8647b3a9..03a7f9895 100644
--- a/src/modules/m_ripemd160.cpp
+++ b/src/modules/m_ripemd160.cpp
@@ -465,7 +465,7 @@ class ModuleRIPEMD160 : public Module
virtual Version GetVersion()
{
- return Version("Allows for RIPEMD-160 encrypted oper passwords", VF_VENDOR|VF_SERVICEPROVIDER);
+ return Version("Allows for RIPEMD-160 encrypted oper passwords", VF_VENDOR);
}
};
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 91dc3a0cd..c553aa742 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -38,14 +38,13 @@ class ModuleSecureList : public Module
void OnRehash(User* user)
{
- ConfigReader* MyConf = new ConfigReader;
+ ConfigReader MyConf;
allowlist.clear();
- for (int i = 0; i < MyConf->Enumerate("securehost"); i++)
- allowlist.push_back(MyConf->ReadValue("securehost", "exception", i));
+ for (int i = 0; i < MyConf.Enumerate("securehost"); i++)
+ allowlist.push_back(MyConf.ReadValue("securehost", "exception", i));
- WaitTime = MyConf->ReadInteger("securelist", "waittime", "60", 0, true);
- delete MyConf;
+ WaitTime = MyConf.ReadInteger("securelist", "waittime", "60", 0, true);
}
diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp
index 1f967207b..7856b296b 100644
--- a/src/modules/m_sha256.cpp
+++ b/src/modules/m_sha256.cpp
@@ -62,7 +62,7 @@ typedef unsigned int uint32_t;
/** An sha 256 context, used by m_opersha256
*/
-class SHA256Context : public classbase
+class SHA256Context
{
public:
unsigned int tot_len;
@@ -273,7 +273,7 @@ class ModuleSHA256 : public Module
Version GetVersion()
{
- return Version("Allows for SHA-256 encrypted oper passwords", VF_VENDOR|VF_SERVICEPROVIDER);
+ return Version("Allows for SHA-256 encrypted oper passwords", VF_VENDOR);
}
};
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 024605a79..c4d5755e6 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -381,16 +381,16 @@ void SpanningTreeUtilities::RefreshIPCache()
void SpanningTreeUtilities::ReadConfiguration(bool rebind)
{
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader Conf;
if (rebind)
{
- for (int j = 0; j < Conf->Enumerate("bind"); j++)
+ for (int j = 0; j < Conf.Enumerate("bind"); j++)
{
- std::string Type = Conf->ReadValue("bind","type",j);
- std::string IP = Conf->ReadValue("bind","address",j);
- std::string Port = Conf->ReadValue("bind","port",j);
- std::string ssl = Conf->ReadValue("bind","ssl",j);
+ std::string Type = Conf.ReadValue("bind","type",j);
+ std::string IP = Conf.ReadValue("bind","address",j);
+ std::string Port = Conf.ReadValue("bind","port",j);
+ std::string ssl = Conf.ReadValue("bind","ssl",j);
if (Type == "servers")
{
irc::portparser portrange(Port, false);
@@ -413,14 +413,14 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
}
}
}
- FlatLinks = Conf->ReadFlag("security","flatlinks",0);
- HideULines = Conf->ReadFlag("security","hideulines",0);
- AnnounceTSChange = Conf->ReadFlag("options","announcets",0);
- AllowOptCommon = Conf->ReadFlag("options", "allowmismatch", 0);
- ChallengeResponse = !Conf->ReadFlag("security", "disablehmac", 0);
- quiet_bursts = Conf->ReadFlag("performance", "quietbursts", 0);
- PingWarnTime = Conf->ReadInteger("options", "pingwarning", 0, true);
- PingFreq = Conf->ReadInteger("options", "serverpingfreq", 0, true);
+ FlatLinks = Conf.ReadFlag("security","flatlinks",0);
+ HideULines = Conf.ReadFlag("security","hideulines",0);
+ AnnounceTSChange = Conf.ReadFlag("options","announcets",0);
+ AllowOptCommon = Conf.ReadFlag("options", "allowmismatch", 0);
+ ChallengeResponse = !Conf.ReadFlag("security", "disablehmac", 0);
+ quiet_bursts = Conf.ReadFlag("performance", "quietbursts", 0);
+ PingWarnTime = Conf.ReadInteger("options", "pingwarning", 0, true);
+ PingFreq = Conf.ReadInteger("options", "serverpingfreq", 0, true);
if (PingFreq == 0)
PingFreq = 60;
@@ -431,22 +431,22 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
AutoconnectBlocks.clear();
LinkBlocks.clear();
ValidIPs.clear();
- for (int j = 0; j < Conf->Enumerate("link"); ++j)
+ for (int j = 0; j < Conf.Enumerate("link"); ++j)
{
reference<Link> L = new Link;
- std::string Allow = Conf->ReadValue("link", "allowmask", j);
- L->Name = (Conf->ReadValue("link", "name", j)).c_str();
+ std::string Allow = Conf.ReadValue("link", "allowmask", j);
+ L->Name = (Conf.ReadValue("link", "name", j)).c_str();
L->AllowMask = Allow;
- L->IPAddr = Conf->ReadValue("link", "ipaddr", j);
- L->Port = Conf->ReadInteger("link", "port", j, true);
- L->SendPass = Conf->ReadValue("link", "sendpass", j);
- L->RecvPass = Conf->ReadValue("link", "recvpass", j);
- L->Fingerprint = Conf->ReadValue("link", "fingerprint", j);
- L->HiddenFromStats = Conf->ReadFlag("link", "statshidden", j);
- L->Timeout = Conf->ReadInteger("link", "timeout", j, true);
- L->Hook = Conf->ReadValue("link", "ssl", j);
- L->Bind = Conf->ReadValue("link", "bind", j);
- L->Hidden = Conf->ReadFlag("link", "hidden", j);
+ L->IPAddr = Conf.ReadValue("link", "ipaddr", j);
+ L->Port = Conf.ReadInteger("link", "port", j, true);
+ L->SendPass = Conf.ReadValue("link", "sendpass", j);
+ L->RecvPass = Conf.ReadValue("link", "recvpass", j);
+ L->Fingerprint = Conf.ReadValue("link", "fingerprint", j);
+ L->HiddenFromStats = Conf.ReadFlag("link", "statshidden", j);
+ L->Timeout = Conf.ReadInteger("link", "timeout", j, true);
+ L->Hook = Conf.ReadValue("link", "ssl", j);
+ L->Bind = Conf.ReadValue("link", "bind", j);
+ L->Hidden = Conf.ReadFlag("link", "hidden", j);
if (L->Name.find('.') == std::string::npos)
throw CoreException("The link name '"+assign(L->Name)+"' is invalid and must contain at least one '.' character");
@@ -524,13 +524,13 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
LinkBlocks.push_back(L);
}
- for (int j = 0; j < Conf->Enumerate("autoconnect"); ++j)
+ for (int j = 0; j < Conf.Enumerate("autoconnect"); ++j)
{
reference<Autoconnect> A = new Autoconnect;
- A->Period = Conf->ReadInteger("autoconnect", "period", j, true);
+ A->Period = Conf.ReadInteger("autoconnect", "period", j, true);
A->NextConnectTime = ServerInstance->Time() + A->Period;
A->position = -1;
- std::string servers = Conf->ReadValue("autoconnect", "server", j);
+ std::string servers = Conf.ReadValue("autoconnect", "server", j);
irc::spacesepstream ss(servers);
std::string server;
while (ss.GetToken(server))
@@ -550,8 +550,6 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
AutoconnectBlocks.push_back(A);
}
-
- delete Conf;
}
Link* SpanningTreeUtilities::FindLink(const std::string& name)
diff --git a/src/modules/m_sqlutils.cpp b/src/modules/m_sqlutils.cpp
index 269f70ad0..28f32ec26 100644
--- a/src/modules/m_sqlutils.cpp
+++ b/src/modules/m_sqlutils.cpp
@@ -218,7 +218,7 @@ public:
Version GetVersion()
{
- return Version("Provides some utilities to SQL client modules, such as mapping queries to users and channels", VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("Provides some utilities to SQL client modules, such as mapping queries to users and channels", VF_VENDOR);
}
};
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 31a209d4e..0ab749703 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -135,7 +135,7 @@ class ModuleSSLInfo : public Module
Version GetVersion()
{
- return Version("SSL Certificate Utilities", VF_VENDOR | VF_SERVICEPROVIDER);
+ return Version("SSL Certificate Utilities", VF_VENDOR);
}
void OnWhois(User* source, User* dest)
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp
index a8f7b98e6..18c2a1eb0 100644
--- a/src/modules/m_vhost.cpp
+++ b/src/modules/m_vhost.cpp
@@ -27,29 +27,28 @@ class CommandVhost : public Command
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
{
- ConfigReader *Conf = new ConfigReader;
-
- for (int index = 0; index < Conf->Enumerate("vhost"); index++)
+ for (int index = 0;; index++)
{
- std::string mask = Conf->ReadValue("vhost","host",index);
- std::string username = Conf->ReadValue("vhost","user",index);
- std::string pass = Conf->ReadValue("vhost","pass",index);
- std::string hash = Conf->ReadValue("vhost","hash",index);
+ ConfigTag* tag = ServerInstance->Config->ConfValue("vhost", index);
+ if (!tag)
+ break;
+ std::string mask = tag->getString("host");
+ std::string username = tag->getString("user");
+ std::string pass = tag->getString("pass");
+ std::string hash = tag->getString("hash");
- if ((!strcmp(parameters[0].c_str(),username.c_str())) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()))
+ if (parameters[0] == username && !ServerInstance->PassCompare(user, pass, parameters[1], hash))
{
if (!mask.empty())
{
- user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
+ user->WriteServ("NOTICE "+user->nick+" :Setting your VHost: " + mask);
user->ChangeDisplayedHost(mask.c_str());
- delete Conf;
return CMD_SUCCESS;
}
}
}
user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
- delete Conf;
return CMD_FAILURE;
}
};