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/modules/ns_maxemail.c | |
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/modules/ns_maxemail.c')
-rw-r--r-- | src/modules/ns_maxemail.c | 57 |
1 files changed, 22 insertions, 35 deletions
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) |