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: 1029
Committed: Sun Nov 8 13:10:50 2009 UTC (15 years, 9 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-7.3/modules/m_users.c
File size: 3517 byte(s)
Log Message:
- branch off trunk to create 7.3 branch

File Contents

# User Rev Content
1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
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"
31     #include "s_conf.h"
32     #include "send.h"
33     #include "msg.h"
34     #include "parse.h"
35     #include "modules.h"
36    
37     static void m_users(struct Client *, struct Client *, int, char *[]);
38     static void mo_users(struct Client *, struct Client *, int, char *[]);
39    
40     struct Message users_msgtab = {
41     "USERS", 0, 0, 0, 0, MFLG_SLOW, 0,
42     { m_unregistered, m_users, mo_users, m_ignore, mo_users, m_ignore }
43     };
44    
45     #ifndef STATIC_MODULES
46     void
47     _modinit(void)
48     {
49     mod_add_cmd(&users_msgtab);
50     }
51    
52     void
53     _moddeinit(void)
54     {
55     mod_del_cmd(&users_msgtab);
56     }
57    
58 knight 31 const char *_version = "$Revision$";
59 adx 30 #endif
60    
61     /*
62     * m_users
63     * parv[0] = sender prefix
64     * parv[1] = servername
65     */
66     static void
67     m_users(struct Client *client_p, struct Client *source_p,
68     int parc, char *parv[])
69     {
70 adx 269 static time_t last_used = 0;
71    
72     if (last_used + ConfigFileEntry.pace_wait_simple > CurrentTime)
73     {
74     sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name);
75     return;
76     }
77    
78 michael 435 last_used = CurrentTime;
79    
80 adx 30 if (!ConfigFileEntry.disable_remote)
81     if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
82     parc, parv) != HUNTED_ISME)
83     return;
84    
85     sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
86     ConfigServerHide.hide_servers ? Count.total : Count.local,
87 michael 435 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc,
88 adx 30 ConfigServerHide.hide_servers ? Count.total : Count.local,
89 adx 268 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
90 adx 30
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     /*
96     * mo_users
97     * parv[0] = sender prefix
98     * parv[1] = servername
99     */
100     static void
101     mo_users(struct Client *client_p, struct Client *source_p,
102     int parc, char *parv[])
103     {
104     if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
105 michael 435 parc, parv) != HUNTED_ISME)
106 adx 30 return;
107    
108     if (!IsOper(source_p) && ConfigServerHide.hide_servers)
109     sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
110     Count.total, Count.max_tot, Count.total, Count.max_tot);
111     else
112     sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
113     Count.local, Count.max_loc, Count.local, Count.max_loc);
114    
115     sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
116     Count.total, Count.max_tot, Count.total, Count.max_tot);
117     }

Properties

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