ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_lusers.c
Revision: 1230
Committed: Thu Sep 22 19:41:19 2011 UTC (13 years, 11 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/m_lusers.c
File size: 3042 byte(s)
Log Message:
- cleanup module loader. Make module api more flexible

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_lusers.c: Sends user statistics.
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 "s_serv.h" /* hunt_server */
31 #include "s_user.h" /* show_lusers */
32 #include "send.h"
33 #include "s_conf.h"
34 #include "msg.h"
35 #include "parse.h"
36 #include "modules.h"
37
38
39 /* m_lusers - LUSERS message handler
40 * parv[0] = sender
41 * parv[1] = host/server mask.
42 * parv[2] = server to query
43 *
44 * 199970918 JRL hacked to ignore parv[1] completely and require parc > 3
45 * to cause a force
46 *
47 * 2003 hacked parv[1] back in, by request of efnet admins/opers -Dianora
48 */
49 static void
50 m_lusers(struct Client *client_p, struct Client *source_p,
51 int parc, char *parv[])
52 {
53 static time_t last_used = 0;
54
55 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
56 {
57 /* safe enough to give this on a local connect only */
58 sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name);
59 return;
60 }
61
62 last_used = CurrentTime;
63
64 if (parc > 2 && !ConfigFileEntry.disable_remote)
65 if (hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2,
66 parc, parv) != HUNTED_ISME)
67 return;
68
69 show_lusers(source_p);
70 }
71
72 /* ms_lusers - LUSERS message handler for servers and opers
73 * parv[0] = sender
74 * parv[1] = host/server mask.
75 * parv[2] = server to query
76 */
77 static void
78 ms_lusers(struct Client *client_p, struct Client *source_p,
79 int parc, char *parv[])
80 {
81 if (parc > 2)
82 if (hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2,
83 parc, parv) != HUNTED_ISME)
84 return;
85
86 if (IsClient(source_p))
87 show_lusers(source_p);
88 }
89
90 static struct Message lusers_msgtab = {
91 "LUSERS", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
92 {m_unregistered, m_lusers, ms_lusers, m_ignore, ms_lusers, m_ignore}
93 };
94
95 static void
96 module_init(void)
97 {
98 mod_add_cmd(&lusers_msgtab);
99 }
100
101 static void
102 module_exit(void)
103 {
104 mod_del_cmd(&lusers_msgtab);
105 }
106
107 struct module module_entry = {
108 .node = { NULL, NULL, NULL },
109 .name = NULL,
110 .version = "$Revision$",
111 .handle = NULL,
112 .modinit = module_init,
113 .modexit = module_exit,
114 .flags = 0
115 };

Properties

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