/** * hold.C: Controls noexpire options for channels. * * 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 Atheme Development Group * Rights to this code are as documented in doc/pod/license.pod. * * $Id: hold.C,v 1.8 2007/09/22 14:27:27 pippijn Exp $ */ #include "atheme.h" #include #include static char const rcsid[] = "$Id: hold.C,v 1.8 2007/09/22 14:27:27 pippijn Exp $"; REGISTER_MODULE ("chanserv/hold", false, "The Ermyth Team "); static void cs_cmd_hold (sourceinfo_t *si, int parc, char *parv[]); command_t const cs_hold = { "HOLD", N_("Prevents a channel from expiring."), PRIV_HOLD, 2, cs_cmd_hold }; E cmdvec cs_cmdtree; E helpvec cs_helptree; bool _modinit (module *m) { cs_cmdtree << cs_hold; help_addentry (cs_helptree, "HOLD", "help/chanserv/hold", NULL); return true; } void _moddeinit () { cs_cmdtree >> cs_hold; help_delentry (cs_helptree, "HOLD"); } static void cs_cmd_hold (sourceinfo_t *si, int parc, char *parv[]) { char *target = parv[0]; char *action = parv[1]; mychan_t *mc; if (!target || !action) { command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "HOLD"); command_fail (si, fault::needmoreparams, _("Usage: HOLD <#channel> ")); return; } if (*target != '#') { command_fail (si, fault::badparams, STR_INVALID_PARAMS, "HOLD"); return; } if (!(mc = mychan_t::find (target))) { command_fail (si, fault::nosuch_target, _("\2%s\2 is not registered."), target); return; } if (!strcasecmp (action, "ON")) { if (mc->flags & MC_HOLD) { command_fail (si, fault::nochange, _("\2%s\2 is already held."), target); return; } mc->flags |= MC_HOLD; wallops ("%s set the HOLD option for the channel \2%s\2.", get_oper_name (si), target); logcommand (si, CMDLOG_ADMIN, "%s HOLD ON", mc->name); command_success_nodata (si, _("\2%s\2 is now held."), target); } else if (!strcasecmp (action, "OFF")) { if (!(mc->flags & MC_HOLD)) { command_fail (si, fault::nochange, _("\2%s\2 is not held."), target); return; } mc->flags &= ~MC_HOLD; wallops ("%s removed the HOLD option on the channel \2%s\2.", get_oper_name (si), target); logcommand (si, CMDLOG_ADMIN, "%s HOLD OFF", mc->name); command_success_nodata (si, _("\2%s\2 is no longer held."), target); } else { command_fail (si, fault::badparams, STR_INVALID_PARAMS, "HOLD"); command_fail (si, fault::badparams, _("Usage: HOLD <#channel> ")); } } /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs * vim:ts=8 * vim:sw=8 * vim:noexpandtab */