summaryrefslogtreecommitdiff
path: root/src/modulemanager.cpp
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-09-27 21:20:56 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-09-27 21:20:56 +0000
commitf572827157397e493e5499f115b15d0de992480a (patch)
tree8fb49c5ed90d01458a138d0ce582493c94e56219 /src/modulemanager.cpp
parent9d87b0f9235458169b513904ce4e220da4e29d73 (diff)
Removed old mod_version system for detecting module versions and replaced with the Module::GetVersion() function
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2521 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/modulemanager.cpp')
-rw-r--r--src/modulemanager.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 887820ead..efbb6db83 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -216,6 +216,33 @@ int ModuleManager::LoadModule(const std::string &modname, User * u)
m->filename = pbuf;
m->handle = handle;
+ Version v = m->GetVersion();
+ if (v.GetMajor() < VERSION_MAJOR || (v.GetMajor() == VERSION_MAJOR && v.GetMinor() < VERSION_MINOR))
+ {
+ alog("Module %s is compiled against an older version of Anope %d.%d, this is %d.%d", modname.c_str(), v.GetMajor(), v.GetMinor(), VERSION_MAJOR, VERSION_MINOR);
+ DeleteModule(m);
+ return MOD_STOP;
+ }
+ else if (v.GetMajor() > VERSION_MAJOR || (v.GetMajor() == VERSION_MAJOR && v.GetMinor() > VERSION_MINOR))
+ {
+ alog("Module %s is compiled against a newer version of Anope %d.%d, this is %d.%d", modname.c_str(), v.GetMajor(), v.GetMinor(), VERSION_MAJOR, VERSION_MINOR);
+ DeleteModule(m);
+ return MOD_STOP;
+ }
+ else if (v.GetBuild() < VERSION_BUILD)
+ {
+ alog("Module %s is compiled against an older revision of Anope %d, this is %d", modname.c_str(), v.GetBuild(), VERSION_BUILD);
+ }
+ else if (v.GetBuild() > VERSION_BUILD)
+ {
+ alog("Module %s is compiled against a newer revision of Anope %d, this is %d", modname.c_str(), v.GetBuild(), VERSION_BUILD);
+ }
+ else if (v.GetBuild() == VERSION_BUILD)
+ {
+ alog("Module %s compiled against current version of Anope %d", modname.c_str(), v.GetBuild());
+ }
+
+
if (m->type == PROTOCOL && IsOneOfModuleTypeLoaded(PROTOCOL))
{
DeleteModule(m);