mirror of
https://github.com/anope/anope.git
synced 2026-07-10 01:23:14 +02:00
Modules now delete themselves instead of letting the core do it (just incase one of them has used a custom delete operator)
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1729 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+8
-3
@@ -259,7 +259,7 @@ CoreExport class Module
|
||||
* @return returns MOD_ERR_OK on success
|
||||
*/
|
||||
int DelCommand(CommandHash * cmdTable[], const char *name);
|
||||
|
||||
|
||||
/**
|
||||
* Adds a timed callback for the current module.
|
||||
* This allows modules to request that anope executes one of there functions at a time in the future, without an event to trigger it
|
||||
@@ -272,7 +272,7 @@ CoreExport class Module
|
||||
* @see moduleDelCallBack
|
||||
**/
|
||||
int AddCallback(const char *name, time_t when, int (*func) (int argc, char *argv[]), int argc, char **argv);
|
||||
|
||||
|
||||
/**
|
||||
* Allow modules to delete a timed callback by name.
|
||||
* @param name the name of the callback they wish to delete
|
||||
@@ -307,10 +307,15 @@ CoreExport class ModuleManager
|
||||
* @return MOD_ERR_OK on success, anything else on fail
|
||||
*/
|
||||
static int UnloadModule(Module *m, User * u);
|
||||
|
||||
|
||||
/** Run all pending module timer callbacks.
|
||||
*/
|
||||
static void RunCallbacks();
|
||||
private:
|
||||
/** Call the module_delete function to safely delete the module
|
||||
* @param m the module to delete
|
||||
*/
|
||||
static void DeleteModule(Module *m);
|
||||
};
|
||||
|
||||
|
||||
|
||||
+9
-1
@@ -202,16 +202,24 @@ extern int strncasecmp(const char *, const char *, size_t);
|
||||
break; \
|
||||
} \
|
||||
return TRUE; \
|
||||
} \
|
||||
extern "C" DllExport void *destroy_module(y *m) \
|
||||
{ \
|
||||
delete m; \
|
||||
}
|
||||
|
||||
#else
|
||||
#define MODULE_INIT(x, y) \
|
||||
extern "C" DllExport Module *init_module(const std::string &modname, const std::string &creator) \
|
||||
{ \
|
||||
return new y(x, creator); \
|
||||
} \
|
||||
extern "C" DllExport void destroy_module(y *m) \
|
||||
{ \
|
||||
delete m; \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Miscellaneous definitions. */
|
||||
#include "defs.h"
|
||||
#include "slist.h"
|
||||
|
||||
Reference in New Issue
Block a user