ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_close.c
Revision: 9102
Committed: Wed Jan 1 09:58:57 2020 UTC (6 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 2935 byte(s)
Log Message:
- Bump copyright years everywhere

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2020 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
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 void
48 mo_close(struct Client *source_p, int parc, char *parv[])
49 {
50 dlink_node *node, *node_next;
51 unsigned int closed = dlink_list_length(&unknown_list);
52
53 if (!HasOFlag(source_p, OPER_FLAG_CLOSE))
54 {
55 sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "close");
56 return;
57 }
58
59 DLINK_FOREACH_SAFE(node, node_next, unknown_list.head)
60 {
61 struct Client *target_p = node->data;
62
63 sendto_one_numeric(source_p, &me, RPL_CLOSING,
64 client_get_name(target_p, SHOW_IP),
65 target_p->status);
66
67 /*
68 * Exit here is safe, because it is guaranteed not to be source_p
69 * because it is unregistered and source_p is an oper.
70 */
71 exit_client(target_p, "Oper Closing");
72 }
73
74 sendto_one_numeric(source_p, &me, RPL_CLOSEEND, closed);
75 }
76
77 static struct Message close_msgtab =
78 {
79 .cmd = "CLOSE",
80 .args_max = MAXPARA,
81 .handlers[UNREGISTERED_HANDLER] = m_unregistered,
82 .handlers[CLIENT_HANDLER] = m_not_oper,
83 .handlers[SERVER_HANDLER] = m_ignore,
84 .handlers[ENCAP_HANDLER] = m_ignore,
85 .handlers[OPER_HANDLER] = mo_close
86 };
87
88 static void
89 module_init(void)
90 {
91 mod_add_cmd(&close_msgtab);
92 }
93
94 static void
95 module_exit(void)
96 {
97 mod_del_cmd(&close_msgtab);
98 }
99
100 struct module module_entry =
101 {
102 .version = "$Revision$",
103 .modinit = module_init,
104 .modexit = module_exit,
105 };

Properties

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