diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-05 20:20:28 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-05 20:20:28 +0000 |
commit | 88f9975f4071843846ef94d5ad6799e7471a8036 (patch) | |
tree | 2cb619c22d1f979576f5e95b2733b2fd01b7892d /src | |
parent | 2ce8f4aea232aac67474cb276918cb41719cf81b (diff) |
Convert src/modules to use the new modules loader.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1559 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/bs_fantasy_unban.c | 39 | ||||
-rw-r--r-- | src/modules/cs_appendtopic.c | 75 | ||||
-rw-r--r-- | src/modules/cs_enforce.c | 37 | ||||
-rw-r--r-- | src/modules/cs_tban.c | 37 | ||||
-rw-r--r-- | src/modules/hs_request.c | 99 | ||||
-rw-r--r-- | src/modules/ns_maxemail.c | 57 | ||||
-rw-r--r-- | src/modules/ns_noop_convert.c | 49 | ||||
-rw-r--r-- | src/modules/os_ignore_db.c | 90 | ||||
-rw-r--r-- | src/modules/os_info.c | 98 |
9 files changed, 253 insertions, 328 deletions
diff --git a/src/modules/bs_fantasy_unban.c b/src/modules/bs_fantasy_unban.c index 95307c92d..bdedb30a1 100644 --- a/src/modules/bs_fantasy_unban.c +++ b/src/modules/bs_fantasy_unban.c @@ -17,34 +17,21 @@ int do_fantasy(int argc, char **argv); -/** - * Create the hook, and tell anope about it. - * @param argc Argument count - * @param argv Argument list - * @return MOD_CONT to allow the module, MOD_STOP to stop it - **/ -int AnopeInit(int argc, char **argv) +class BSFantasyUnban : public Module { - EvtHook *hook; + public: + BSFantasyUnban(const std::string &creator) : Module(creator) + { + EvtHook *hook; - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - hook = createEventHook(EVENT_BOT_FANTASY, do_fantasy); - moduleAddEventHook(hook); - - return MOD_CONT; -} - -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + hook = createEventHook(EVENT_BOT_FANTASY, do_fantasy); + moduleAddEventHook(hook); + } +}; /** * Handle unban fantasy command. @@ -81,4 +68,4 @@ int do_fantasy(int argc, char **argv) return MOD_CONT; } -MODULE_INIT("bs_fantasy_unban") +MODULE_INIT(BSFantasyUnban) diff --git a/src/modules/cs_appendtopic.c b/src/modules/cs_appendtopic.c index 16b565dd6..2006fcf63 100644 --- a/src/modules/cs_appendtopic.c +++ b/src/modules/cs_appendtopic.c @@ -21,22 +21,22 @@ #define AUTHOR "SGR" #define VERSION "$Id$" - /* ------------------------------------------------------------ - * Name: cs_appendtopic - * Author: SGR <Alex_SGR@ntlworld.com> - * Date: 31/08/2003 - * ------------------------------------------------------------ - * - * This module has no configurable options. For information on - * this module, load it and refer to /ChanServ APPENDTOPIC HELP - * - * Thanks to dengel, Rob and Certus for all there support. - * Especially Rob, who always manages to show me where I have - * not allocated any memory. Even if it takes a few weeks of - * pestering to get him to look at it. - * - * ------------------------------------------------------------ - */ +/* ------------------------------------------------------------ + * Name: cs_appendtopic + * Author: SGR <Alex_SGR@ntlworld.com> + * Date: 31/08/2003 + * ------------------------------------------------------------ + * + * This module has no configurable options. For information on + * this module, load it and refer to /ChanServ APPENDTOPIC HELP + * + * Thanks to dengel, Rob and Certus for all there support. + * Especially Rob, who always manages to show me where I have + * not allocated any memory. Even if it takes a few weeks of + * pestering to get him to look at it. + * + * ------------------------------------------------------------ + */ /* ---------------------------------------------------------------------- */ /* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */ @@ -53,36 +53,25 @@ void my_cs_help(User * u); int my_cs_help_appendtopic(User * u); void my_add_languages(void); -int AnopeInit(int argc, char **argv) +class CSAppendTopic : public Module { - Command *c; - int status; - - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); - - c = createCommand("APPENDTOPIC", my_cs_appendtopic, NULL, -1, -1, -1, - -1, -1); - if ((status = moduleAddCommand(CHANSERV, c, MOD_HEAD))) { - alog("[cs_appendtopic] Unable to create APPENDTOPIC command: %d", - status); - return MOD_STOP; - } - moduleAddHelp(c, my_cs_help_appendtopic); - moduleSetChanHelp(my_cs_help); + public: + CSAppendTopic(const std::string &creator) : Module(creator) + { + Command *c; - my_add_languages(); + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); - alog("[cs_appendtopic] Loaded successfully"); + c = createCommand("APPENDTOPIC", my_cs_appendtopic, NULL, -1, -1, -1, -1, -1); + moduleAddCommand(CHANSERV, c, MOD_HEAD); + moduleAddHelp(c, my_cs_help_appendtopic); + moduleSetChanHelp(my_cs_help); - return MOD_CONT; -} - -void AnopeFini(void) -{ - alog("[cs_appendtopic] Unloaded successfully"); -} + my_add_languages(); + } +}; void my_cs_help(User * u) { @@ -246,4 +235,4 @@ void my_add_languages(void) /* EOF */ -MODULE_INIT("cs_appendtopic") +MODULE_INIT(CSAppendTopic) diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c index 2073ec583..1c85708d5 100644 --- a/src/modules/cs_enforce.c +++ b/src/modules/cs_enforce.c @@ -32,33 +32,28 @@ void my_add_languages(void); #define LNG_CHAN_HELP_ENFORCE_R_DISABLED 4 #define LNG_CHAN_RESPONSE 5 -int AnopeInit(int argc, char **argv) +class CSEnforce : public Module { - Command *c; - int status; + public: + CSEnforce(const std::string &creator) : Module(creator) + { + Command *c; - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); - c = createCommand("ENFORCE", my_cs_enforce, NULL, -1, -1, -1, -1, -1); - if ((status = moduleAddCommand(CHANSERV, c, MOD_HEAD))) { - alog("[cs_enforce] Unable to create ENFORCE command: %d", status); - return MOD_STOP; - } + c = createCommand("ENFORCE", my_cs_enforce, NULL, -1, -1, -1, -1, -1); + moduleAddCommand(CHANSERV, c, MOD_HEAD); - moduleAddHelp(c, my_cs_help_enforce); - moduleSetChanHelp(my_cs_help); + moduleAddHelp(c, my_cs_help_enforce); + moduleSetChanHelp(my_cs_help); - my_add_languages(); + my_add_languages(); + } +}; - return MOD_CONT; -} -void AnopeFini(void) -{ - /* Nothing to clean up */ -} /* Enforcing functions */ void do_enforce_secureops(Channel * c) @@ -478,4 +473,4 @@ void my_add_languages(void) /* EOF */ -MODULE_INIT("cs_enforce") +MODULE_INIT(CSEnforce) diff --git a/src/modules/cs_tban.c b/src/modules/cs_tban.c index 01f543b08..570ed4d37 100644 --- a/src/modules/cs_tban.c +++ b/src/modules/cs_tban.c @@ -39,32 +39,27 @@ void mAddLanguages(void); #define TBAN_HELP_DETAIL 2 #define TBAN_RESPONSE 3 -int AnopeInit(int argc, char **argv) +class CSTBan : public Module { - Command *c; - int status = 0; + public: + CSTBan(const std::string &creator) : Module(creator) + { + Command *c; - moduleSetChanHelp(myHelp); - c = createCommand("TBAN", do_tban, NULL, -1, -1, -1, -1, -1); - moduleAddHelp(c, myFullHelp); - status = moduleAddCommand(CHANSERV, c, MOD_HEAD); + moduleSetChanHelp(myHelp); + c = createCommand("TBAN", do_tban, NULL, -1, -1, -1, -1, -1); + moduleAddHelp(c, myFullHelp); + moduleAddCommand(CHANSERV, c, MOD_HEAD); - mAddLanguages(); + mAddLanguages(); - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); + } +}; - if (status != MOD_ERR_OK) { - return MOD_STOP; - } - return MOD_CONT; -} -void AnopeFini(void) -{ - /* module is unloading */ -} void myHelp(User * u) { @@ -249,4 +244,4 @@ void mAddLanguages(void) /* EOF */ -MODULE_INIT("cs_tban") +MODULE_INIT(CSTBan) diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c index b80e51a55..2cf9753ea 100644 --- a/src/modules/hs_request.c +++ b/src/modules/hs_request.c @@ -83,73 +83,66 @@ void my_add_languages(void); HostCore *hs_request_head; -int AnopeInit(int argc, char **argv) +class HSRequest : public Module { - Command *c; - EvtHook *hook; + public: + HSRequest(const std::string &creator) : Module(creator) + { + Command *c; + EvtHook *hook; - c = createCommand("request", hs_do_request, nick_identified, -1, -1, - -1, -1, -1); - moduleAddHelp(c, hs_help_request); - moduleAddCommand(HOSTSERV, c, MOD_HEAD); + c = createCommand("request", hs_do_request, nick_identified, -1, -1, -1, -1, -1); + moduleAddHelp(c, hs_help_request); + moduleAddCommand(HOSTSERV, c, MOD_HEAD); - c = createCommand("activate", hs_do_activate, is_host_setter, -1, -1, - -1, -1, -1); - moduleAddHelp(c, hs_help_activate); - moduleAddCommand(HOSTSERV, c, MOD_HEAD); + c = createCommand("activate", hs_do_activate, is_host_setter, -1, -1, -1, -1, -1); + moduleAddHelp(c, hs_help_activate); + moduleAddCommand(HOSTSERV, c, MOD_HEAD); - c = createCommand("reject", hs_do_reject, is_host_setter, -1, -1, -1, - -1, -1); - moduleAddHelp(c, hs_help_reject); - moduleAddCommand(HOSTSERV, c, MOD_HEAD); + c = createCommand("reject", hs_do_reject, is_host_setter, -1, -1, -1, -1, -1); + moduleAddHelp(c, hs_help_reject); + moduleAddCommand(HOSTSERV, c, MOD_HEAD); - c = createCommand("waiting", hs_do_waiting, is_host_setter, -1, -1, -1, - -1, -1); - moduleAddHelp(c, hs_help_waiting); - moduleAddCommand(HOSTSERV, c, MOD_HEAD); + c = createCommand("waiting", hs_do_waiting, is_host_setter, -1, -1, -1, -1, -1); + moduleAddHelp(c, hs_help_waiting); + moduleAddCommand(HOSTSERV, c, MOD_HEAD); - c = createCommand("list", hs_do_list_out, is_services_oper, -1, -1, -1, - -1, -1); - moduleAddCommand(HOSTSERV, c, MOD_HEAD); + c = createCommand("list", hs_do_list_out, is_services_oper, -1, -1, -1, -1, -1); + moduleAddCommand(HOSTSERV, c, MOD_HEAD); - c = createCommand("drop", ns_do_drop, NULL, -1, -1, -1, -1, -1); - moduleAddCommand(NICKSERV, c, MOD_HEAD); + c = createCommand("drop", ns_do_drop, NULL, -1, -1, -1, -1, -1); + moduleAddCommand(NICKSERV, c, MOD_HEAD); - hook = createEventHook(EVENT_DB_SAVING, hsreqevt_db_saving); - moduleAddEventHook(hook); + hook = createEventHook(EVENT_DB_SAVING, hsreqevt_db_saving); + moduleAddEventHook(hook); - hook = createEventHook(EVENT_DB_BACKUP, hsreqevt_db_backup); - moduleAddEventHook(hook); + hook = createEventHook(EVENT_DB_BACKUP, hsreqevt_db_backup); + moduleAddEventHook(hook); - moduleSetHostHelp(hs_help); - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); + moduleSetHostHelp(hs_help); + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); - my_load_config(); - my_add_languages(); - hs_request_head = NULL; + my_load_config(); + my_add_languages(); + hs_request_head = NULL; - if (debug) - alog("[hs_request] Loading database..."); - hsreq_load_db(); - alog("hs_request loaded"); - return MOD_CONT; -} + hsreq_load_db(); + } -void AnopeFini(void) -{ - if (debug) - alog("[hs_request] Saving database..."); - hsreq_save_db(); + ~HSRequest() + { + hsreq_save_db(); - /* Clean up all open host requests */ - while (hs_request_head) - hs_request_head = deleteHostCore(hs_request_head, NULL); + /* Clean up all open host requests */ + while (hs_request_head) + hs_request_head = deleteHostCore(hs_request_head, NULL); + + free(HSRequestDBName); + } +}; - free(HSRequestDBName); - alog("hs_request un-loaded"); -} int hs_do_request(User * u) { @@ -986,4 +979,4 @@ void my_add_languages(void) /* EOF */ -MODULE_INIT("hs_request") +MODULE_INIT(HSRequest) diff --git a/src/modules/ns_maxemail.c b/src/modules/ns_maxemail.c index 593456b33..a4caa83bd 100644 --- a/src/modules/ns_maxemail.c +++ b/src/modules/ns_maxemail.c @@ -30,46 +30,33 @@ int NSEmailMax = 0; #define LNG_NSEMAILMAX_REACHED 0 #define LNG_NSEMAILMAX_REACHED_ONE 1 -int AnopeInit(int argc, char **argv) +class NSMaxEmail : public Module { - Command *c; - EvtHook *evt; - int status; - - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); - - c = createCommand("REGISTER", my_ns_register, NULL, -1, -1, -1, -1, - -1); - if ((status = moduleAddCommand(NICKSERV, c, MOD_HEAD))) { - alog("[ns_maxemail] Unable to create REGISTER command: %d", - status); - return MOD_STOP; - } + public: + NSMaxEmail(const std::string &creator) : Module(creator) + { + Command *c; + EvtHook *evt; + int status; - c = createCommand("SET", my_ns_set, NULL, -1, -1, -1, -1, -1); - if ((status = moduleAddCommand(NICKSERV, c, MOD_HEAD))) { - alog("[ns_maxemail] Unable to create SET command: %d", status); - return MOD_STOP; - } + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); - evt = createEventHook(EVENT_RELOAD, my_event_reload); - if ((status = moduleAddEventHook(evt))) { - alog("[ns_maxemail] Unable to hook to EVENT_RELOAD: %d", status); - return MOD_STOP; - } + c = createCommand("REGISTER", my_ns_register, NULL, -1, -1, -1, -1, -1); + moduleAddCommand(NICKSERV, c, MOD_HEAD); + c = createCommand("SET", my_ns_set, NULL, -1, -1, -1, -1, -1); + moduleAddCommand(NICKSERV, c, MOD_HEAD); - my_load_config(); - my_add_languages(); + evt = createEventHook(EVENT_RELOAD, my_event_reload); + if ((status = moduleAddEventHook(evt))) + throw ModuleException("ns_maxemail: Unable to hook to EVENT_RELOAD"); - return MOD_CONT; -} + my_load_config(); + my_add_languages(); + } +}; -void AnopeFini(void) -{ - /* Nothing to do while unloading */ -} int count_email_in_use(char *email, User * u) { @@ -227,4 +214,4 @@ void my_add_languages(void) /* EOF */ -MODULE_INIT("ns_maxemail") +MODULE_INIT(NSMaxEmail) diff --git a/src/modules/ns_noop_convert.c b/src/modules/ns_noop_convert.c index 81e3d50d5..c37879259 100644 --- a/src/modules/ns_noop_convert.c +++ b/src/modules/ns_noop_convert.c @@ -59,39 +59,32 @@ void m_AddLanguages(void); /*************************************************************************/ -/** - * AnopeInit is called when the module is loaded - * @param argc Argument count - * @param argv Argument list - * @return MOD_CONT to allow the module, MOD_STOP to stop it - **/ -int AnopeInit(int argc, char **argv) +class NSNOOPConvert : public Module { - NSAutoOPDBName = NULL; + public: + NSNOOPConvert(const std::string &creator) : Module(creator) + { + NSAutoOPDBName = NULL; - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); - if (mLoadConfig(0, NULL)) - return MOD_STOP; + if (mLoadConfig(0, NULL)) + throw ModuleException("Couldn't load config?"); - mLoadData(); - - alog("ns_noop_convert: Your auto-op database has been converted and this module will now"); - alog("ns_noop_convert: unload itself. You can now remove this module from your config"); + mLoadData(); - return MOD_STOP; -} + alog("ns_noop_convert: Your auto-op database has been converted and this module will now"); + alog("ns_noop_convert: unload itself. You can now remove this module from your config"); + } -/** - * Unload the module - **/ -void AnopeFini(void) -{ - if (NSAutoOPDBName) - free(NSAutoOPDBName); -} + ~NSNOOPConvert() + { + if (NSAutoOPDBName) + free(NSAutoOPDBName); + } +}; /*************************************************************************/ @@ -172,4 +165,4 @@ int mLoadConfig(int argc, char **argv) /* EOF */ -MODULE_INIT("ns_noop_convert") +MODULE_INIT(NSNOOPConvert) diff --git a/src/modules/os_ignore_db.c b/src/modules/os_ignore_db.c index af992b12c..2983c4929 100644 --- a/src/modules/os_ignore_db.c +++ b/src/modules/os_ignore_db.c @@ -76,55 +76,47 @@ int reload_config(int argc, char **argv); /* ------------------------------------------------------------------------------- */
-/**
- * AnopeInit is called when the module is loaded
- * @param argc Argument count
- * @param argv Argument list
- * @return MOD_CONT to allow the module, MOD_STOP to stop it
- **/
-int AnopeInit(int argc, char **argv) {
- EvtHook *hook;
- IgnoreDB = NULL;
-
- moduleAddAuthor(AUTHOR);
- moduleAddVersion(VERSION);
- moduleSetType(SUPPORTED);
-
- hook = createEventHook(EVENT_RELOAD, reload_config);
- if (moduleAddEventHook(hook) != MOD_ERR_OK) {
- alog("[\002os_ignore_db\002] Can't hook to EVENT_RELOAD event");
- return MOD_STOP;
- }
-
- hook = createEventHook(EVENT_DB_SAVING, save_ignoredb);
- if (moduleAddEventHook(hook) != MOD_ERR_OK) {
- alog("[\002os_ignore_db\002] Can't hook to EVENT_DB_SAVING event");
- return MOD_STOP;
- }
-
- hook = createEventHook(EVENT_DB_BACKUP, backup_ignoredb);
- if (moduleAddEventHook(hook) != MOD_ERR_OK) {
- alog("[\002os_ignore_db\002] Can't hook to EVENT_DB_BACKUP event");
- return MOD_STOP;
- }
-
- load_config();
- /* Load the ignore database and re-add them to anopes ignorelist. */
- load_ignore_db();
+class OSIgnoreDB : public Module +{ + public: + OSIgnoreDB(const std::string &creator) : Module(creator) + { + EvtHook *hook;
+ IgnoreDB = NULL;
+
+ moduleAddAuthor(AUTHOR);
+ moduleAddVersion(VERSION);
+ moduleSetType(SUPPORTED);
+
+ hook = createEventHook(EVENT_RELOAD, reload_config);
+ if (moduleAddEventHook(hook) != MOD_ERR_OK) + throw ModuleException("os_ignore_db: Can't hook to EVENT_RELOAD event");
+ + hook = createEventHook(EVENT_DB_SAVING, save_ignoredb);
+ if (moduleAddEventHook(hook) != MOD_ERR_OK) + throw ModuleException("os_ignore_db: Can't hook to EVENT_DB_SAVING event");
+
+ hook = createEventHook(EVENT_DB_BACKUP, backup_ignoredb);
+ if (moduleAddEventHook(hook) != MOD_ERR_OK) + throw ModuleException("os_ignore_db: Can't hook to EVENT_DB_BACKUP event");
+
+ load_config();
+ /* Load the ignore database and re-add them to anopes ignorelist. */
+ load_ignore_db();
+ } + + ~OSIgnoreDB() + { + /* Save the ignore database before bailing out.. */
+ save_ignore_db();
- return MOD_CONT;
-}
+ if (IgnoreDB)
+ free(IgnoreDB); + } +};
-/**
- * Unload the module
- **/
-void AnopeFini(void) {
- /* Save the ignore database before bailing out.. */
- save_ignore_db();
-
- if (IgnoreDB)
- free(IgnoreDB);
-}
+ + /* ------------------------------------------------------------------------------- */
@@ -540,6 +532,6 @@ void fill_db_ptr(DBFile *dbptr, int version, int core_version, strcpy(dbptr->filename, filename);
snprintf(dbptr->temp_name, 261, "%s.temp", filename);
return;
-}
+} -/* EOF */
+MODULE_INIT(OSIgnoreDB) diff --git a/src/modules/os_info.c b/src/modules/os_info.c index 1d6d11c09..30df2adab 100644 --- a/src/modules/os_info.c +++ b/src/modules/os_info.c @@ -61,74 +61,68 @@ int mEventReload(int argc, char **argv); /*************************************************************************/ -/** - * AnopeInit is called when the module is loaded - * @param argc Argument count - * @param argv Argument list - * @return MOD_CONT to allow the module, MOD_STOP to stop it - **/ -int AnopeInit(int argc, char **argv) +class OSInfo : public Module { - Command *c; - EvtHook *hook = NULL; + public: + OSInfo(const std::string &creator) : Module(creator) + { + Command *c; + EvtHook *hook = NULL; - int status; + int status; - moduleAddAuthor(AUTHOR); - moduleAddVersion(VERSION); - moduleSetType(SUPPORTED); + moduleAddAuthor(AUTHOR); + moduleAddVersion(VERSION); + moduleSetType(SUPPORTED); - alog("os_info: Loading configuration directives..."); - if (mLoadConfig()) { - return MOD_STOP; - } + if (mLoadConfig()) + throw ModuleException("Unable to load config"); - c = createCommand("oInfo", myAddNickInfo, is_oper, -1, -1, -1, -1, -1); - moduleAddHelp(c, mNickHelp); - status = moduleAddCommand(NICKSERV, c, MOD_HEAD); + c = createCommand("oInfo", myAddNickInfo, is_oper, -1, -1, -1, -1, -1); + moduleAddHelp(c, mNickHelp); + status = moduleAddCommand(NICKSERV, c, MOD_HEAD); - c = createCommand("Info", myNickInfo, NULL, -1, -1, -1, -1, -1); - status = moduleAddCommand(NICKSERV, c, MOD_TAIL); + c = createCommand("Info", myNickInfo, NULL, -1, -1, -1, -1, -1); + status = moduleAddCommand(NICKSERV, c, MOD_TAIL); - c = createCommand("oInfo", myAddChanInfo, is_oper, -1, -1, -1, -1, -1); - moduleAddHelp(c, mChanHelp); - status = moduleAddCommand(CHANSERV, c, MOD_HEAD); + c = createCommand("oInfo", myAddChanInfo, is_oper, -1, -1, -1, -1, -1); + moduleAddHelp(c, mChanHelp); + status = moduleAddCommand(CHANSERV, c, MOD_HEAD); - c = createCommand("Info", myChanInfo, NULL, -1, -1, -1, -1, -1); - status = moduleAddCommand(CHANSERV, c, MOD_TAIL); + c = createCommand("Info", myChanInfo, NULL, -1, -1, -1, -1, -1); + status = moduleAddCommand(CHANSERV, c, MOD_TAIL); - hook = createEventHook(EVENT_DB_SAVING, mSaveData); - status = moduleAddEventHook(hook); + hook = createEventHook(EVENT_DB_SAVING, mSaveData); + status = moduleAddEventHook(hook); - hook = createEventHook(EVENT_DB_BACKUP, mBackupData); - status = moduleAddEventHook(hook); + hook = createEventHook(EVENT_DB_BACKUP, mBackupData); + status = moduleAddEventHook(hook); - hook = createEventHook(EVENT_RELOAD, mEventReload); - status = moduleAddEventHook(hook); + hook = createEventHook(EVENT_RELOAD, mEventReload); + status = moduleAddEventHook(hook); - moduleSetNickHelp(mMainNickHelp); - moduleSetChanHelp(mMainChanHelp); + moduleSetNickHelp(mMainNickHelp); + moduleSetChanHelp(mMainChanHelp); - mLoadData(); - m_AddLanguages(); + mLoadData(); + m_AddLanguages(); + } - return MOD_CONT; -} + ~OSInfo() + { + char *av[1]; + + av[0] = sstrdup(EVENT_START); + mSaveData(1, av); + free(av[0]); + + if (OSInfoDBName) + free(OSInfoDBName); + } +}; -/** - * Unload the module - **/ -void AnopeFini(void) -{ - char *av[1]; - av[0] = sstrdup(EVENT_START); - mSaveData(1, av); - free(av[0]); - if (OSInfoDBName) - free(OSInfoDBName); -} /*************************************************************************/ @@ -779,4 +773,4 @@ void mMainChanHelp(User * u) /* EOF */ -MODULE_INIT("os_info") +MODULE_INIT(OSInfo) |