summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/botserv.c2
-rw-r--r--src/chanserv.c2
-rw-r--r--src/config.c80
-rw-r--r--src/core/enc_md5.c2
-rw-r--r--src/core/enc_none.c2
-rw-r--r--src/core/enc_old.c2
-rw-r--r--src/core/enc_sha1.c2
-rw-r--r--src/hostserv.c2
-rw-r--r--src/init.c4
-rw-r--r--src/memoserv.c2
-rw-r--r--src/messages.c2
-rw-r--r--src/misc.c51
-rw-r--r--src/modulemanager.cpp15
-rw-r--r--src/nickserv.c2
-rw-r--r--src/operserv.c2
-rw-r--r--src/protocol/inspircd11.c2
-rw-r--r--src/protocol/inspircd12.cpp2
17 files changed, 81 insertions, 95 deletions
diff --git a/src/botserv.c b/src/botserv.c
index 0e4f37600..c160c496b 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -34,7 +34,7 @@ E void moduleAddBotServCmds();
/*************************************************************************/
/* *INDENT-OFF* */
void moduleAddBotServCmds() {
- ModuleManager::LoadModuleList(BotServCoreNumber, BotServCoreModules);
+ ModuleManager::LoadModuleList(BotServCoreModules);
}
/* *INDENT-ON* */
/*************************************************************************/
diff --git a/src/chanserv.c b/src/chanserv.c
index b3d76f4d6..340ab045c 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -113,7 +113,7 @@ int levelinfo_maxwidth = 0;
/*************************************************************************/
void moduleAddChanServCmds() {
- ModuleManager::LoadModuleList(ChanServCoreNumber, ChanServCoreModules);
+ ModuleManager::LoadModuleList(ChanServCoreModules);
}
/* *INDENT-ON* */
diff --git a/src/config.c b/src/config.c
index f136ffc9a..070fcfb6d 100644
--- a/src/config.c
+++ b/src/config.c
@@ -199,39 +199,31 @@ char *SessionLimitDetailsLoc;
bool OSOpersOnly;
static std::string Modules;
-char **ModulesAutoload;
-int ModulesNumber;
+std::list<std::string> ModulesAutoLoad;
/**
* Core Module Stuff
**/
-char **EncModuleList;
-char *EncModules;
-int EncModulesNumber;
+static std::string EncModules;
+std::list<std::string> EncModuleList;
-static char *HostCoreModules;
-char **HostServCoreModules;
-int HostServCoreNumber;
+static std::string HostCoreModules;
+std::list<std::string> HostServCoreModules;
-static char *MemoCoreModules;
-char **MemoServCoreModules;
-int MemoServCoreNumber;
+static std::string MemoCoreModules;
+std::list<std::string> MemoServCoreModules;
-static char *BotCoreModules;
-char **BotServCoreModules;
-int BotServCoreNumber;
+static std::string BotCoreModules;
+std::list<std::string> BotServCoreModules;
-static char *OperCoreModules;
-char **OperServCoreModules;
-int OperServCoreNumber;
+static std::string OperCoreModules;
+std::list<std::string> OperServCoreModules;
-static char *NickCoreModules;
-char **NickServCoreModules;
-int NickServCoreNumber;
+static std::string NickCoreModules;
+std::list<std::string> NickServCoreModules;
-static char *ChanCoreModules;
-char **ChanServCoreModules;
-int ChanServCoreNumber;
+static std::string ChanCoreModules;
+std::list<std::string> ChanServCoreModules;
int DefConLevel;
static std::string DefCon1;
@@ -834,7 +826,7 @@ int ServerConfig::Read(bool bail)
{"networkinfo", "logbot", "no", new ValueContainerBool(&LogBot), DT_BOOLEAN, NoValidation},
{"networkinfo", "networkname", "", new ValueContainerChar(&NetworkName), DT_CHARPTR, ValidateNotEmpty},
{"networkinfo", "nicklen", "0", new ValueContainerUInt(&NickLen), DT_UINTEGER | DT_NORELOAD, ValidateNickLen},
- {"options", "encryption", "", new ValueContainerChar(&EncModules), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
+ {"options", "encryption", "", new ValueContainerString(&EncModules), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
{"options", "userkey1", "0", new ValueContainerLUInt(&UserKey1), DT_LUINTEGER, NoValidation},
{"options", "userkey2", "0", new ValueContainerLUInt(&UserKey2), DT_LUINTEGER, NoValidation},
{"options", "userkey3", "0", new ValueContainerLUInt(&UserKey3), DT_LUINTEGER, NoValidation},
@@ -869,7 +861,7 @@ int ServerConfig::Read(bool bail)
{"nickserv", "database", "nick.db", new ValueContainerChar(&NickDBName), DT_CHARPTR, ValidateNotEmpty},
{"nickserv", "emailregistration", "no", new ValueContainerBool(&NSEmailReg), DT_BOOLEAN, NoValidation},
{"nickserv", "prenickdatabase", "", new ValueContainerChar(&PreNickDBName), DT_CHARPTR, ValidateEmailReg},
- {"nickserv", "modules", "", new ValueContainerChar(&NickCoreModules), DT_CHARPTR, NoValidation},
+ {"nickserv", "modules", "", new ValueContainerString(&NickCoreModules), DT_STRING, NoValidation},
{"nickserv", "forceemail", "no", new ValueContainerBool(&NSForceEmail), DT_BOOLEAN, ValidateEmailReg},
{"nickserv", "defaults", "secure memosignon memoreceive", new ValueContainerString(&NSDefaults), DT_STRING, NoValidation},
{"nickserv", "defaultlanguage", "0", new ValueContainerUInt(&NSDefLanguage), DT_UINTEGER, ValidateLanguage},
@@ -899,7 +891,7 @@ int ServerConfig::Read(bool bail)
{"chanserv", "nick", "ChanServ", new ValueContainerChar(&s_ChanServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"chanserv", "description", "Channel Registration Service", new ValueContainerChar(&desc_ChanServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"chanserv", "database", "chan.db", new ValueContainerChar(&ChanDBName), DT_CHARPTR, ValidateNotEmpty},
- {"chanserv", "modules", "", new ValueContainerChar(&ChanCoreModules), DT_CHARPTR, NoValidation},
+ {"chanserv", "modules", "", new ValueContainerString(&ChanCoreModules), DT_STRING, NoValidation},
{"chanserv", "defaults", "keeptopic secure securefounder signkick", new ValueContainerString(&CSDefaults), DT_STRING, NoValidation},
{"chanserv", "maxregistered", "0", new ValueContainerUInt(&CSMaxReg), DT_UINTEGER, NoValidation},
{"chanserv", "expire", "14d", new ValueContainerTime(&CSExpire), DT_TIME, NoValidation},
@@ -913,7 +905,7 @@ int ServerConfig::Read(bool bail)
{"chanserv", "opersonly", "no", new ValueContainerBool(&CSOpersOnly), DT_BOOLEAN, NoValidation},
{"memoserv", "nick", "MemoServ", new ValueContainerChar(&s_MemoServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"memoserv", "description", "Memo Service", new ValueContainerChar(&desc_MemoServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
- {"memoserv", "modules", "", new ValueContainerChar(&MemoCoreModules), DT_CHARPTR, NoValidation},
+ {"memoserv", "modules", "", new ValueContainerString(&MemoCoreModules), DT_STRING, NoValidation},
{"memoserv", "maxmemos", "0", new ValueContainerUInt(&MSMaxMemos), DT_UINTEGER, NoValidation},
{"memoserv", "senddelay", "0", new ValueContainerTime(&MSSendDelay), DT_TIME, NoValidation},
{"memoserv", "notifyall", "no", new ValueContainerBool(&MSNotifyAll), DT_BOOLEAN, NoValidation},
@@ -921,7 +913,7 @@ int ServerConfig::Read(bool bail)
{"botserv", "nick", "", new ValueContainerChar(&s_BotServ), DT_CHARPTR | DT_NORELOAD, NoValidation},
{"botserv", "description", "Bot Service", new ValueContainerChar(&desc_BotServ), DT_CHARPTR | DT_NORELOAD, ValidateBotServ},
{"botserv", "database", "bot.db", new ValueContainerChar(&BotDBName), DT_CHARPTR, ValidateBotServ},
- {"botserv", "modules", "", new ValueContainerChar(&BotCoreModules), DT_CHARPTR, NoValidation},
+ {"botserv", "modules", "", new ValueContainerString(&BotCoreModules), DT_STRING, NoValidation},
{"botserv", "defaults", "", new ValueContainerString(&BSDefaults), DT_STRING, NoValidation},
{"botserv", "minusers", "0", new ValueContainerUInt(&BSMinUsers), DT_UINTEGER, ValidateBotServ},
{"botserv", "badwordsmax", "0", new ValueContainerUInt(&BSBadWordsMax), DT_UINTEGER, ValidateBotServ},
@@ -933,7 +925,7 @@ int ServerConfig::Read(bool bail)
{"hostserv", "nick", "", new ValueContainerChar(&s_HostServ), DT_CHARPTR | DT_NORELOAD, NoValidation},
{"hostserv", "description", "vHost Service", new ValueContainerChar(&desc_HostServ), DT_CHARPTR | DT_NORELOAD, ValidateHostServ},
{"hostserv", "database", "hosts.db", new ValueContainerChar(&HostDBName), DT_CHARPTR, ValidateHostServ},
- {"hostserv", "modules", "", new ValueContainerChar(&HostCoreModules), DT_CHARPTR, NoValidation},
+ {"hostserv", "modules", "", new ValueContainerString(&HostCoreModules), DT_STRING, NoValidation},
{"operserv", "nick", "OperServ", new ValueContainerChar(&s_OperServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"operserv", "description", "Operator Service", new ValueContainerChar(&desc_OperServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"operserv", "globalnick", "Global", new ValueContainerChar(&s_GlobalNoticer), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
@@ -941,7 +933,7 @@ int ServerConfig::Read(bool bail)
{"operserv", "database", "oper.db", new ValueContainerChar(&OperDBName), DT_CHARPTR, ValidateNotEmpty},
{"operserv", "newsdatabase", "news.db", new ValueContainerChar(&NewsDBName), DT_CHARPTR, ValidateNotEmpty},
{"operserv", "exceptiondatabase", "exception.db", new ValueContainerChar(&ExceptionDBName), DT_CHARPTR, ValidateNotEmpty},
- {"operserv", "modules", "", new ValueContainerChar(&OperCoreModules), DT_CHARPTR, NoValidation},
+ {"operserv", "modules", "", new ValueContainerString(&OperCoreModules), DT_STRING, NoValidation},
{"operserv", "superadmin", "no", new ValueContainerBool(&SuperAdmin), DT_BOOLEAN, NoValidation},
{"operserv", "logmaxusers", "no", new ValueContainerBool(&LogMaxUsers), DT_BOOLEAN, NoValidation},
{"operserv", "autokillexpiry", "0", new ValueContainerTime(&AutokillExpiry), DT_TIME, ValidateNotZero},
@@ -1909,26 +1901,14 @@ int read_config(int reload)
}
/* Modules Autoload building... :P */
- ModulesAutoload = buildStringList(Modules, &ModulesNumber);
- EncModuleList =
- buildStringList(EncModules ? EncModules : "", &EncModulesNumber);
- HostServCoreModules =
- buildStringList(HostCoreModules ? HostCoreModules : "", &HostServCoreNumber);
- MemoServCoreModules =
- buildStringList(MemoCoreModules ? MemoCoreModules : "", &MemoServCoreNumber);
-
- BotServCoreModules =
- buildStringList(BotCoreModules ? BotCoreModules : "", &BotServCoreNumber);
-
- OperServCoreModules =
- buildStringList(OperCoreModules ? OperCoreModules : "", &OperServCoreNumber);
-
- ChanServCoreModules =
- buildStringList(ChanCoreModules ? ChanCoreModules : "", &ChanServCoreNumber);
-
- NickServCoreModules =
- buildStringList(NickCoreModules ? NickCoreModules : "", &NickServCoreNumber);
-
+ ModulesAutoLoad = BuildStringList(!Modules.empty() ? Modules : "");
+ EncModuleList = BuildStringList(!EncModules.empty() ? EncModules : "");
+ HostServCoreModules = BuildStringList(!HostCoreModules.empty() ? HostCoreModules : "");
+ MemoServCoreModules = BuildStringList(!MemoCoreModules.empty() ? MemoCoreModules : "");
+ BotServCoreModules = BuildStringList(!BotCoreModules.empty() ? BotCoreModules : "");
+ OperServCoreModules = BuildStringList(!OperCoreModules.empty() ? OperCoreModules : "");
+ ChanServCoreModules = BuildStringList(!ChanCoreModules.empty() ? ChanCoreModules : "");
+ NickServCoreModules = BuildStringList(!NickCoreModules.empty() ? NickCoreModules : "");
if (LimitSessions) {
if (MaxSessionKill && !SessionAutoKillExpiry)
diff --git a/src/core/enc_md5.c b/src/core/enc_md5.c
index 103f4bbe7..d98792618 100644
--- a/src/core/enc_md5.c
+++ b/src/core/enc_md5.c
@@ -408,7 +408,7 @@ class EMD5 : public Module
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
- if (stricmp(EncModuleList[0], this->name.c_str()))
+ if (stricmp(EncModuleList.begin()->c_str(), this->name.c_str()))
{
enc_encrypt(plaintext, strlen(password), password, PASSMAX -1 );
}
diff --git a/src/core/enc_none.c b/src/core/enc_none.c
index 99b3e17a4..a5e60e1e2 100644
--- a/src/core/enc_none.c
+++ b/src/core/enc_none.c
@@ -63,7 +63,7 @@ class ENone : public Module
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
- if (stricmp(EncModuleList[0], this->name.c_str()))
+ if (stricmp(EncModuleList.begin()->c_str(), this->name.c_str()))
{
enc_encrypt(plaintext, strlen(password), password, PASSMAX -1 );
}
diff --git a/src/core/enc_old.c b/src/core/enc_old.c
index c3db6c4b3..d8f5dfdd5 100644
--- a/src/core/enc_old.c
+++ b/src/core/enc_old.c
@@ -409,7 +409,7 @@ class EOld : public Module
/* when we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
- if (stricmp(EncModuleList[0], this->name.c_str()))
+ if (stricmp(EncModuleList.begin()->c_str(), this->name.c_str()))
{
enc_encrypt(plaintext, strlen(password), password, PASSMAX -1 );
}
diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c
index 9c86875fe..87872241f 100644
--- a/src/core/enc_sha1.c
+++ b/src/core/enc_sha1.c
@@ -269,7 +269,7 @@ class ESHA1 : public Module
/* when we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
- if (stricmp(EncModuleList[0], this->name.c_str()))
+ if (stricmp(EncModuleList.begin()->c_str(), this->name.c_str()))
{
enc_encrypt(plaintext, strlen(password), password, PASSMAX -1 );
}
diff --git a/src/hostserv.c b/src/hostserv.c
index 243314f59..1ba5cf106 100644
--- a/src/hostserv.c
+++ b/src/hostserv.c
@@ -31,7 +31,7 @@ E void moduleAddHostServCmds();
void moduleAddHostServCmds()
{
- ModuleManager::LoadModuleList(HostServCoreNumber, HostServCoreModules);
+ ModuleManager::LoadModuleList(HostServCoreModules);
}
/*************************************************************************/
diff --git a/src/init.c b/src/init.c
index 50cb62eff..ec82532df 100644
--- a/src/init.c
+++ b/src/init.c
@@ -387,7 +387,7 @@ int init_primary(int ac, char **av)
}
/* Add Encryption Modules */
- ModuleManager::LoadModuleList(EncModulesNumber, EncModuleList);
+ ModuleManager::LoadModuleList(EncModuleList);
return 0;
}
@@ -493,7 +493,7 @@ int init_secondary(int ac, char **av)
/* load any custom modules */
if (!nothird)
- ModuleManager::LoadModuleList(ModulesNumber, ModulesAutoload);
+ ModuleManager::LoadModuleList(ModulesAutoLoad);
/* Initialize random number generator */
rand_init();
diff --git a/src/memoserv.c b/src/memoserv.c
index 64e7d831f..6358ad6ef 100644
--- a/src/memoserv.c
+++ b/src/memoserv.c
@@ -25,7 +25,7 @@ E void rsend_notify(User *u, Memo *m, const char *chan);
/*************************************************************************/
void moduleAddMemoServCmds() {
- ModuleManager::LoadModuleList(MemoServCoreNumber, MemoServCoreModules);
+ ModuleManager::LoadModuleList(MemoServCoreModules);
}
/*************************************************************************/
diff --git a/src/messages.c b/src/messages.c
index dc9a86d1b..9977de75e 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -277,7 +277,7 @@ int m_stats(const char *source, int ac, const char **av)
int m_version(const char *source, int ac, const char **av)
{
if (source) ircdproto->SendNumeric(ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags,
- EncModuleList[0], version_build);
+ EncModuleList.begin()->c_str(), version_build);
return MOD_CONT;
}
diff --git a/src/misc.c b/src/misc.c
index a84fc33d4..c0ab1954c 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1031,6 +1031,36 @@ char *host_resolve(char *host)
/*************************************************************************/
+/** Build a string list from a source string
+ * @param src The source string
+ * @return a list of strings
+ */
+std::list<std::string> BuildStringList(const std::string &src)
+{
+ spacesepstream tokens(src);
+ std::string token;
+ std::list<std::string> Ret;
+
+ while (tokens.GetToken(token))
+ Ret.push_back(token);
+
+ return Ret;
+}
+
+std::list<ci::string> BuildStringList(const ci::string &src)
+{
+ spacesepstream tokens(src);
+ ci::string token;
+ std::list<ci::string> Ret;
+
+ while (tokens.GetToken(token))
+ Ret.push_back(token);
+
+ return Ret;
+}
+
+/*************************************************************************/
+
/**
* Change an unsigned string to a signed string, overwriting the original
* string.
@@ -1074,27 +1104,6 @@ void ntoa(struct in_addr addr, char *ipaddr, int len)
bytes[3]);
}
-/**
- * Build a string list from a given source string.
- * This is usually used for parsing out values from the config file, but could
- * be used for other things.
- **/
-char **buildStringList(const std::string &src, int *number)
-{
- int i = 0;
- char **list = NULL;
- spacesepstream tokens(src);
- std::string token;
-
- while (tokens.GetToken(token)) {
- i++;
- list = static_cast<char **>(realloc(list, sizeof(char *) * i));
- list[i - 1] = sstrdup(token.c_str());
- }
- *number = i; /* always zero it, even if we have no setters */
- return list;
-}
-
/*
* strlcat and strlcpy were ripped from openssh 2.5.1p2
* They had the following Copyright info:
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 3058f216f..c474abaec 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -15,16 +15,13 @@
std::vector<Module *> ModuleManager::EventHandlers[I_END];
-void ModuleManager::LoadModuleList(int total_modules, char **module_list)
+void ModuleManager::LoadModuleList(std::list<std::string> &ModuleList)
{
- int idx;
- Module *m;
- int status = 0;
- for (idx = 0; idx < total_modules; idx++) {
- m = findModule(module_list[idx]);
- if (!m) {
- status = ModuleManager::LoadModule(module_list[idx], NULL);
- }
+ for (std::list<std::string>::iterator it = ModuleList.begin(); it != ModuleList.end(); ++it)
+ {
+ Module *m = findModule(it->c_str());
+ if (!m)
+ ModuleManager::LoadModule(*it, NULL);
}
}
diff --git a/src/nickserv.c b/src/nickserv.c
index a6489bbc3..39fe54706 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -154,7 +154,7 @@ class NickServRelease : public Timer
/* *INDENT-OFF* */
void moduleAddNickServCmds()
{
- ModuleManager::LoadModuleList(NickServCoreNumber, NickServCoreModules);
+ ModuleManager::LoadModuleList(NickServCoreModules);
}
/* *INDENT-ON* */
/*************************************************************************/
diff --git a/src/operserv.c b/src/operserv.c
index 65cf50930..3848e960f 100644
--- a/src/operserv.c
+++ b/src/operserv.c
@@ -57,7 +57,7 @@ SListOpts szopts = { 0, NULL, &is_szline_entry_equal, &free_szline_entry };
/*************************************************************************/
/* *INDENT-OFF* */
void moduleAddOperServCmds() {
- ModuleManager::LoadModuleList(OperServCoreNumber, OperServCoreModules);
+ ModuleManager::LoadModuleList(OperServCoreModules);
}
/* *INDENT-ON* */
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index 42c51712b..ff71d233d 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -346,7 +346,7 @@ class InspIRCdProto : public IRCDProto
me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL);
SendServer(me_server);
send_cmd(NULL, "BURST");
- send_cmd(ServerName, "VERSION :Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, EncModuleList[0], version_build);
+ send_cmd(ServerName, "VERSION :Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, EncModuleList.begin()->c_str(), version_build);
}
/* CHGIDENT */
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index a8e76dd39..fb6d5db2a 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -356,7 +356,7 @@ class InspIRCdProto : public IRCDProto
me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, TS6SID);
SendServer(me_server);
send_cmd(TS6SID, "BURST");
- send_cmd(TS6SID, "VERSION :Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, EncModuleList[0], version_build);
+ send_cmd(TS6SID, "VERSION :Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, EncModuleList.begin()->c_str(), version_build);
}
/* CHGIDENT */