/** * clear.C: This file contains code for the ChanServ CLEAR functions. * * 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 William Pitcock, et al. * Rights to this code are as documented in doc/pod/license.pod. * * $Id: clear.C,v 1.8 2007/09/22 14:27:27 pippijn Exp $ */ #include "atheme.h" #include static char const rcsid[] = "$Id: clear.C,v 1.8 2007/09/22 14:27:27 pippijn Exp $"; REGISTER_MODULE ("chanserv/clear", false, "The Ermyth Team "); static void cs_cmd_clear (sourceinfo_t *si, int parc, char *parv[]); static void cs_help_clear (sourceinfo_t *si); command_t const cs_clear = { "CLEAR", N_("Channel removal toolkit."), AC_NONE, 3, cs_cmd_clear }; E cmdvec cs_cmdtree; E helpvec cs_helptree; cmdvec cs_clear_cmds; bool _modinit (module *m) { cs_cmdtree << cs_clear; help_addentry (cs_helptree, "CLEAR", NULL, cs_help_clear); return true; } void _moddeinit () { cs_cmdtree >> cs_clear; help_delentry (cs_helptree, "CLEAR"); } static void cs_help_clear (sourceinfo_t *si) { command_success_nodata (si, _("Help for \2CLEAR\2:")); command_success_nodata (si, " "); command_success_nodata (si, _("CLEAR allows you to clear various aspects of a channel.")); command_success_nodata (si, " "); command_help (si, cs_clear_cmds); command_success_nodata (si, " "); command_success_nodata (si, _("For more information, use \2/msg %s HELP CLEAR \37command\37\2."), si->service->disp); } static void cs_cmd_clear (sourceinfo_t *si, int parc, char *parv[]) { char *chan; char *cmd; command_t const *c; if (parc < 2) { command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "CLEAR"); command_fail (si, fault::needmoreparams, _("Syntax: CLEAR <#channel> [parameters]")); return; } if (parv[0][0] == '#') chan = parv[0], cmd = parv[1]; else if (parv[1][0] == '#') cmd = parv[0], chan = parv[1]; else { command_fail (si, fault::badparams, STR_INVALID_PARAMS, "CLEAR"); command_fail (si, fault::badparams, _("Syntax: CLEAR <#channel> [parameters]")); return; } c = cs_clear_cmds.find (cmd); if (c == NULL) { command_fail (si, fault::badparams, _("Invalid command. Use \2/%s%s help\2 for a command listing."), (ircd->uses_rcommand == false) ? "msg " : "", si->service->disp); return; } parv[1] = chan; c->exec (si->service, si, parc - 1, parv + 1); }