/** * modload.C: Loads a new module in. * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2005-2006 William Pitcock, et al. * Rights to this code are as documented in doc/pod/license.pod. * * $Id: modload.C,v 1.8 2007/09/22 14:27:28 pippijn Exp $ */ #include "atheme.h" #include static char const rcsid[] = "$Id: modload.C,v 1.8 2007/09/22 14:27:28 pippijn Exp $"; REGISTER_MODULE ("operserv/modload", false, "The Ermyth Team "); static void os_cmd_modload (sourceinfo_t *si, int parc, char *parv[]); command_t const os_modload = { "MODLOAD", N_("Loads a module."), PRIV_ADMIN, 20, os_cmd_modload }; E cmdvec os_cmdtree; E helpvec os_helptree; bool _modinit (module *m) { os_cmdtree << os_modload; help_addentry (os_helptree, "MODLOAD", "help/operserv/modload", NULL); return true; } void _moddeinit () { os_cmdtree >> os_modload; help_delentry (os_helptree, "MODLOAD"); } static void os_cmd_modload (sourceinfo_t *si, int parc, char *parv[]) { char *modname; int i; if (parc < 1) { command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "MODLOAD"); command_fail (si, fault::needmoreparams, _("Syntax: MODLOAD ")); return; } i = 0; while (i < parc) { modname = parv[i++]; logcommand (si, CMDLOG_ADMIN, "MODLOAD %s", modname); fault::code success = modules::enable (modname); switch (success) { case fault::nosuch_target: command_fail (si, fault::nosuch_target, _("\2%s\2 does not exist."), modname); continue; case fault::nochange: command_fail (si, fault::nochange, _("\2%s\2 is already loaded."), modname); continue; case fault::ok: command_success_nodata (si, _("Module \2%s\2 loaded."), modname); continue; default: command_fail (si, fault::nosuch_target, _("Module \2%s\2 failed to load."), modname); continue; } } }