ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/core/m_quit.c
Revision: 2820
Committed: Wed Jan 15 23:10:26 2014 UTC (11 years, 7 months ago) by michael
Content type: text/x-csrc
File size: 2567 byte(s)
Log Message:
- Clean up all files in modules/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years
- Made module handlers int type for later use

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 1997-2014 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     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19     * 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 "s_serv.h"
32     #include "send.h"
33     #include "parse.h"
34     #include "modules.h"
35 michael 1309 #include "conf.h"
36 adx 30
37    
38     /*
39     ** m_quit
40     ** parv[0] = sender prefix
41     ** parv[1] = comment
42     */
43 michael 2820 static int
44 adx 30 m_quit(struct Client *client_p, struct Client *source_p,
45     int parc, char *parv[])
46     {
47     char reason[KICKLEN + 1] = "Quit: ";
48    
49 michael 1889 if (!EmptyString(parv[1]) && (HasUMode(source_p, UMODE_OPER) ||
50 michael 1241 (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
51 adx 30 < CurrentTime))
52 michael 1889 strlcpy(reason + 6, parv[1], sizeof(reason) - 6);
53 adx 30
54     exit_client(source_p, source_p, reason);
55 michael 2820 return 0;
56 adx 30 }
57    
58     /*
59     ** ms_quit
60     ** parv[0] = sender prefix
61     ** parv[1] = comment
62     */
63 michael 2820 static int
64 adx 30 ms_quit(struct Client *client_p, struct Client *source_p,
65     int parc, char *parv[])
66     {
67 michael 1889 char reason[KICKLEN + 1] = { '\0' };
68 adx 30
69 michael 1889 if (!EmptyString(parv[1]))
70     strlcpy(reason, parv[1], sizeof(reason));
71     else
72     strlcpy(reason, client_p->name, sizeof(reason));
73 adx 30
74 michael 1889 exit_client(source_p, source_p, reason);
75 michael 2820 return 0;
76 adx 30 }
77 michael 1230
78 michael 2820 static struct Message quit_msgtab =
79     {
80 michael 1569 "QUIT", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
81 michael 2820 { m_quit, m_quit, ms_quit, m_ignore, m_quit, m_ignore }
82 michael 1230 };
83    
84     static void
85     module_init(void)
86     {
87     mod_add_cmd(&quit_msgtab);
88     }
89    
90     static void
91     module_exit(void)
92     {
93     mod_del_cmd(&quit_msgtab);
94     }
95    
96 michael 2820 struct module module_entry =
97     {
98 michael 1230 .node = { NULL, NULL, NULL },
99     .name = NULL,
100     .version = "$Revision$",
101     .handle = NULL,
102     .modinit = module_init,
103     .modexit = module_exit,
104     .flags = MODULE_FLAG_CORE
105     };

Properties

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