summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_modules.cpp8
-rw-r--r--src/dynamic.cpp13
-rw-r--r--src/modmanager_dynamic.cpp4
-rw-r--r--src/modules.cpp10
-rw-r--r--src/modules/m_httpd_stats.cpp2
5 files changed, 30 insertions, 7 deletions
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 27f8246ca..eb93d2927 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -58,8 +58,14 @@ CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
if (!(V.Flags & mult))
flags[pos] = '-';
+#ifdef PURE_STATIC
+ user->SendText(":%s 702 %s :%p %s %s :%s", ServerInstance->Config->ServerName.c_str(),
+ user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str());
+#else
+ std::string srcrev = m->ModuleDLLManager->GetVersion();
user->SendText(":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName.c_str(),
- user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), V.version.c_str());
+ user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), srcrev.c_str());
+#endif
}
else
{
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index 719046dbe..ebaaa5191 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -45,7 +45,7 @@ union init_t {
Module* (*fptr)();
};
-Module* DLLManager::callInit()
+Module* DLLManager::CallInit()
{
if (!h)
return NULL;
@@ -60,3 +60,14 @@ Module* DLLManager::callInit()
return (*initfn.fptr)();
}
+
+std::string DLLManager::GetVersion()
+{
+ if (!h)
+ return "";
+
+ const char* srcver = (char*)dlsym(h, "inspircd_src_version");
+ if (srcver)
+ return srcver;
+ return "Unversioned module";
+}
diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp
index f6b4617a0..2f686ec96 100644
--- a/src/modmanager_dynamic.cpp
+++ b/src/modmanager_dynamic.cpp
@@ -82,7 +82,7 @@ bool ModuleManager::Load(const char* filename)
try
{
- newmod = newhandle->callInit();
+ newmod = newhandle->CallInit();
if (newmod)
{
@@ -91,7 +91,7 @@ bool ModuleManager::Load(const char* filename)
Version v = newmod->GetVersion();
ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)%s",
- filename, v.version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
+ filename, newhandle->GetVersion().c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
Modules[filename_str] = newmod;
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 46582fc79..f460a6a28 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -26,11 +26,17 @@
// Version is a simple class for holding a modules version number
template<>
-VersionBase<API_VERSION>::VersionBase(const std::string &modv, int flags, const std::string& rev)
-: description(modv), version(rev), Flags(flags)
+VersionBase<API_VERSION>::VersionBase(const std::string &modv, int flags)
+: description(modv), Flags(flags)
{
}
+template<>
+bool VersionBase<API_VERSION>::CanLink(const std::string& other_data)
+{
+ return link_data == other_data;
+}
+
Request::Request(Module* src, Module* dst, const char* idstr)
: id(idstr), source(src), dest(dst)
{
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 23dee0c08..00c6a5d7f 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -135,7 +135,7 @@ class ModuleHttpStats : public Module
{
Module* m = ServerInstance->Modules->Find(i->c_str());
Version v = m->GetVersion();
- data << "<module><name>" << *i << "</name><version>" << v.version << "</version><description>" << Sanitize(v.description) << "</description></module>";
+ data << "<module><name>" << *i << "</name><description>" << Sanitize(v.description) << "</description></module>";
}
data << "</modulelist><channellist>";