19 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
* USA |
21 |
|
* |
22 |
< |
* $Id: m_close.c,v 1.29 2005/07/30 20:44:14 adx Exp $ |
22 |
> |
* $Id$ |
23 |
|
*/ |
24 |
|
|
25 |
|
#include "stdinc.h" |
26 |
< |
#include "tools.h" |
27 |
< |
#include "handlers.h" |
26 |
> |
#include "list.h" |
27 |
|
#include "client.h" |
28 |
|
#include "ircd.h" |
29 |
|
#include "numeric.h" |
31 |
– |
#include "fdlist.h" |
32 |
– |
#include "s_bsd.h" |
30 |
|
#include "send.h" |
34 |
– |
#include "msg.h" |
31 |
|
#include "parse.h" |
32 |
|
#include "modules.h" |
33 |
|
|
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 |
– |
const char *_version = "$Revision: 1.29 $"; |
58 |
– |
#endif |
34 |
|
|
35 |
|
/* |
36 |
|
* mo_close - CLOSE message handler |
40 |
|
mo_close(struct Client *client_p, struct Client *source_p, |
41 |
|
int parc, char *parv[]) |
42 |
|
{ |
43 |
< |
struct Client *target_p; |
44 |
< |
dlink_node *ptr; |
45 |
< |
dlink_node *ptr_next; |
71 |
< |
unsigned int closed = 0; |
43 |
> |
dlink_node *ptr = NULL, *ptr_next = NULL; |
44 |
> |
unsigned int closed = dlink_list_length(&unknown_list); |
45 |
> |
|
46 |
|
|
47 |
|
DLINK_FOREACH_SAFE(ptr, ptr_next, unknown_list.head) |
48 |
|
{ |
49 |
< |
target_p = ptr->data; |
49 |
> |
struct Client *target_p = ptr->data; |
50 |
|
|
51 |
< |
/* 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], |
51 |
> |
sendto_one(source_p, RPL_CLOSING, me.name, source_p->name, |
52 |
|
get_client_name(target_p, SHOW_IP), target_p->status); |
53 |
< |
/* exit here is safe, because it is guaranteed not to be source_p |
53 |
> |
|
54 |
> |
/* |
55 |
> |
* exit here is safe, because it is guaranteed not to be source_p |
56 |
|
* because it is unregistered and source_p is an oper. |
57 |
|
*/ |
58 |
|
exit_client(target_p, target_p, "Oper Closing"); |
89 |
– |
closed++; |
59 |
|
} |
60 |
|
|
61 |
< |
sendto_one(source_p, form_str(RPL_CLOSEEND), |
61 |
> |
sendto_one(source_p, RPL_CLOSEEND, |
62 |
|
me.name, source_p->name, closed); |
63 |
|
} |
64 |
|
|
65 |
+ |
static struct Message close_msgtab = { |
66 |
+ |
"CLOSE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
67 |
+ |
{ m_unregistered, m_not_oper, m_ignore, m_ignore, mo_close, m_ignore } |
68 |
+ |
}; |
69 |
+ |
|
70 |
+ |
static void |
71 |
+ |
module_init(void) |
72 |
+ |
{ |
73 |
+ |
mod_add_cmd(&close_msgtab); |
74 |
+ |
} |
75 |
+ |
|
76 |
+ |
static void |
77 |
+ |
module_exit(void) |
78 |
+ |
{ |
79 |
+ |
mod_del_cmd(&close_msgtab); |
80 |
+ |
} |
81 |
+ |
|
82 |
+ |
struct module module_entry = { |
83 |
+ |
.node = { NULL, NULL, NULL }, |
84 |
+ |
.name = NULL, |
85 |
+ |
.version = "$Revision$", |
86 |
+ |
.handle = NULL, |
87 |
+ |
.modinit = module_init, |
88 |
+ |
.modexit = module_exit, |
89 |
+ |
.flags = 0 |
90 |
+ |
}; |