summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-10-18 04:00:04 +0100
committerPeter Powell <petpow@saberuk.com>2017-10-18 04:08:07 +0100
commit3b927b48ccb30619d9ace318b5a7d21f2279abbf (patch)
treea147034f6dd8fbcd5fe3deb34331a9d268c7cce1 /src
parentaac644de3da4fe76dc912f6c8ef451c2dc75509c (diff)
Ignore <module> tags for modules that are already loaded.
This allows us to do user friendly things like loading the alias module in the example alias files.
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp4
-rw-r--r--src/modules.cpp10
2 files changed, 11 insertions, 3 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index be3707a16..6471413e0 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -726,6 +726,10 @@ void ServerConfig::ApplyModules(User* user)
for (std::vector<std::string>::iterator adding = added_modules.begin(); adding != added_modules.end(); adding++)
{
+ // Skip modules which are already loaded.
+ if (ServerInstance->Modules->Find(*adding))
+ continue;
+
if (ServerInstance->Modules->Load(*adding))
{
ServerInstance->SNO->WriteGlobalSno('a', "*** REHASH LOADED MODULE: %s",adding->c_str());
diff --git a/src/modules.cpp b/src/modules.cpp
index 5c5e5c5c0..6d0d3bf94 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -468,10 +468,14 @@ void ModuleManager::LoadAll()
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- std::string name = tag->getString("name");
- this->NewServices = &servicemap[ExpandModName(name)];
- std::cout << "[" << con_green << "*" << con_reset << "] Loading module:\t" << con_green << name << con_reset << std::endl;
+ std::string name = ExpandModName(tag->getString("name"));
+ this->NewServices = &servicemap[name];
+
+ // Skip modules which are already loaded.
+ if (Modules.find(name) != Modules.end())
+ continue;
+ std::cout << "[" << con_green << "*" << con_reset << "] Loading module:\t" << con_green << name << con_reset << std::endl;
if (!this->Load(name, true))
{
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError());