ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/core/m_tmode.c
Revision: 6259
Committed: Sat Jul 11 12:18:43 2015 UTC (11 years ago) by michael
Content type: text/x-csrc
File size: 2928 byte(s)
Log Message:
- Set keyword and eol-style properties

File Contents

# User Rev Content
1 michael 3356 /*
2     * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3     *
4 michael 5347 * Copyright (c) 1997-2015 ircd-hybrid development team
5 michael 3356 *
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 michael 3356 * 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 "ircd.h"
34     #include "send.h"
35     #include "parse.h"
36     #include "modules.h"
37    
38    
39 michael 3776 /*! \brief TMODE command handler
40 michael 3356 *
41 michael 3776 * \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 michael 3356 */
52     static int
53     ms_tmode(struct Client *source_p, int parc, char *parv[])
54     {
55     struct Channel *chptr = NULL;
56    
57     if ((chptr = hash_find_channel(parv[2])) == NULL)
58     {
59     sendto_one_numeric(source_p, &me, ERR_NOSUCHCHANNEL, parv[2]);
60     return 0;
61     }
62    
63 michael 4818 if (atol(parv[1]) > chptr->creationtime)
64 michael 3356 return 0;
65    
66     if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE))
67     set_channel_mode(source_p, chptr, NULL, parc - 3, parv + 3);
68     else
69     {
70 michael 3695 struct Membership *member = find_channel_link(source_p, chptr);
71 michael 3356
72     set_channel_mode(source_p, chptr, member, parc - 3, parv + 3);
73     }
74    
75     return 0;
76     }
77    
78     static struct Message tmode_msgtab =
79     {
80 michael 5881 .cmd = "TMODE",
81     .args_min = 4,
82     .args_max = MAXPARA,
83     .handlers[UNREGISTERED_HANDLER] = m_ignore,
84     .handlers[CLIENT_HANDLER] = m_ignore,
85     .handlers[SERVER_HANDLER] = ms_tmode,
86     .handlers[ENCAP_HANDLER] = m_ignore,
87     .handlers[OPER_HANDLER] = m_ignore
88 michael 3356 };
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 michael 3357 .version = "$Revision$",
105 michael 3356 .modinit = module_init,
106     .modexit = module_exit,
107     .flags = MODULE_FLAG_CORE
108     };

Properties

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