ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/modules/m_users.c
Revision: 31
Committed: Sun Oct 2 20:34:05 2005 UTC (18 years, 5 months ago) by knight
Content type: text/x-csrc
File size: 3277 byte(s)
Log Message:
- Fix svn:keywords

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 "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 const char *_version = "$Revision$";
59 #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 if (!ConfigFileEntry.disable_remote)
71 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
72 parc, parv) != HUNTED_ISME)
73 return;
74
75 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
76 ConfigServerHide.hide_servers ? Count.total : Count.local,
77 ConfigServerHide.hide_servers ? Count.total : Count.local,
78 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc,
79 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
80
81 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
82 Count.total, Count.max_tot, Count.total, Count.max_tot);
83 }
84
85 /*
86 * mo_users
87 * parv[0] = sender prefix
88 * parv[1] = servername
89 */
90 static void
91 mo_users(struct Client *client_p, struct Client *source_p,
92 int parc, char *parv[])
93 {
94 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
95 parc, parv) != HUNTED_ISME)
96 return;
97
98 if (!IsOper(source_p) && ConfigServerHide.hide_servers)
99 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
100 Count.total, Count.max_tot, Count.total, Count.max_tot);
101 else
102 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
103 Count.local, Count.max_loc, Count.local, Count.max_loc);
104
105 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
106 Count.total, Count.max_tot, Count.total, Count.max_tot);
107 }

Properties

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