ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/modules/m_users.c
Revision: 1155
Committed: Tue Aug 9 20:27:45 2011 UTC (14 years, 11 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid/modules/m_users.c
File size: 3502 byte(s)
Log Message:
- recreate "trunk"

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     void
46     _modinit(void)
47     {
48     mod_add_cmd(&users_msgtab);
49     }
50    
51     void
52     _moddeinit(void)
53     {
54     mod_del_cmd(&users_msgtab);
55     }
56    
57 knight 31 const char *_version = "$Revision$";
58 adx 30
59     /*
60     * m_users
61     * parv[0] = sender prefix
62     * parv[1] = servername
63     */
64     static void
65     m_users(struct Client *client_p, struct Client *source_p,
66     int parc, char *parv[])
67     {
68 adx 269 static time_t last_used = 0;
69    
70     if (last_used + ConfigFileEntry.pace_wait_simple > CurrentTime)
71     {
72 michael 1121 sendto_one(source_p, form_str(RPL_LOAD2HI),
73     me.name, source_p->name);
74 adx 269 return;
75     }
76    
77 michael 435 last_used = CurrentTime;
78    
79 adx 30 if (!ConfigFileEntry.disable_remote)
80     if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
81     parc, parv) != HUNTED_ISME)
82     return;
83    
84     sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
85     ConfigServerHide.hide_servers ? Count.total : Count.local,
86 michael 435 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc,
87 adx 30 ConfigServerHide.hide_servers ? Count.total : Count.local,
88 adx 268 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
89 adx 30
90     sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
91     Count.total, Count.max_tot, Count.total, Count.max_tot);
92     }
93    
94     /*
95     * mo_users
96     * parv[0] = sender prefix
97     * parv[1] = servername
98     */
99     static void
100     mo_users(struct Client *client_p, struct Client *source_p,
101     int parc, char *parv[])
102     {
103     if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
104 michael 435 parc, parv) != HUNTED_ISME)
105 adx 30 return;
106    
107     if (!IsOper(source_p) && ConfigServerHide.hide_servers)
108     sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
109     Count.total, Count.max_tot, Count.total, Count.max_tot);
110     else
111     sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
112     Count.local, Count.max_loc, Count.local, Count.max_loc);
113    
114     sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
115     Count.total, Count.max_tot, Count.total, Count.max_tot);
116     }

Properties

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