]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Merge pull request #244 from SaberUK/insp20-configure-fix
[user/henk/code/inspircd.git] / include / modules.h
index 102ed180bf3da76ef3f28d2e1e59f67b93ded59f..b428a5f8d3b14720c8507da74ed7ec01dd242ed0 100644 (file)
@@ -1,18 +1,30 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2006-2007, 2009 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2003-2008 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2006-2007 Oliver Lupton <oliverlupton@gmail.com>
+ *   Copyright (C) 2003 randomdan <???@???>
  *
- * This program is free but copyrighted software; see
- *         the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __MODULES_H
-#define __MODULES_H
+
+#ifndef MODULES_H
+#define MODULES_H
 
 #include "dynamic.h"
 #include "base.h"
@@ -94,10 +106,17 @@ struct ModResult {
        }
 };
 
-/** If you change the module API in any way, increment this value.
- * This MUST be a pure integer, with no parenthesis
+/** InspIRCd major version.
+ * 1.2 -> 102; 2.1 -> 201; 2.12 -> 212
+ */
+#define INSPIRCD_VERSION_MAJ 200
+/** InspIRCd API version.
+ * If you change any API elements, increment this value. This counter should be
+ * reset whenever the major version is changed. Modules can use these two values
+ * and numerical comparisons in preprocessor macros if they wish to support
+ * multiple versions of InspIRCd in one file.
  */
-#define API_VERSION 141
+#define INSPIRCD_VERSION_API 1
 
 /**
  * This #define allows us to call a method in all
@@ -169,12 +188,8 @@ do { \
 /** Holds a module's Version information.
  * The members (set by the constructor only) indicate details as to the version number
  * of a module. A class of type Version is returned by the GetVersion method of the Module class.
- *
- * The core provides only one implementation of the template, causing a run-time linking
- * error when attempting to load a module compiled against a different API_VERSION.
  */
-template<int api>
-class CoreExport VersionBase
+class CoreExport Version
 {
  public:
        /** Module description
@@ -189,19 +204,14 @@ class CoreExport VersionBase
        const std::string link_data;
 
        /** Simple module version */
-       VersionBase(const std::string &desc, int flags = VF_NONE);
+       Version(const std::string &desc, int flags = VF_NONE);
 
        /** Complex version information, including linking compatability data */
-       VersionBase(const std::string &desc, int flags, const std::string& linkdata);
-
-       virtual ~VersionBase() {}
+       Version(const std::string &desc, int flags, const std::string& linkdata);
 
-       /** Return true if the module can link (default is identity comparison) */
-       virtual bool CanLink(const std::string& other_data);
+       virtual ~Version() {}
 };
 
-typedef VersionBase<API_VERSION> Version;
-
 /** The Request class is a unicast message directed at a given module.
  * When this class is properly instantiated it may be sent to a module
  * using the Send() method, which will call the given module's OnRequest
@@ -1646,9 +1656,9 @@ class CoreExport ModuleManager
 #define MODULE_INIT_STR MODULE_INIT_STR_FN_2(MODULE_INIT_SYM)
 #define MODULE_INIT_STR_FN_2(x) MODULE_INIT_STR_FN_1(x)
 #define MODULE_INIT_STR_FN_1(x) #x
-#define MODULE_INIT_SYM MODULE_INIT_SYM_FN_2(API_VERSION)
-#define MODULE_INIT_SYM_FN_2(x) MODULE_INIT_SYM_FN_1(x)
-#define MODULE_INIT_SYM_FN_1(x) inspircd_module_ ## x
+#define MODULE_INIT_SYM MODULE_INIT_SYM_FN_2(INSPIRCD_VERSION_MAJ, INSPIRCD_VERSION_API)
+#define MODULE_INIT_SYM_FN_2(x,y) MODULE_INIT_SYM_FN_1(x,y)
+#define MODULE_INIT_SYM_FN_1(x,y) inspircd_module_ ## x ## _ ## y
 
 #ifdef PURE_STATIC