2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* m_users.c: Gives some basic user statistics.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
|
|
|
* Copyright (C) 2002-2005 ircd-ratbox development team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA
|
|
|
|
*/
|
|
|
|
|
2016-07-01 05:04:00 +02:00
|
|
|
#include <ircd/stdinc.h>
|
|
|
|
#include <ircd/client.h>
|
|
|
|
#include <ircd/ircd.h>
|
|
|
|
#include <ircd/numeric.h>
|
|
|
|
#include <ircd/s_serv.h>
|
|
|
|
#include <ircd/s_conf.h>
|
|
|
|
#include <ircd/send.h>
|
|
|
|
#include <ircd/msg.h>
|
|
|
|
#include <ircd/parse.h>
|
|
|
|
#include <ircd/modules.h>
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-07 09:43:11 +01:00
|
|
|
static const char users_desc[] =
|
|
|
|
"Provides the USERS command to display connection statistics locally and globally";
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void m_users(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
2016-03-09 08:29:41 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
struct Message users_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"USERS", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_unreg, {m_users, 0}, {m_users, 0}, mg_ignore, mg_ignore, {m_users, 0}}
|
|
|
|
};
|
|
|
|
|
|
|
|
mapi_clist_av1 users_clist[] = { &users_msgtab, NULL };
|
2016-03-09 08:29:41 +01:00
|
|
|
|
2016-03-07 09:43:11 +01:00
|
|
|
DECLARE_MODULE_AV2(users, NULL, NULL, users_clist, NULL, NULL, NULL, NULL, users_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* m_users
|
|
|
|
* parv[1] = servername
|
|
|
|
*/
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-02-11 03:54:17 +01:00
|
|
|
m_users(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
if(hunt_server(client_p, source_p, ":%s USERS :%s", 1, parc, parv) == HUNTED_ISME)
|
|
|
|
{
|
|
|
|
sendto_one_numeric(source_p, RPL_LOCALUSERS,
|
|
|
|
form_str(RPL_LOCALUSERS),
|
2011-11-13 00:22:09 +01:00
|
|
|
(int)rb_dlink_list_length(&lclient_list),
|
2007-01-25 07:40:21 +01:00
|
|
|
Count.max_loc,
|
2011-11-13 00:22:09 +01:00
|
|
|
(int)rb_dlink_list_length(&lclient_list),
|
2007-01-25 07:40:21 +01:00
|
|
|
Count.max_loc);
|
|
|
|
|
2014-03-03 05:25:47 +01:00
|
|
|
sendto_one_numeric(source_p, RPL_GLOBALUSERS,
|
2007-01-25 07:40:21 +01:00
|
|
|
form_str(RPL_GLOBALUSERS),
|
|
|
|
Count.total, Count.max_tot,
|
|
|
|
Count.total, Count.max_tot);
|
|
|
|
}
|
|
|
|
}
|