ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_close.c
Revision: 3266
Committed: Sat Apr 5 19:15:11 2014 UTC (11 years, 4 months ago) by michael
Content type: text/x-csrc
File size: 2779 byte(s)
Log Message:
- Worked towards improving documentation

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 ircd-hybrid development team
5 *
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 /*! \file m_close.c
23 * \brief Includes required functions for processing the CLOSE command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "client.h"
30 #include "ircd.h"
31 #include "numeric.h"
32 #include "send.h"
33 #include "parse.h"
34 #include "modules.h"
35
36
37 /*! \brief CLOSE command handler
38 *
39 * \param source_p Pointer to allocated Client struct from which the message
40 * originally comes from. This can be a local or remote client.
41 * \param parc Integer holding the number of supplied arguments.
42 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
43 * pointers.
44 * \note Valid arguments for this command are:
45 * - parv[0] = command
46 */
47 static int
48 mo_close(struct Client *source_p, int parc, char *parv[])
49 {
50 dlink_node *ptr = NULL, *ptr_next = NULL;
51 unsigned int closed = dlink_list_length(&unknown_list);
52
53
54 DLINK_FOREACH_SAFE(ptr, ptr_next, unknown_list.head)
55 {
56 struct Client *target_p = ptr->data;
57
58 sendto_one_numeric(source_p, &me, RPL_CLOSING,
59 get_client_name(target_p, SHOW_IP),
60 target_p->status);
61
62 /*
63 * Exit here is safe, because it is guaranteed not to be source_p
64 * because it is unregistered and source_p is an oper.
65 */
66 exit_client(target_p, "Oper Closing");
67 }
68
69 sendto_one_numeric(source_p, &me, RPL_CLOSEEND, closed);
70 return 0;
71 }
72
73 static struct Message close_msgtab =
74 {
75 "CLOSE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
76 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_close, m_ignore }
77 };
78
79 static void
80 module_init(void)
81 {
82 mod_add_cmd(&close_msgtab);
83 }
84
85 static void
86 module_exit(void)
87 {
88 mod_del_cmd(&close_msgtab);
89 }
90
91 struct module module_entry =
92 {
93 .node = { NULL, NULL, NULL },
94 .name = NULL,
95 .version = "$Revision$",
96 .handle = NULL,
97 .modinit = module_init,
98 .modexit = module_exit,
99 .flags = 0
100 };

Properties

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