| 1 |
adx |
30 |
/* |
| 2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
|
|
* m_lusers.c: Sends 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" /* hunt_server */ |
| 30 |
|
|
#include "s_user.h" /* show_lusers */ |
| 31 |
|
|
#include "send.h" |
| 32 |
|
|
#include "s_conf.h" |
| 33 |
|
|
#include "parse.h" |
| 34 |
|
|
#include "modules.h" |
| 35 |
|
|
|
| 36 |
|
|
|
| 37 |
|
|
/* m_lusers - LUSERS message handler |
| 38 |
|
|
* parv[0] = sender |
| 39 |
|
|
* parv[1] = host/server mask. |
| 40 |
|
|
* parv[2] = server to query |
| 41 |
|
|
* |
| 42 |
|
|
* 199970918 JRL hacked to ignore parv[1] completely and require parc > 3 |
| 43 |
|
|
* to cause a force |
| 44 |
|
|
* |
| 45 |
|
|
* 2003 hacked parv[1] back in, by request of efnet admins/opers -Dianora |
| 46 |
|
|
*/ |
| 47 |
|
|
static void |
| 48 |
|
|
m_lusers(struct Client *client_p, struct Client *source_p, |
| 49 |
michael |
980 |
int parc, char *parv[]) |
| 50 |
adx |
30 |
{ |
| 51 |
|
|
static time_t last_used = 0; |
| 52 |
|
|
|
| 53 |
adx |
269 |
if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime) |
| 54 |
adx |
30 |
{ |
| 55 |
|
|
/* safe enough to give this on a local connect only */ |
| 56 |
michael |
1230 |
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name); |
| 57 |
adx |
30 |
return; |
| 58 |
|
|
} |
| 59 |
|
|
|
| 60 |
michael |
980 |
last_used = CurrentTime; |
| 61 |
|
|
|
| 62 |
adx |
30 |
if (parc > 2 && !ConfigFileEntry.disable_remote) |
| 63 |
michael |
980 |
if (hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2, |
| 64 |
|
|
parc, parv) != HUNTED_ISME) |
| 65 |
adx |
30 |
return; |
| 66 |
|
|
|
| 67 |
|
|
show_lusers(source_p); |
| 68 |
|
|
} |
| 69 |
|
|
|
| 70 |
|
|
/* ms_lusers - LUSERS message handler for servers and opers |
| 71 |
|
|
* parv[0] = sender |
| 72 |
|
|
* parv[1] = host/server mask. |
| 73 |
|
|
* parv[2] = server to query |
| 74 |
|
|
*/ |
| 75 |
|
|
static void |
| 76 |
|
|
ms_lusers(struct Client *client_p, struct Client *source_p, |
| 77 |
michael |
980 |
int parc, char *parv[]) |
| 78 |
adx |
30 |
{ |
| 79 |
|
|
if (parc > 2) |
| 80 |
michael |
980 |
if (hunt_server(client_p, source_p, ":%s LUSERS %s :%s", 2, |
| 81 |
|
|
parc, parv) != HUNTED_ISME) |
| 82 |
adx |
30 |
return; |
| 83 |
|
|
|
| 84 |
adx |
269 |
if (IsClient(source_p)) |
| 85 |
adx |
30 |
show_lusers(source_p); |
| 86 |
|
|
} |
| 87 |
michael |
1230 |
|
| 88 |
|
|
static struct Message lusers_msgtab = { |
| 89 |
|
|
"LUSERS", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
| 90 |
|
|
{m_unregistered, m_lusers, ms_lusers, m_ignore, ms_lusers, m_ignore} |
| 91 |
|
|
}; |
| 92 |
|
|
|
| 93 |
|
|
static void |
| 94 |
|
|
module_init(void) |
| 95 |
|
|
{ |
| 96 |
|
|
mod_add_cmd(&lusers_msgtab); |
| 97 |
|
|
} |
| 98 |
|
|
|
| 99 |
|
|
static void |
| 100 |
|
|
module_exit(void) |
| 101 |
|
|
{ |
| 102 |
|
|
mod_del_cmd(&lusers_msgtab); |
| 103 |
|
|
} |
| 104 |
|
|
|
| 105 |
|
|
struct module module_entry = { |
| 106 |
|
|
.node = { NULL, NULL, NULL }, |
| 107 |
|
|
.name = NULL, |
| 108 |
|
|
.version = "$Revision$", |
| 109 |
|
|
.handle = NULL, |
| 110 |
|
|
.modinit = module_init, |
| 111 |
|
|
.modexit = module_exit, |
| 112 |
|
|
.flags = 0 |
| 113 |
|
|
}; |