diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-05 00:17:27 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-05 00:17:27 +0000 |
commit | 3bc401a13010084c8a8221ceb1c0c15463452ec6 (patch) | |
tree | e97a548887fc05b3aab69d2435a82197114639aa /src | |
parent | e47d169f4961dbcc36014e11a6ead2be0baf62f6 (diff) |
Convert OperServ. YES, src/core done.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1557 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
38 files changed, 620 insertions, 1110 deletions
diff --git a/src/core/os_admin.c b/src/core/os_admin.c index 6b7a9008b..ca00b3622 100644 --- a/src/core/os_admin.c +++ b/src/core/os_admin.c @@ -21,37 +21,25 @@ int admin_list_callback(SList * slist, int number, void *item, int admin_list(int number, NickCore * nc, User * u, int *sent_header); void myOperServHelp(User * u); -/** - * Create the command, 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 OSAdmin : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSAdmin(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("ADMIN", do_admin, NULL, OPER_HELP_ADMIN, -1, -1, - -1, -1); - c->help_param1 = s_NickServ; - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("ADMIN", do_admin, NULL, OPER_HELP_ADMIN, -1, -1, -1, -1); + c->help_param1 = s_NickServ; + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + moduleSetOperHelp(myOperServHelp); + } +}; -} @@ -243,4 +231,4 @@ int admin_list(int number, NickCore * nc, User * u, int *sent_header) return 1; } -MODULE_INIT("os_admin") +MODULE_INIT(OSAdmin) diff --git a/src/core/os_akill.c b/src/core/os_akill.c index 5c142f71e..599ba1cf6 100644 --- a/src/core/os_akill.c +++ b/src/core/os_akill.c @@ -24,36 +24,22 @@ int akill_list_callback(SList * slist, int number, void *item, int akill_list(int number, Akill * ak, User * u, int *sent_header); void myOperServHelp(User * u); -/** - * Create the command, 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 OSAKill : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); - c = createCommand("AKILL", do_akill, is_services_oper, OPER_HELP_AKILL, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + public: + OSAKill(const std::string &creator) : Module(creator) + { + Command *c; -/** - * Unload the module - **/ -void AnopeFini(void) -{ + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + c = createCommand("AKILL", do_akill, is_services_oper, OPER_HELP_AKILL, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -} + moduleSetOperHelp(myOperServHelp); + } +}; @@ -388,4 +374,4 @@ int akill_list(int number, Akill * ak, User * u, int *sent_header) return 1; } -MODULE_INIT("os_akill") +MODULE_INIT(OSAKill) diff --git a/src/core/os_chankill.c b/src/core/os_chankill.c index 16ea99071..e3fe7e1bd 100644 --- a/src/core/os_chankill.c +++ b/src/core/os_chankill.c @@ -18,37 +18,23 @@ int do_chankill(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSChanKill : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); + public: + OSChanKill(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("CHANKILL", do_chankill, is_services_admin, - OPER_HELP_CHANKILL, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("CHANKILL", do_chankill, is_services_admin, OPER_HELP_CHANKILL, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; @@ -133,4 +119,4 @@ int do_chankill(User * u) return MOD_CONT; } -MODULE_INIT("os_chankill") +MODULE_INIT(OSChanKill) diff --git a/src/core/os_chanlist.c b/src/core/os_chanlist.c index 56a12d53f..e7652785c 100644 --- a/src/core/os_chanlist.c +++ b/src/core/os_chanlist.c @@ -21,37 +21,24 @@ void myOperServHelp(User * u); extern MDE int anope_get_private_mode(); #endif -/** - * Create the command, 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 OSChanList : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSChanList(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("CHANLIST", do_chanlist, is_services_oper, - OPER_HELP_CHANLIST, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("CHANLIST", do_chanlist, is_services_oper, OPER_HELP_CHANLIST, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleSetOperHelp(myOperServHelp); + } +}; -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} /** @@ -115,4 +102,4 @@ int do_chanlist(User * u) return MOD_CONT; } -MODULE_INIT("os_chanlist") +MODULE_INIT(OSChanList) diff --git a/src/core/os_clearmodes.c b/src/core/os_clearmodes.c index 6f1fc79f0..0b5f0ff03 100644 --- a/src/core/os_clearmodes.c +++ b/src/core/os_clearmodes.c @@ -18,37 +18,24 @@ int do_clearmodes(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSClearModes : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); + public: + OSClearModes(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("CLEARMODES", do_clearmodes, is_services_oper, - OPER_HELP_CLEARMODES, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion + ("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("CLEARMODES", do_clearmodes, is_services_oper, OPER_HELP_CLEARMODES, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -307,4 +294,4 @@ int do_clearmodes(User * u) return MOD_CONT; } -MODULE_INIT("os_clearmodes") +MODULE_INIT(OSClearModes) diff --git a/src/core/os_defcon.c b/src/core/os_defcon.c index 4b6079d20..612b200a4 100644 --- a/src/core/os_defcon.c +++ b/src/core/os_defcon.c @@ -24,36 +24,23 @@ void defcon_sendlvls(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSDEFCON : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSDEFCON(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("DEFCON", do_defcon, is_services_admin, - OPER_HELP_DEFCON, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("DEFCON", do_defcon, is_services_admin, OPER_HELP_DEFCON, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -168,4 +155,4 @@ void defcon_sendlvls(User * u) } } -MODULE_INIT("os_defcon") +MODULE_INIT(OSDEFCON) diff --git a/src/core/os_global.c b/src/core/os_global.c index 4258b8df1..4c0b37536 100644 --- a/src/core/os_global.c +++ b/src/core/os_global.c @@ -18,36 +18,24 @@ int do_global(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSGlobal : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSGlobal(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("GLOBAL", do_global, is_services_admin, - OPER_HELP_GLOBAL, -1, -1, -1, -1); - c->help_param1 = s_GlobalNoticer; - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + c = createCommand("GLOBAL", do_global, is_services_admin, OPER_HELP_GLOBAL, -1, -1, -1, -1); + c->help_param1 = s_GlobalNoticer; + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleSetOperHelp(myOperServHelp); + } +}; -} /** @@ -81,4 +69,4 @@ int do_global(User * u) return MOD_CONT; } -MODULE_INIT("os_global") +MODULE_INIT(OSGlobal) diff --git a/src/core/os_help.c b/src/core/os_help.c index 5842f888f..6f2193197 100644 --- a/src/core/os_help.c +++ b/src/core/os_help.c @@ -17,32 +17,20 @@ int do_help(User * u); -/** - * Create the command, 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 OSHelp : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - c = createCommand("HELP", do_help, NULL, -1, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - return MOD_CONT; -} + public: + OSHelp(const std::string &creator) : Module(creator) + { + Command *c; -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + c = createCommand("HELP", do_help, NULL, -1, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + } +}; @@ -65,4 +53,4 @@ int do_help(User * u) return MOD_CONT; } -MODULE_INIT("os_help") +MODULE_INIT(OSHelp) diff --git a/src/core/os_ignore.c b/src/core/os_ignore.c index b6d47764a..39d461d6e 100644 --- a/src/core/os_ignore.c +++ b/src/core/os_ignore.c @@ -19,35 +19,22 @@ int do_ignorelist(User * u); void myOperServHelp(User * u); int do_ignoreuser(User * u); -/** - * Create the command, 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 OSIgnore : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - c = createCommand("IGNORE", do_ignoreuser, is_services_admin, - OPER_HELP_IGNORE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + public: + OSIgnore(const std::string &creator) : Module(creator) + { + Command *c; -/** - * Unload the module - **/ -void AnopeFini(void) -{ + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + c = createCommand("IGNORE", do_ignoreuser, is_services_admin, OPER_HELP_IGNORE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -143,6 +130,4 @@ int do_ignorelist(User * u) return MOD_CONT; } -/* EOF */ - -MODULE_INIT("os_ignore") +MODULE_INIT(OSIgnore) diff --git a/src/core/os_jupe.c b/src/core/os_jupe.c index ea5d0a98a..4bb666945 100644 --- a/src/core/os_jupe.c +++ b/src/core/os_jupe.c @@ -18,36 +18,23 @@ int do_jupe(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSJupe : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSJupe(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("JUPE", do_jupe, is_services_admin, OPER_HELP_JUPE, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("JUPE", do_jupe, is_services_admin, OPER_HELP_JUPE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -91,4 +78,4 @@ int do_jupe(User * u) return MOD_CONT; } -MODULE_INIT("os_jupe") +MODULE_INIT(OSJupe) diff --git a/src/core/os_kick.c b/src/core/os_kick.c index 69a731767..819b568b6 100644 --- a/src/core/os_kick.c +++ b/src/core/os_kick.c @@ -18,36 +18,23 @@ int do_os_kick(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSKick : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSKick(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("KICK", do_os_kick, is_services_oper, OPER_HELP_KICK, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("KICK", do_os_kick, is_services_oper, OPER_HELP_KICK, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -99,4 +86,4 @@ int do_os_kick(User * u) return MOD_CONT; } -MODULE_INIT("os_kick") +MODULE_INIT(OSKick) diff --git a/src/core/os_logonnews.c b/src/core/os_logonnews.c index abcd1075d..087df972f 100644 --- a/src/core/os_logonnews.c +++ b/src/core/os_logonnews.c @@ -21,49 +21,43 @@ void myOperServHelp(User * u); int load_config(void); int reload_config(int argc, char **argv); -/** - * Create the command, 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 OSLogonNews : public Module { - EvtHook *hook; - char buf[BUFSIZE]; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - - /** - * For some unknown reason, do_logonnews is actaully defined in news.c - * we can look at moving it here later - **/ - c = createCommand("LOGONNEWS", do_logonnews, is_services_admin, - NEWS_HELP_LOGON, -1, -1, -1, -1); - snprintf(buf, BUFSIZE, "%d", NewsCount), - c->help_param1 = sstrdup(buf); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); - - hook = createEventHook(EVENT_RELOAD, reload_config); - if (moduleAddEventHook(hook) != MOD_ERR_OK) { - alog("[\002os_logonnews\002] Can't hook to EVENT_RELOAD event"); - return MOD_STOP; - } - - return MOD_CONT; -} + public: + OSLogonNews(const std::string &creator) : Module(creator) + { + EvtHook *hook; + char buf[BUFSIZE]; + + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + + /** + * For some unknown reason, do_logonnews is actaully defined in news.c + * we can look at moving it here later + **/ + c = createCommand("LOGONNEWS", do_logonnews, is_services_admin, + NEWS_HELP_LOGON, -1, -1, -1, -1); + snprintf(buf, BUFSIZE, "%d", NewsCount), + c->help_param1 = sstrdup(buf); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + + moduleSetOperHelp(myOperServHelp); + + hook = createEventHook(EVENT_RELOAD, reload_config); + if (moduleAddEventHook(hook) != MOD_ERR_OK) + { + throw ModuleException("os_logonnews: Can't hook to EVENT_RELOAD event"); + } + } + + ~OSLogonNews() + { + free(c->help_param1); + } +}; -/** - * Unload the module - **/ -void AnopeFini(void) -{ - free(c->help_param1); -} /** @@ -97,4 +91,4 @@ int reload_config(int argc, char **argv) { /* EOF */ -MODULE_INIT("os_logonnews") +MODULE_INIT(OSLogonNews) diff --git a/src/core/os_mode.c b/src/core/os_mode.c index c002f40ea..6a7a0b8dc 100644 --- a/src/core/os_mode.c +++ b/src/core/os_mode.c @@ -18,36 +18,24 @@ int do_os_mode(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSMode : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSMode(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("MODE", do_os_mode, is_services_oper, OPER_HELP_MODE, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("MODE", do_os_mode, is_services_oper, OPER_HELP_MODE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + moduleSetOperHelp(myOperServHelp); + } +}; -} /** @@ -101,4 +89,4 @@ int do_os_mode(User * u) return MOD_CONT; } -MODULE_INIT("os_mode") +MODULE_INIT(OSMode) diff --git a/src/core/os_modinfo.c b/src/core/os_modinfo.c index f3c73d8fb..6c073fa08 100644 --- a/src/core/os_modinfo.c +++ b/src/core/os_modinfo.c @@ -20,35 +20,22 @@ void myOperServHelp(User * u); int showModuleMsgLoaded(MessageHash * msgList, char *mod_name, User * u); int showModuleCmdLoaded(CommandHash * cmdList, char *mod_name, User * u); -/** - * Create the command, 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 OSModInfo : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - c = createCommand("MODINFO", do_modinfo, NULL, -1, -1, -1, -1, - OPER_HELP_MODINFO); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + public: + OSModInfo(const std::string &creator) : Module(creator) + { + Command *c; -/** - * Unload the module - **/ -void AnopeFini(void) -{ + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + c = createCommand("MODINFO", do_modinfo, NULL, -1, -1, -1, -1, OPER_HELP_MODINFO); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -138,4 +125,4 @@ int showModuleMsgLoaded(MessageHash * msgList, char *mod_name, User * u) return display; } -MODULE_INIT("os_modinfo") +MODULE_INIT(OSModInfo) diff --git a/src/core/os_modlist.c b/src/core/os_modlist.c index 91f9f39e1..dbc52d750 100644 --- a/src/core/os_modlist.c +++ b/src/core/os_modlist.c @@ -18,36 +18,23 @@ int do_modlist(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSModList : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSModList(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("MODLIST", do_modlist, NULL, -1, -1, -1, -1, - OPER_HELP_MODLIST); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("MODLIST", do_modlist, NULL, -1, -1, -1, -1, OPER_HELP_MODLIST); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -194,4 +181,4 @@ int do_modlist(User * u) return MOD_CONT; } -MODULE_INIT("os_modlist") +MODULE_INIT(OSModList) diff --git a/src/core/os_modload.c b/src/core/os_modload.c index 926a2c2e4..5e7aaebb1 100644 --- a/src/core/os_modload.c +++ b/src/core/os_modload.c @@ -18,37 +18,23 @@ int do_modload(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSModLoad : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); + public: + OSModLoad(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("MODLOAD", do_modload, is_services_root, -1, -1, -1, - -1, OPER_HELP_MODLOAD); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("MODLOAD", do_modload, is_services_root, -1, -1, -1, -1, OPER_HELP_MODLOAD); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -82,4 +68,4 @@ int do_modload(User * u) return MOD_CONT; } -MODULE_INIT("os_modload") +MODULE_INIT(OSModLoad) diff --git a/src/core/os_modunload.c b/src/core/os_modunload.c index a18bc8e54..786e5914b 100644 --- a/src/core/os_modunload.c +++ b/src/core/os_modunload.c @@ -19,37 +19,23 @@ int do_modunload(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSModUnLoad : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); + public: + OSModUnLoad(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("MODUNLOAD", do_modunload, is_services_root, -1, -1, - -1, -1, OPER_HELP_MODUNLOAD); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("MODUNLOAD", do_modunload, is_services_root, -1, -1, -1, -1, OPER_HELP_MODUNLOAD); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -84,4 +70,4 @@ int do_modunload(User * u) return MOD_CONT; } -MODULE_INIT("os_modunload") +MODULE_INIT(OSModUnLoad) diff --git a/src/core/os_noop.c b/src/core/os_noop.c index 65eff229f..e80a331a2 100644 --- a/src/core/os_noop.c +++ b/src/core/os_noop.c @@ -18,36 +18,24 @@ int do_noop(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSNOOP : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSNOOP(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("NOOP", do_noop, is_services_admin, OPER_HELP_NOOP, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("NOOP", do_noop, is_services_admin, OPER_HELP_NOOP, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + moduleSetOperHelp(myOperServHelp); + } +}; -} /** @@ -105,4 +93,4 @@ int do_noop(User * u) return MOD_CONT; } -MODULE_INIT("os_noop") +MODULE_INIT(OSNOOP) diff --git a/src/core/os_oline.c b/src/core/os_oline.c index b629beb1e..72a7987c1 100644 --- a/src/core/os_oline.c +++ b/src/core/os_oline.c @@ -18,39 +18,27 @@ int do_operoline(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSOLine : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSOLine(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("OLINE", do_operoline, is_services_root, - OPER_HELP_OLINE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); + c = createCommand("OLINE", do_operoline, is_services_root, OPER_HELP_OLINE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - if (!ircd->omode) { - return MOD_STOP; - } - return MOD_CONT; -} + moduleSetOperHelp(myOperServHelp); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + if (!ircd->omode) + throw ModuleException("Your IRCd does not support OMODE."); -} + } +}; /** @@ -107,4 +95,4 @@ int do_operoline(User * u) return MOD_CONT; } -MODULE_INIT("os_oline") +MODULE_INIT(OSOLine) diff --git a/src/core/os_oper.c b/src/core/os_oper.c index 8bdff9f0e..e34445116 100644 --- a/src/core/os_oper.c +++ b/src/core/os_oper.c @@ -21,36 +21,23 @@ int oper_list_callback(SList * slist, int number, void *item, int oper_list(int number, NickCore * nc, User * u, int *sent_header); void myOperServHelp(User * u); -/** - * Create the command, 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 OSOper : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - c = createCommand("OPER", do_oper, NULL, OPER_HELP_OPER, -1, -1, -1, - -1); - c->help_param1 = s_NickServ; - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + public: + OSOper(const std::string &creator) : Module(creator) + { + Command *c; - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + c = createCommand("OPER", do_oper, NULL, OPER_HELP_OPER, -1, -1, -1, -1); + c->help_param1 = s_NickServ; + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -246,4 +233,4 @@ int oper_list_callback(SList * slist, int number, void *item, va_list args) return oper_list(number, (NickCore *)item, u, sent_header); } -MODULE_INIT("os_oper") +MODULE_INIT(OSOper) diff --git a/src/core/os_opernews.c b/src/core/os_opernews.c index a5cf0602c..e654bc5c1 100644 --- a/src/core/os_opernews.c +++ b/src/core/os_opernews.c @@ -21,49 +21,38 @@ void myOperServHelp(User * u); int load_config(void); int reload_config(int argc, char **argv); -/** - * Create the command, 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 OSOperNews : public Module { - EvtHook *hook; - char buf[BUFSIZE]; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - - /** - * For some unknown reason, do_opernews is actaully defined in news.c - * we can look at moving it here later - **/ - c = createCommand("OPERNEWS", do_opernews, is_services_admin, - NEWS_HELP_OPER, -1, -1, -1, -1); - snprintf(buf, BUFSIZE, "%d", NewsCount), - c->help_param1 = sstrdup(buf); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); - - hook = createEventHook(EVENT_RELOAD, reload_config); - if (moduleAddEventHook(hook) != MOD_ERR_OK) { - alog("[\002os_opernews\002] Can't hook to EVENT_RELOAD event"); - return MOD_STOP; - } - - return MOD_CONT; -} - -/** - * Unload the module - **/ -void AnopeFini(void) -{ - free(c->help_param1); -} + public: + OSOperNews(const std::string &creator) : Module(creator) + { + EvtHook *hook; + char buf[BUFSIZE]; + + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + + /** XXX: For some unknown reason, do_opernews is actaully defined in news.c + * we can look at moving it here later + **/ + c = createCommand("OPERNEWS", do_opernews, is_services_admin, NEWS_HELP_OPER, -1, -1, -1, -1); + snprintf(buf, BUFSIZE, "%d", NewsCount), + c->help_param1 = sstrdup(buf); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + + moduleSetOperHelp(myOperServHelp); + + hook = createEventHook(EVENT_RELOAD, reload_config); + if (moduleAddEventHook(hook) != MOD_ERR_OK) + throw ModuleException("os_opernews: Can't hook to EVENT_RELOAD event"); + } + + ~OSOperNews() + { + free(c->help_param1); + } +}; /** @@ -94,6 +83,5 @@ int reload_config(int argc, char **argv) { return MOD_CONT; } -/* EOF */ -MODULE_INIT("os_opernews") +MODULE_INIT(OSOperNews) diff --git a/src/core/os_quit.c b/src/core/os_quit.c index 26c1b0021..cc187c21f 100644 --- a/src/core/os_quit.c +++ b/src/core/os_quit.c @@ -18,36 +18,23 @@ int do_os_quit(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSQuit : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSQuit(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("QUIT", do_os_quit, is_services_root, - OPER_HELP_QUIT, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("QUIT", do_os_quit, is_services_root, OPER_HELP_QUIT, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -81,4 +68,4 @@ int do_os_quit(User * u) return MOD_CONT; } -MODULE_INIT("os_quit") +MODULE_INIT(OSQuit) diff --git a/src/core/os_randomnews.c b/src/core/os_randomnews.c index 361a9937b..95ae0fdec 100644 --- a/src/core/os_randomnews.c +++ b/src/core/os_randomnews.c @@ -17,41 +17,27 @@ void myOperServHelp(User * u); -/** - * Create the command, 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 OSRandomNews : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(CORE); - - /** - * For some unknown reason, do_randomnews is actaully defined in news.c - * we can look at moving it here later - **/ - c = createCommand("RANDOMNEWS", do_randomnews, is_services_admin, - NEWS_HELP_RANDOM, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); + public: + OSRandomNews(const std::string &creator) : Module(creator) + { + Command *c; - return MOD_CONT; -} + moduleAddAuthor("Anope"); + moduleAddVersion + ("$Id$"); + moduleSetType(CORE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + /** XXX: For some unknown reason, do_randomnews is actaully defined in news.c + * we can look at moving it here later + **/ + c = createCommand("RANDOMNEWS", do_randomnews, is_services_admin, NEWS_HELP_RANDOM, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -65,4 +51,4 @@ void myOperServHelp(User * u) } } -MODULE_INIT("os_randomnews") +MODULE_INIT(OSRandomNews) diff --git a/src/core/os_raw.c b/src/core/os_raw.c index 142a44980..69a4b00db 100644 --- a/src/core/os_raw.c +++ b/src/core/os_raw.c @@ -17,38 +17,24 @@ int do_raw(User * u); -/** - * Create the command, 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 OSRaw : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(THIRD); + public: + OSRaw(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("RAW", do_raw, is_services_root, OPER_HELP_RAW, -1, - -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(THIRD); - if (DisableRaw) { - alog("[os_raw] Unloading because DisableRaw is enabled"); - return MOD_STOP; - } - return MOD_CONT; -} + c = createCommand("RAW", do_raw, is_services_root, OPER_HELP_RAW, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + if (DisableRaw) + throw ModuleException("os_raw: Not loading because you probably shouldn't be loading me"); + } +}; /** @@ -77,4 +63,4 @@ int do_raw(User * u) return MOD_CONT; } -MODULE_INIT("os_raw") +MODULE_INIT(OSRaw) diff --git a/src/core/os_reload.c b/src/core/os_reload.c index 3eacf80c7..8657e3768 100644 --- a/src/core/os_reload.c +++ b/src/core/os_reload.c @@ -18,36 +18,23 @@ int do_reload(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSReload : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSReload(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("RELOAD", do_reload, is_services_root, - OPER_HELP_RELOAD, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("RELOAD", do_reload, is_services_root, OPER_HELP_RELOAD, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -83,4 +70,4 @@ int do_reload(User * u) return MOD_CONT; } -MODULE_INIT("os_reload") +MODULE_INIT(OSReload) diff --git a/src/core/os_restart.c b/src/core/os_restart.c index 3233ca290..0c6e211a6 100644 --- a/src/core/os_restart.c +++ b/src/core/os_restart.c @@ -23,35 +23,22 @@ extern MDE void do_restart_services(void); int do_restart(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSRestart : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - c = createCommand("RESTART", do_restart, is_services_root, - OPER_HELP_RESTART, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + public: + OSRestart(const std::string &creator) : Module(creator) + { + Command *c; - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + c = createCommand("RESTART", do_restart, is_services_root, OPER_HELP_RESTART, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -90,4 +77,4 @@ int do_restart(User * u) return MOD_CONT; } -MODULE_INIT("os_restart") +MODULE_INIT(OSRestart) diff --git a/src/core/os_session.c b/src/core/os_session.c index bec687ee5..3f15f3ab0 100644 --- a/src/core/os_session.c +++ b/src/core/os_session.c @@ -17,42 +17,28 @@ void myOperServHelp(User * u); -/** - * Create the command, 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 OSSession : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - - /** - * do_session/do_exception are exported from sessions.c - we just want to provide an interface. - **/ - c = createCommand("SESSION", do_session, is_services_oper, - OPER_HELP_SESSION, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("EXCEPTION", do_exception, is_services_oper, - OPER_HELP_EXCEPTION, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - - moduleSetOperHelp(myOperServHelp); + public: + OSSession(const std::string &creator) : Module(creator) + { + Command *c; - return MOD_CONT; -} + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ + /** + * do_session/do_exception are exported from sessions.c - we just want to provide an interface. + **/ + c = createCommand("SESSION", do_session, is_services_oper, OPER_HELP_SESSION, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("EXCEPTION", do_exception, is_services_oper, OPER_HELP_EXCEPTION, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -67,4 +53,4 @@ void myOperServHelp(User * u) } } -MODULE_INIT("os_session") +MODULE_INIT(OSSession) diff --git a/src/core/os_set.c b/src/core/os_set.c index 543bcb569..bedbccc28 100644 --- a/src/core/os_set.c +++ b/src/core/os_set.c @@ -18,62 +18,37 @@ int do_set(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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) -{ - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); - - c = createCommand("SET", do_set, is_services_root, OPER_HELP_SET, -1, - -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET LIST", NULL, NULL, OPER_HELP_SET_LIST, -1, -1, - -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET READONLY", NULL, NULL, OPER_HELP_SET_READONLY, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET LOGCHAN", NULL, NULL, OPER_HELP_SET_LOGCHAN, -1, - -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET DEBUG", NULL, NULL, OPER_HELP_SET_DEBUG, -1, -1, - -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET NOEXPIRE", NULL, NULL, OPER_HELP_SET_NOEXPIRE, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET IGNORE", NULL, NULL, OPER_HELP_SET_IGNORE, -1, - -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("SET SUPERADMIN", NULL, NULL, - OPER_HELP_SET_SUPERADMIN, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -#ifdef USE_MYSQL - c = createCommand("SET SQL", NULL, NULL, OPER_HELP_SET_SQL, -1, -1, -1, - -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -#endif - - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} - -/** - * Unload the module - **/ -void AnopeFini(void) +class OSSet : public Module { - -} + public: + OSSet(const std::string &creator) : Module(creator) + { + Command *c; + + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); + + c = createCommand("SET", do_set, is_services_root, OPER_HELP_SET, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET LIST", NULL, NULL, OPER_HELP_SET_LIST, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET READONLY", NULL, NULL, OPER_HELP_SET_READONLY, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET LOGCHAN", NULL, NULL, OPER_HELP_SET_LOGCHAN, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET DEBUG", NULL, NULL, OPER_HELP_SET_DEBUG, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET NOEXPIRE", NULL, NULL, OPER_HELP_SET_NOEXPIRE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET IGNORE", NULL, NULL, OPER_HELP_SET_IGNORE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("SET SUPERADMIN", NULL, NULL, OPER_HELP_SET_SUPERADMIN, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -263,4 +238,4 @@ int do_set(User * u) return MOD_CONT; } -MODULE_INIT("os_set") +MODULE_INIT(OSSet) diff --git a/src/core/os_sgline.c b/src/core/os_sgline.c index 586c0db42..70625e280 100644 --- a/src/core/os_sgline.c +++ b/src/core/os_sgline.c @@ -25,39 +25,27 @@ int do_sgline(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSSGLine : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSSGLine(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("SGLINE", do_sgline, is_services_oper, - OPER_HELP_SGLINE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); + c = createCommand("SGLINE", do_sgline, is_services_oper, + OPER_HELP_SGLINE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - if (!ircd->sgline) { - return MOD_STOP; - } - return MOD_CONT; -} + moduleSetOperHelp(myOperServHelp); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + if (!ircd->sgline) + throw ModuleException("Your IRCd does not support SGLine"); + } +}; /** @@ -361,4 +349,4 @@ int sgline_list_callback(SList * slist, int number, void *item, return sgline_list(number, (SXLine *)item, u, sent_header); } -MODULE_INIT("os_sgline") +MODULE_INIT(OSSGLine) diff --git a/src/core/os_shutdown.c b/src/core/os_shutdown.c index e8403e299..2dec092c6 100644 --- a/src/core/os_shutdown.c +++ b/src/core/os_shutdown.c @@ -18,36 +18,23 @@ int do_shutdown(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSShutdown : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSShutdown(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("SHUTDOWN", do_shutdown, is_services_root, - OPER_HELP_SHUTDOWN, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("SHUTDOWN", do_shutdown, is_services_root, OPER_HELP_SHUTDOWN, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -82,4 +69,4 @@ int do_shutdown(User * u) return MOD_CONT; } -MODULE_INIT("os_shutdown") +MODULE_INIT(OSShutdown) diff --git a/src/core/os_sqline.c b/src/core/os_sqline.c index f7b503ec1..9a208706b 100644 --- a/src/core/os_sqline.c +++ b/src/core/os_sqline.c @@ -25,38 +25,26 @@ int sqline_list(int number, SXLine * sx, User * u, int *sent_header); void myOperServHelp(User * u); -/** - * Create the command, 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 OSSQLine : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSSQLine(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("SQLINE", do_sqline, is_services_oper, - OPER_HELP_SQLINE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - if (!ircd->sqline) { - return MOD_STOP; - } - return MOD_CONT; -} + c = createCommand("SQLINE", do_sqline, is_services_oper, + OPER_HELP_SQLINE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + if (!ircd->sqline) + throw ModuleException("Your IRCd does not support QLines."); + } +}; /** @@ -354,4 +342,4 @@ int sqline_list_callback(SList * slist, int number, void *item, return sqline_list(number, (SXLine *)item, u, sent_header); } -MODULE_INIT("os_sqline") +MODULE_INIT(OSSQLine) diff --git a/src/core/os_staff.c b/src/core/os_staff.c index d416a2d41..f21afcd91 100644 --- a/src/core/os_staff.c +++ b/src/core/os_staff.c @@ -21,36 +21,23 @@ int opers_list_callback(SList * slist, int number, void *item, va_list args); int opers_list(int number, NickCore * nc, User * u, char *level); -/** - * Create the command, 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 OSStaff : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSStaff(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("STAFF", do_staff, NULL, OPER_HELP_STAFF, -1, -1, - -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("STAFF", do_staff, NULL, OPER_HELP_STAFF, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -155,4 +142,4 @@ int opers_list(int number, NickCore * nc, User * u, char *level) return 1; } -MODULE_INIT("os_staff") +MODULE_INIT(OSStaff) diff --git a/src/core/os_stats.c b/src/core/os_stats.c index b00cab98f..59ac8582b 100644 --- a/src/core/os_stats.c +++ b/src/core/os_stats.c @@ -21,39 +21,25 @@ int do_stats(User * u); void get_operserv_stats(long *nrec, long *memuse); void myOperServHelp(User * u); -/** - * Create the command, 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 OSStats : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSStats(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("STATS", do_stats, NULL, OPER_HELP_STATS, - -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - c = createCommand("UPTIME", do_stats, NULL, - OPER_HELP_STATS, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("STATS", do_stats, NULL, OPER_HELP_STATS, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("UPTIME", do_stats, NULL, OPER_HELP_STATS, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -452,4 +438,4 @@ void get_operserv_stats(long *nrec, long *memuse) *memuse = mem; } -MODULE_INIT("os_stats") +MODULE_INIT(OSStats) diff --git a/src/core/os_svsnick.c b/src/core/os_svsnick.c index b68cc5334..055ee5fec 100644 --- a/src/core/os_svsnick.c +++ b/src/core/os_svsnick.c @@ -18,38 +18,26 @@ int do_svsnick(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSSVSNick : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSSVSNick(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("SVSNICK", do_svsnick, is_services_root, - OPER_HELP_SVSNICK, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - if (!ircd->svsnick) { - return MOD_STOP; - } - return MOD_CONT; -} + c = createCommand("SVSNICK", do_svsnick, is_services_root, + OPER_HELP_SVSNICK, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + if (!ircd->svsnick) + throw ModuleException("Your IRCd does not support SVSNICK"); + } +}; /** @@ -124,4 +112,4 @@ int do_svsnick(User * u) return MOD_CONT; } -MODULE_INIT("os_svsnick") +MODULE_INIT(OSSVSNick) diff --git a/src/core/os_szline.c b/src/core/os_szline.c index 5f33fd38c..21b016d7b 100644 --- a/src/core/os_szline.c +++ b/src/core/os_szline.c @@ -24,38 +24,26 @@ int szline_list_callback(SList * slist, int number, void *item, int szline_view(int number, SXLine * sx, User * u, int *sent_header); int szline_list(int number, SXLine * sx, User * u, int *sent_header); -/** - * Create the command, 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 OSSZLine : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSSZLine(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("SZLINE", do_szline, is_services_oper, - OPER_HELP_SZLINE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - if (!ircd->szline) { - return MOD_STOP; - } - return MOD_CONT; -} + c = createCommand("SZLINE", do_szline, is_services_oper, + OPER_HELP_SZLINE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + if (!ircd->szline) + throw ModuleException("Your IRCd does not support ZLINEs"); + } +}; /** @@ -349,4 +337,4 @@ int szline_list(int number, SXLine * sx, User * u, int *sent_header) return 1; } -MODULE_INIT("os_szline") +MODULE_INIT(OSSZLine) diff --git a/src/core/os_umode.c b/src/core/os_umode.c index 23c4a5dc7..30c835326 100644 --- a/src/core/os_umode.c +++ b/src/core/os_umode.c @@ -18,31 +18,26 @@ int do_operumodes(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSUMode : public Module { - Command *c; + public: + OSUMode(const std::string &creator) : Module(creator) + { + Command *c; - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - c = createCommand("UMODE", do_operumodes, is_services_root, - OPER_HELP_UMODE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + c = createCommand("UMODE", do_operumodes, is_services_root, OPER_HELP_UMODE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); - moduleSetOperHelp(myOperServHelp); + moduleSetOperHelp(myOperServHelp); - if (!ircd->umode) { - return MOD_STOP; - } - return MOD_CONT; -} + if (!ircd->umode) + throw ModuleException("Your IRCd does not support setting umodes"); + } +}; /** * Unload the module @@ -115,4 +110,4 @@ int do_operumodes(User * u) return MOD_CONT; } -MODULE_INIT("os_umode") +MODULE_INIT(OSUMode) diff --git a/src/core/os_update.c b/src/core/os_update.c index 5d1509475..d8d9c05c6 100644 --- a/src/core/os_update.c +++ b/src/core/os_update.c @@ -18,36 +18,23 @@ int do_update(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSUpdate : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSUpdate(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("UPDATE", do_update, is_services_root, - OPER_HELP_UPDATE, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("UPDATE", do_update, is_services_root, OPER_HELP_UPDATE, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -73,4 +60,4 @@ int do_update(User * u) return MOD_CONT; } -MODULE_INIT("os_update") +MODULE_INIT(OSUpdate) diff --git a/src/core/os_userlist.c b/src/core/os_userlist.c index c65f3b3ce..c4d6876b6 100644 --- a/src/core/os_userlist.c +++ b/src/core/os_userlist.c @@ -23,36 +23,23 @@ extern MDE int anope_get_invis_mode(); int do_userlist(User * u); void myOperServHelp(User * u); -/** - * Create the command, 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 OSUserList : public Module { - Command *c; - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(CORE); + public: + OSUserList(const std::string &creator) : Module(creator) + { + Command *c; - c = createCommand("USERLIST", do_userlist, NULL, - OPER_HELP_USERLIST, -1, -1, -1, -1); - moduleAddCommand(OPERSERV, c, MOD_UNIQUE); + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(CORE); - moduleSetOperHelp(myOperServHelp); - - return MOD_CONT; -} + c = createCommand("USERLIST", do_userlist, NULL, OPER_HELP_USERLIST, -1, -1, -1, -1); + moduleAddCommand(OPERSERV, c, MOD_UNIQUE); -/** - * Unload the module - **/ -void AnopeFini(void) -{ - -} + moduleSetOperHelp(myOperServHelp); + } +}; /** @@ -120,4 +107,4 @@ int do_userlist(User * u) return MOD_CONT; } -MODULE_INIT("os_userlist") +MODULE_INIT(OSUserList) |