/** * mode.C: This file contains functionality which implements the OperServ MODE command. * * 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: mode.C,v 1.9 2007/09/22 14:27:28 pippijn Exp $ */ #include "atheme.h" #include static char const rcsid[] = "$Id: mode.C,v 1.9 2007/09/22 14:27:28 pippijn Exp $"; REGISTER_MODULE ("operserv/mode", false, "The Ermyth Team "); static void os_cmd_mode (sourceinfo_t *si, int parc, char *parv[]); command_t const os_mode = { "MODE", N_("Changes modes on channels."), PRIV_OMODE, 2, os_cmd_mode }; E cmdvec os_cmdtree; E helpvec os_helptree; bool _modinit (module *m) { os_cmdtree << os_mode; help_addentry (os_helptree, "MODE", "help/operserv/mode", NULL); return true; } void _moddeinit () { os_cmdtree >> os_mode; help_delentry (os_helptree, "MODE"); } static void os_cmd_mode (sourceinfo_t *si, int parc, char *parv[]) { char *channel = parv[0]; char *mode = parv[1]; channel_t *c; int modeparc; char *modeparv[256]; if (!channel || !mode) { command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "MODE"); command_fail (si, fault::needmoreparams, _("Syntax: MODE ")); return; } c = channel_find (channel); if (!c) { command_fail (si, fault::nosuch_target, _("Channel \2%s\2 does not exist."), channel); return; } wallops ("\2%s\2 is using MODE on \2%s\2 (set: \2%s\2)", get_oper_name (si), channel, mode); snoop ("MODE: \2%s\2 \2%s\2 by \2%s\2", channel, mode, get_oper_name (si)); logcommand (si, CMDLOG_ADMIN, "MODE %s %s", channel, mode); modeparc = sjtoken (mode, ' ', modeparv); channel_mode (si->service->me, c, modeparc, modeparv); command_success_nodata (si, _("Set modes \2%s\2 on \2%s\2."), mode, channel); }