]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix expanding module names.
authorSadie Powell <sadie@witchery.services>
Fri, 27 Mar 2020 14:25:09 +0000 (14:25 +0000)
committerSadie Powell <sadie@witchery.services>
Fri, 27 Mar 2020 14:25:09 +0000 (14:25 +0000)
src/modules.cpp

index 73bd2a5e2dd6988476dc8e1b2e0833afdff9fcc7..2b83bc0d892d9bae26192d5ff1f693aeafd1fe0a 100644 (file)
@@ -622,12 +622,13 @@ ServiceProvider* ModuleManager::FindService(ServiceType type, const std::string&
 
 std::string ModuleManager::ExpandModName(const std::string& modname)
 {
-       // Transform "callerid" -> "m_callerid.so" unless it already has a ".so" extension,
-       // so coremods in the "core_*.so" form aren't changed
-       std::string ret = modname;
-       if ((modname.length() < 3) || (modname.compare(modname.size() - 3, 3, ".so")))
-               ret.insert(0, "m_").append(".so");
-       return ret;
+       std::string fullname;
+       if (modname.compare(0, 5, "core_") != 0 && modname.compare(0, 2, "m_") != 0)
+               fullname.append("m_");
+       fullname.append(modname);
+       if (modname.length() < 3 || modname.compare(modname.size() - 3, 3, ".so") != 0)
+               fullname.append(".so");
+       return fullname;
 }
 
 dynamic_reference_base::dynamic_reference_base(Module* Creator, const std::string& Name)