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

Annotation of /ircd-hybrid/branches/8.2.x/modules/core/m_quit.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8280 - (hide annotations)
Tue Feb 20 19:30:33 2018 UTC (4 years, 11 months ago) by michael
File MIME type: text/x-chdr
File size: 3272 byte(s)
- Update copyright years

1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 8280 * Copyright (c) 1997-2018 ircd-hybrid development team
5 adx 30 *
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 4564 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2820 /*! \file m_quit.c
23     * \brief Includes required functions for processing the QUIT command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28     #include "client.h"
29     #include "ircd.h"
30     #include "irc_string.h"
31     #include "send.h"
32     #include "parse.h"
33     #include "modules.h"
34 michael 1309 #include "conf.h"
35 adx 30
36    
37 michael 3266 /*! \brief QUIT command handler
38     *
39     * \param source_p Pointer to allocated Client struct from which the message
40     * originally comes from. This can be a local or remote client.
41     * \param parc Integer holding the number of supplied arguments.
42     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
43     * pointers.
44     * \note Valid arguments for this command are:
45     * - parv[0] = command
46     * - parv[1] = quit message
47     */
48 michael 2820 static int
49 michael 3156 m_quit(struct Client *source_p, int parc, char *parv[])
50 adx 30 {
51     char reason[KICKLEN + 1] = "Quit: ";
52    
53 michael 1889 if (!EmptyString(parv[1]) && (HasUMode(source_p, UMODE_OPER) ||
54 michael 4589 (source_p->connection->firsttime + ConfigGeneral.anti_spam_exit_message_time)
55 adx 30 < CurrentTime))
56 michael 1889 strlcpy(reason + 6, parv[1], sizeof(reason) - 6);
57 adx 30
58 michael 3171 exit_client(source_p, reason);
59 michael 2820 return 0;
60 adx 30 }
61    
62 michael 3266 /*! \brief QUIT command handler
63     *
64     * \param source_p Pointer to allocated Client struct from which the message
65     * originally comes from. This can be a local or remote client.
66     * \param parc Integer holding the number of supplied arguments.
67     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
68     * pointers.
69     * \note Valid arguments for this command are:
70     * - parv[0] = command
71     * - parv[1] = quit message
72     */
73 michael 2820 static int
74 michael 3156 ms_quit(struct Client *source_p, int parc, char *parv[])
75 adx 30 {
76 michael 3302 char reason[KICKLEN + 1] = "";
77 adx 30
78 michael 1889 if (!EmptyString(parv[1]))
79     strlcpy(reason, parv[1], sizeof(reason));
80 adx 30
81 michael 3171 exit_client(source_p, reason);
82 michael 2820 return 0;
83 adx 30 }
84 michael 1230
85 michael 2820 static struct Message quit_msgtab =
86     {
87 michael 5880 .cmd = "QUIT",
88     .args_max = MAXPARA,
89     .handlers[UNREGISTERED_HANDLER] = m_quit,
90     .handlers[CLIENT_HANDLER] = m_quit,
91     .handlers[SERVER_HANDLER] = ms_quit,
92     .handlers[ENCAP_HANDLER] = m_ignore,
93     .handlers[OPER_HANDLER] = m_quit
94 michael 1230 };
95    
96     static void
97     module_init(void)
98     {
99     mod_add_cmd(&quit_msgtab);
100     }
101    
102     static void
103     module_exit(void)
104     {
105     mod_del_cmd(&quit_msgtab);
106     }
107    
108 michael 2820 struct module module_entry =
109     {
110 michael 1230 .version = "$Revision$",
111     .modinit = module_init,
112     .modexit = module_exit,
113     .flags = MODULE_FLAG_CORE
114     };

Properties

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

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