ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_users.c
Revision: 1243
Committed: Fri Sep 30 10:47:53 2011 UTC (14 years, 9 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/m_users.c
File size: 3531 byte(s)
Log Message:
- move content of msg.h, ircd_handler.h and handlers.h into parse.h and
  remove headers accordingly
- killed common.h
- remove m_killhost.c and m_flags.c from contrib/
- sort out unused header includes here and there

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 "client.h"
27     #include "ircd.h"
28     #include "numeric.h"
29     #include "s_serv.h"
30     #include "s_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 adx 269 static time_t last_used = 0;
46    
47     if (last_used + ConfigFileEntry.pace_wait_simple > CurrentTime)
48     {
49 michael 1121 sendto_one(source_p, form_str(RPL_LOAD2HI),
50     me.name, source_p->name);
51 adx 269 return;
52     }
53    
54 michael 435 last_used = CurrentTime;
55    
56 adx 30 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 michael 435 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc,
64 adx 30 ConfigServerHide.hide_servers ? Count.total : Count.local,
65 adx 268 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
66 adx 30
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 michael 435 parc, parv) != HUNTED_ISME)
82 adx 30 return;
83    
84 michael 1219 if (!HasUMode(source_p, UMODE_OPER) && ConfigServerHide.hide_servers)
85 adx 30 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 michael 1230
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