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