ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.0.x/modules/m_users.c
Revision: 1901
Committed: Sat Apr 27 19:17:36 2013 UTC (13 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 3269 byte(s)
Log Message:
- Backported -r1836 [m_users, show_lusers: removed extranous arguments to sendto_one()]

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_users.c: Gives some basic 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 "client.h"
27 #include "ircd.h"
28 #include "numeric.h"
29 #include "s_serv.h"
30 #include "conf.h"
31 #include "send.h"
32 #include "parse.h"
33 #include "modules.h"
34
35
36 /*
37 * m_users
38 * parv[0] = sender prefix
39 * parv[1] = servername
40 */
41 static void
42 m_users(struct Client *client_p, struct Client *source_p,
43 int parc, char *parv[])
44 {
45 static time_t last_used = 0;
46
47 if (last_used + ConfigFileEntry.pace_wait_simple > CurrentTime)
48 {
49 sendto_one(source_p, form_str(RPL_LOAD2HI),
50 me.name, source_p->name);
51 return;
52 }
53
54 last_used = CurrentTime;
55
56 if (!ConfigFileEntry.disable_remote)
57 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
58 parc, parv) != HUNTED_ISME)
59 return;
60
61 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
62 ConfigServerHide.hide_servers ? Count.total : Count.local,
63 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
64
65 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
66 Count.total, Count.max_tot);
67 }
68
69 /*
70 * mo_users
71 * parv[0] = sender prefix
72 * parv[1] = servername
73 */
74 static void
75 mo_users(struct Client *client_p, struct Client *source_p,
76 int parc, char *parv[])
77 {
78 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
79 parc, parv) != HUNTED_ISME)
80 return;
81
82 if (!HasUMode(source_p, UMODE_OPER) && ConfigServerHide.hide_servers)
83 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
84 Count.total, Count.max_tot);
85 else
86 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
87 Count.local, Count.max_loc);
88
89 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
90 Count.total, Count.max_tot);
91 }
92
93 static struct Message users_msgtab = {
94 "USERS", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
95 { m_unregistered, m_users, mo_users, m_ignore, mo_users, m_ignore }
96 };
97
98 static void
99 module_init(void)
100 {
101 mod_add_cmd(&users_msgtab);
102 }
103
104 static void
105 module_exit(void)
106 {
107 mod_del_cmd(&users_msgtab);
108 }
109
110 struct module module_entry = {
111 .node = { NULL, NULL, NULL },
112 .name = NULL,
113 .version = "$Revision$",
114 .handle = NULL,
115 .modinit = module_init,
116 .modexit = module_exit,
117 .flags = 0
118 };

Properties

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