1 |
michael |
3356 |
/* |
2 |
|
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
|
* |
4 |
|
|
* Copyright (c) 1997-2014 ircd-hybrid development team |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
|
* USA |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
/*! \file m_tmode.c |
23 |
|
|
* \brief Includes required functions for processing the TMODE command. |
24 |
michael |
3357 |
* \version $Id$ |
25 |
michael |
3356 |
*/ |
26 |
|
|
|
27 |
|
|
#include "stdinc.h" |
28 |
|
|
#include "list.h" |
29 |
|
|
#include "channel.h" |
30 |
|
|
#include "channel_mode.h" |
31 |
|
|
#include "client.h" |
32 |
|
|
#include "hash.h" |
33 |
|
|
#include "irc_string.h" |
34 |
|
|
#include "ircd.h" |
35 |
|
|
#include "numeric.h" |
36 |
|
|
#include "user.h" |
37 |
|
|
#include "conf.h" |
38 |
|
|
#include "server.h" |
39 |
|
|
#include "send.h" |
40 |
|
|
#include "parse.h" |
41 |
|
|
#include "modules.h" |
42 |
|
|
#include "packet.h" |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
/* |
46 |
|
|
* ms_tmode() |
47 |
|
|
* |
48 |
|
|
* inputs - parv[0] = command |
49 |
|
|
* parv[1] = TS |
50 |
|
|
* parv[2] = channel name |
51 |
|
|
* parv[3] = modestring |
52 |
|
|
*/ |
53 |
|
|
static int |
54 |
|
|
ms_tmode(struct Client *source_p, int parc, char *parv[]) |
55 |
|
|
{ |
56 |
|
|
struct Channel *chptr = NULL; |
57 |
|
|
struct Membership *member = NULL; |
58 |
|
|
|
59 |
|
|
if ((chptr = hash_find_channel(parv[2])) == NULL) |
60 |
|
|
{ |
61 |
|
|
sendto_one_numeric(source_p, &me, ERR_NOSUCHCHANNEL, parv[2]); |
62 |
|
|
return 0; |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
if (atol(parv[1]) > chptr->channelts) |
66 |
|
|
return 0; |
67 |
|
|
|
68 |
|
|
if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE)) |
69 |
|
|
set_channel_mode(source_p, chptr, NULL, parc - 3, parv + 3); |
70 |
|
|
else |
71 |
|
|
{ |
72 |
|
|
member = find_channel_link(source_p, chptr); |
73 |
|
|
|
74 |
|
|
/* XXX are we sure we just want to bail here? */ |
75 |
|
|
if (has_member_flags(member, CHFL_DEOPPED)) |
76 |
|
|
return 0; |
77 |
|
|
|
78 |
|
|
set_channel_mode(source_p, chptr, member, parc - 3, parv + 3); |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
return 0; |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
static struct Message tmode_msgtab = |
85 |
|
|
{ |
86 |
|
|
"TMODE", 0, 0, 4, MAXPARA, MFLG_SLOW, 0, |
87 |
|
|
{ m_ignore, m_ignore, ms_tmode, m_ignore, m_ignore, m_ignore } |
88 |
|
|
}; |
89 |
|
|
|
90 |
|
|
static void |
91 |
|
|
module_init(void) |
92 |
|
|
{ |
93 |
|
|
mod_add_cmd(&tmode_msgtab); |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
static void |
97 |
|
|
module_exit(void) |
98 |
|
|
{ |
99 |
|
|
mod_del_cmd(&tmode_msgtab); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
struct module module_entry = |
103 |
|
|
{ |
104 |
|
|
.node = { NULL, NULL, NULL }, |
105 |
|
|
.name = NULL, |
106 |
michael |
3357 |
.version = "$Revision$", |
107 |
michael |
3356 |
.handle = NULL, |
108 |
|
|
.modinit = module_init, |
109 |
|
|
.modexit = module_exit, |
110 |
|
|
.flags = MODULE_FLAG_CORE |
111 |
|
|
}; |