ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/mode.C
Revision: 1.3
Committed: Sat Jul 21 13:23:21 2007 UTC (19 years, 3 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +2 -2 lines
Log Message:
- added rcsid to some files
- more documentation tweaks
- made most protocol commands local to phandler.C
- added ircd metadata (inspircd only for now)
- added inspircd swhois support

File Contents

# User Rev Content
1 pippijn 1.1 /*
2     * Copyright © 2005-2006 William Pitcock, et al.
3 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
4 pippijn 1.1 *
5     * This file contains functionality which implements the OService MODE command.
6     *
7 pippijn 1.3 * $Id: mode.C,v 1.2 2007-07-21 01:29:09 pippijn Exp $
8 pippijn 1.1 */
9    
10     #include "atheme.h"
11    
12 pippijn 1.3 static char const rcsid[] = "$Id$";
13 pippijn 1.1
14     struct os_mode_listeners : callback::has_listeners
15     {
16     };
17    
18     os_mode_listeners listeners;
19    
20     DECLARE_MODULE_V1 ("operserv/mode", false, _modinit, _moddeinit, rcsid, "The Ermyth Team <http://ermyth.schmorp.de>");
21    
22     static void os_cmd_mode (sourceinfo_t *si, int parc, char *parv[]);
23    
24     command_t os_mode = { "MODE", N_("Changes modes on channels."), PRIV_OMODE, 2, os_cmd_mode };
25    
26     cmdvec *os_cmdtree;
27     helpvec *os_helptree;
28    
29     void
30     _modinit (module_t *m)
31     {
32     MODULE_USE_SYMBOL_T (os_cmdtree, cmdvec, "operserv/main", "os_cmdtree");
33     MODULE_USE_SYMBOL_T (os_helptree, helpvec, "operserv/main", "os_helptree");
34    
35     os_cmdtree << os_mode;
36     help_addentry (os_helptree, "MODE", "help/oservice/mode", NULL);
37     }
38    
39     void
40     _moddeinit ()
41     {
42     os_cmdtree >> os_mode;
43     help_delentry (os_helptree, "MODE");
44     }
45    
46     static void
47     os_cmd_mode (sourceinfo_t *si, int parc, char *parv[])
48     {
49     char *channel = parv[0];
50     char *mode = parv[1];
51     channel_t *c;
52     int modeparc;
53     char *modeparv[256];
54    
55     if (!channel || !mode)
56     {
57     command_fail (si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "MODE");
58     command_fail (si, fault_needmoreparams, _("Syntax: MODE <channel> <parameters>"));
59     return;
60     }
61    
62     c = channel_find (channel);
63     if (!c)
64     {
65     command_fail (si, fault_nosuch_target, _("Channel \2%s\2 does not exist."), channel);
66     return;
67     }
68    
69     wallops ("\2%s\2 is using MODE on \2%s\2 (set: \2%s\2)", get_oper_name (si), channel, mode);
70     snoop ("MODE: \2%s\2 \2%s\2 by \2%s\2", channel, mode, get_oper_name (si));
71     logcommand (si, CMDLOG_ADMIN, "MODE %s %s", channel, mode);
72    
73     modeparc = sjtoken (mode, ' ', modeparv);
74    
75     channel_mode (si->service->me, c, modeparc, modeparv);
76     command_success_nodata (si, _("Set modes \2%s\2 on \2%s\2."), mode, channel);
77     }
78    
79     /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
80     * vim:ts=8
81     * vim:sw=8
82     * vim:noexpandtab
83     */