ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_users.c
Revision: 1309
Committed: Sun Mar 25 11:24:18 2012 UTC (13 years, 5 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/m_users.c
File size: 3529 byte(s)
Log Message:
- renaming files:

  ircd_parser.y -> conf_parser.y
  ircd_lexer.l  -> conf_lexer.l
  s_conf.c      -> conf.c
  s_conf.h      -> conf.h
  s_log.c       -> log.c
  s_log.h       -> log.h

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 ConfigServerHide.hide_servers ? Count.total : Count.local,
65 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
66
67 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
68 Count.total, Count.max_tot, Count.total, Count.max_tot);
69 }
70
71 /*
72 * mo_users
73 * parv[0] = sender prefix
74 * parv[1] = servername
75 */
76 static void
77 mo_users(struct Client *client_p, struct Client *source_p,
78 int parc, char *parv[])
79 {
80 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
81 parc, parv) != HUNTED_ISME)
82 return;
83
84 if (!HasUMode(source_p, UMODE_OPER) && ConfigServerHide.hide_servers)
85 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
86 Count.total, Count.max_tot, Count.total, Count.max_tot);
87 else
88 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
89 Count.local, Count.max_loc, Count.local, Count.max_loc);
90
91 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
92 Count.total, Count.max_tot, Count.total, Count.max_tot);
93 }
94
95 static struct Message users_msgtab = {
96 "USERS", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
97 { m_unregistered, m_users, mo_users, m_ignore, mo_users, m_ignore }
98 };
99
100 static void
101 module_init(void)
102 {
103 mod_add_cmd(&users_msgtab);
104 }
105
106 static void
107 module_exit(void)
108 {
109 mod_del_cmd(&users_msgtab);
110 }
111
112 struct module module_entry = {
113 .node = { NULL, NULL, NULL },
114 .name = NULL,
115 .version = "$Revision$",
116 .handle = NULL,
117 .modinit = module_init,
118 .modexit = module_exit,
119 .flags = 0
120 };

Properties

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