1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_close.c: Closes all unregistered connections. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2002 by the past and present ircd coders, and others. |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License as published by |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
* (at your option) any later version. |
11 |
|
|
* |
12 |
|
|
* This program is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with this program; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
|
* USA |
21 |
|
|
* |
22 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
|
|
#include "tools.h" |
27 |
|
|
#include "handlers.h" |
28 |
|
|
#include "client.h" |
29 |
|
|
#include "ircd.h" |
30 |
|
|
#include "numeric.h" |
31 |
|
|
#include "fdlist.h" |
32 |
|
|
#include "s_bsd.h" |
33 |
|
|
#include "send.h" |
34 |
|
|
#include "msg.h" |
35 |
|
|
#include "parse.h" |
36 |
|
|
#include "modules.h" |
37 |
|
|
|
38 |
|
|
static void mo_close(struct Client *, struct Client *, int, char **); |
39 |
|
|
|
40 |
|
|
struct Message close_msgtab = { |
41 |
|
|
"CLOSE", 0, 0, 0, 0, MFLG_SLOW, 0, |
42 |
|
|
{m_unregistered, m_not_oper, m_ignore, m_ignore, mo_close, m_ignore} |
43 |
|
|
}; |
44 |
|
|
#ifndef STATIC_MODULES |
45 |
|
|
void |
46 |
|
|
_modinit(void) |
47 |
|
|
{ |
48 |
|
|
mod_add_cmd(&close_msgtab); |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
void |
52 |
|
|
_moddeinit(void) |
53 |
|
|
{ |
54 |
|
|
mod_del_cmd(&close_msgtab); |
55 |
|
|
} |
56 |
|
|
|
57 |
knight |
31 |
const char *_version = "$Revision$"; |
58 |
adx |
30 |
#endif |
59 |
|
|
|
60 |
|
|
/* |
61 |
|
|
* mo_close - CLOSE message handler |
62 |
|
|
* - added by Darren Reed Jul 13 1992. |
63 |
|
|
*/ |
64 |
|
|
static void |
65 |
|
|
mo_close(struct Client *client_p, struct Client *source_p, |
66 |
|
|
int parc, char *parv[]) |
67 |
|
|
{ |
68 |
|
|
struct Client *target_p; |
69 |
|
|
dlink_node *ptr; |
70 |
|
|
dlink_node *ptr_next; |
71 |
|
|
unsigned int closed = 0; |
72 |
|
|
|
73 |
|
|
DLINK_FOREACH_SAFE(ptr, ptr_next, unknown_list.head) |
74 |
|
|
{ |
75 |
|
|
target_p = ptr->data; |
76 |
|
|
|
77 |
|
|
/* Which list would connecting servers be found in? serv_list ? */ |
78 |
|
|
#if 0 |
79 |
|
|
if (!IsUnknown(target_p) && !IsConnecting(target_p) && |
80 |
|
|
!IsHandshake(target_p) && !IsDoingKauth(target_p)) |
81 |
|
|
continue; |
82 |
|
|
#endif |
83 |
|
|
sendto_one(source_p, form_str(RPL_CLOSING), me.name, parv[0], |
84 |
|
|
get_client_name(target_p, SHOW_IP), target_p->status); |
85 |
|
|
/* exit here is safe, because it is guaranteed not to be source_p |
86 |
|
|
* because it is unregistered and source_p is an oper. |
87 |
|
|
*/ |
88 |
|
|
exit_client(target_p, target_p, "Oper Closing"); |
89 |
|
|
closed++; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
sendto_one(source_p, form_str(RPL_CLOSEEND), |
93 |
|
|
me.name, source_p->name, closed); |
94 |
|
|
} |
95 |
|
|
|