/[svn]/ircd-hybrid/branches/8.2.x/modules/core/m_tmode.c
ViewVC logotype

Contents of /ircd-hybrid/branches/8.2.x/modules/core/m_tmode.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8430 - (show annotations)
Tue Mar 27 18:48:40 2018 UTC (4 years, 8 months ago) by michael
File MIME type: text/x-chdr
File size: 2752 byte(s)
- Stylistic changes

1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2018 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file m_tmode.c
23 * \brief Includes required functions for processing the TMODE command.
24 * \version $Id$
25 */
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 "ircd.h"
34 #include "send.h"
35 #include "parse.h"
36 #include "modules.h"
37
38
39 /*! \brief TMODE command handler
40 *
41 * \param source_p Pointer to allocated Client struct from which the message
42 * originally comes from. This can be a local or remote client.
43 * \param parc Integer holding the number of supplied arguments.
44 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
45 * pointers.
46 * \note Valid arguments for this command are:
47 * - parv[0] = command
48 * - parv[1] = timestamp
49 * - parv[2] = channel name
50 * - parv[3] = modes to be added or removed
51 */
52 static int
53 ms_tmode(struct Client *source_p, int parc, char *parv[])
54 {
55 struct Channel *chptr;
56
57 assert(!MyClient(source_p));
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 (strtoumax(parv[1], NULL, 10) > chptr->creationtime)
66 return 0;
67
68 channel_mode_set(source_p, chptr, NULL, parc - 3, parv + 3);
69 return 0;
70 }
71
72 static struct Message tmode_msgtab =
73 {
74 .cmd = "TMODE",
75 .args_min = 4,
76 .args_max = MAXPARA,
77 .handlers[UNREGISTERED_HANDLER] = m_ignore,
78 .handlers[CLIENT_HANDLER] = m_ignore,
79 .handlers[SERVER_HANDLER] = ms_tmode,
80 .handlers[ENCAP_HANDLER] = m_ignore,
81 .handlers[OPER_HANDLER] = m_ignore
82 };
83
84 static void
85 module_init(void)
86 {
87 mod_add_cmd(&tmode_msgtab);
88 }
89
90 static void
91 module_exit(void)
92 {
93 mod_del_cmd(&tmode_msgtab);
94 }
95
96 struct module module_entry =
97 {
98 .version = "$Revision$",
99 .modinit = module_init,
100 .modexit = module_exit,
101 .flags = MODULE_FLAG_CORE
102 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28