ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/ircd-hybrid-newconf/modules/m_close.c
Revision: 1027
Committed: Sun Nov 8 13:01:13 2009 UTC (14 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 2827 byte(s)
Log Message:
- Move old 7.3 sources to branches/ircd-hybrid-newconf

File Contents

# Content
1 /*
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 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "handlers.h"
27 #include "client.h"
28 #include "ircd.h"
29 #include "numeric.h"
30 #include "send.h"
31 #include "msg.h"
32 #include "parse.h"
33 #include "conf/modules.h"
34
35 static void mo_close(struct Client *, struct Client *, int, char *[]);
36
37 struct Message close_msgtab = {
38 "CLOSE", 0, 0, 0, 0, MFLG_SLOW, 0,
39 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_close, m_ignore }
40 };
41
42 INIT_MODULE(m_close, "$Revision$")
43 {
44 mod_add_cmd(&close_msgtab);
45 }
46
47 CLEANUP_MODULE
48 {
49 mod_del_cmd(&close_msgtab);
50 }
51
52 /*! \brief CLOSE command handler (called for operators only)
53 *
54 * \param client_p Pointer to allocated Client struct with physical connection
55 * to this server, i.e. with an open socket connected.
56 * \param source_p Pointer to allocated Client struct from which the message
57 * originally comes from. This can be a local or remote client.
58 * \param parc Integer holding the number of supplied arguments.
59 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
60 * pointers.
61 * \note Valid arguments for this command are:
62 * - parv[0] = sender prefix
63 */
64 static void
65 mo_close(struct Client *client_p, struct Client *source_p,
66 int parc, char *parv[])
67 {
68 dlink_node *ptr = NULL, *ptr_next = NULL;
69 unsigned int closed = 0;
70
71 DLINK_FOREACH_SAFE(ptr, ptr_next, unknown_list.head)
72 {
73 struct Client *target_p = ptr->data;
74
75 sendto_one(source_p, form_str(RPL_CLOSING), me.name, source_p->name,
76 get_client_name(target_p, SHOW_IP), target_p->status);
77 /*
78 * exit here is safe, because it is guaranteed not to be source_p
79 * because it is unregistered and source_p is an oper.
80 */
81 exit_client(target_p, target_p, "Oper Closing");
82 ++closed;
83 }
84
85 sendto_one(source_p, form_str(RPL_CLOSEEND),
86 me.name, source_p->name, closed);
87 }

Properties

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