]> jfr.im git - solanum.git/blob - modules/m_stats.c
Make m_stats and m_svinfo load again.
[solanum.git] / modules / m_stats.c
1 /*
2 * ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
3 * m_stats.c: Sends the user statistics or config information.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 *
24 * $Id: m_stats.c 1608 2006-06-04 02:11:40Z jilles $
25 */
26
27 #include "stdinc.h"
28 #include "class.h" /* report_classes */
29 #include "client.h" /* Client */
30 #include "common.h" /* TRUE/FALSE */
31 #include "irc_string.h"
32 #include "ircd.h" /* me */
33 #include "listener.h" /* show_ports */
34 #include "s_gline.h"
35 #include "msg.h" /* Message */
36 #include "hostmask.h" /* report_mtrie_conf_links */
37 #include "numeric.h" /* ERR_xxx */
38 #include "scache.h" /* list_scache */
39 #include "send.h" /* sendto_one */
40 #include "s_conf.h" /* ConfItem */
41 #include "s_serv.h" /* hunt_server */
42 #include "s_stats.h" /* tstats */
43 #include "s_user.h" /* show_opers */
44 #include "blacklist.h" /* dnsbl stuff */
45 #include "parse.h"
46 #include "modules.h"
47 #include "hook.h"
48 #include "s_newconf.h"
49 #include "hash.h"
50
51 static int m_stats (struct Client *, struct Client *, int, const char **);
52
53 struct Message stats_msgtab = {
54 "STATS", 0, 0, 0, MFLG_SLOW,
55 {mg_unreg, {m_stats, 2}, {m_stats, 3}, mg_ignore, mg_ignore, {m_stats, 2}}
56 };
57
58 int doing_stats_hook;
59 int doing_stats_p_hook;
60
61 mapi_clist_av1 stats_clist[] = { &stats_msgtab, NULL };
62 mapi_hlist_av1 stats_hlist[] = {
63 { "doing_stats", &doing_stats_hook },
64 { "doing_stats_p", &doing_stats_p_hook },
65 { NULL, NULL }
66 };
67
68 DECLARE_MODULE_AV1(stats, NULL, NULL, stats_clist, stats_hlist, NULL, "$Revision: 1608 $");
69
70 const char *Lformat = "%s %u %u %u %u %u :%u %u %s";
71
72 static void stats_l_list(struct Client *s, const char *, int, int, rb_dlink_list *, char);
73 static void stats_l_client(struct Client *source_p, struct Client *target_p,
74 char statchar);
75
76 static void stats_spy(struct Client *, char, const char *);
77 static void stats_p_spy(struct Client *);
78
79 /* Heres our struct for the stats table */
80 struct StatsStruct
81 {
82 char letter;
83 void (*handler) ();
84 int need_oper;
85 int need_admin;
86 };
87
88 static void stats_dns_servers (struct Client *);
89 static void stats_delay(struct Client *);
90 static void stats_hash(struct Client *);
91 static void stats_connect(struct Client *);
92 static void stats_tdeny(struct Client *);
93 static void stats_deny(struct Client *);
94 static void stats_exempt(struct Client *);
95 static void stats_events(struct Client *);
96 static void stats_glines(struct Client *);
97 static void stats_pending_glines(struct Client *);
98 static void stats_hubleaf(struct Client *);
99 static void stats_auth(struct Client *);
100 static void stats_tklines(struct Client *);
101 static void stats_klines(struct Client *);
102 static void stats_messages(struct Client *);
103 static void stats_dnsbl(struct Client *);
104 static void stats_oper(struct Client *);
105 static void stats_operedup(struct Client *);
106 static void stats_ports(struct Client *);
107 static void stats_tresv(struct Client *);
108 static void stats_resv(struct Client *);
109 static void stats_usage(struct Client *);
110 static void stats_tstats(struct Client *);
111 static void stats_uptime(struct Client *);
112 static void stats_shared(struct Client *);
113 static void stats_servers(struct Client *);
114 static void stats_tgecos(struct Client *);
115 static void stats_gecos(struct Client *);
116 static void stats_class(struct Client *);
117 static void stats_memory(struct Client *);
118 static void stats_servlinks(struct Client *);
119 static void stats_ltrace(struct Client *, int, const char **);
120 static void stats_ziplinks(struct Client *);
121 static void stats_comm(struct Client *);
122 /* This table contains the possible stats items, in order:
123 * stats letter, function to call, operonly? adminonly?
124 * case only matters in the stats letter column.. -- fl_
125 */
126 static struct StatsStruct stats_cmd_table[] = {
127 /* letter function need_oper need_admin */
128 {'a', stats_dns_servers, 1, 1, },
129 {'A', stats_dns_servers, 1, 1, },
130 {'b', stats_delay, 1, 1, },
131 {'B', stats_hash, 1, 1, },
132 {'c', stats_connect, 0, 0, },
133 {'C', stats_connect, 0, 0, },
134 {'d', stats_tdeny, 1, 0, },
135 {'D', stats_deny, 1, 0, },
136 {'e', stats_exempt, 1, 0, },
137 {'E', stats_events, 1, 1, },
138 {'f', stats_comm, 1, 1, },
139 {'F', stats_comm, 1, 1, },
140 {'g', stats_pending_glines, 1, 0, },
141 {'G', stats_glines, 1, 0, },
142 {'h', stats_hubleaf, 0, 0, },
143 {'H', stats_hubleaf, 0, 0, },
144 {'i', stats_auth, 0, 0, },
145 {'I', stats_auth, 0, 0, },
146 {'k', stats_tklines, 0, 0, },
147 {'K', stats_klines, 0, 0, },
148 {'l', stats_ltrace, 0, 0, },
149 {'L', stats_ltrace, 0, 0, },
150 {'m', stats_messages, 0, 0, },
151 {'M', stats_messages, 0, 0, },
152 {'n', stats_dnsbl, 0, 0, },
153 {'o', stats_oper, 0, 0, },
154 {'O', stats_oper, 0, 0, },
155 {'p', stats_operedup, 0, 0, },
156 {'P', stats_ports, 0, 0, },
157 {'q', stats_tresv, 1, 0, },
158 {'Q', stats_resv, 1, 0, },
159 {'r', stats_usage, 1, 0, },
160 {'R', stats_usage, 1, 0, },
161 {'t', stats_tstats, 1, 0, },
162 {'T', stats_tstats, 1, 0, },
163 {'u', stats_uptime, 0, 0, },
164 {'U', stats_shared, 1, 0, },
165 {'v', stats_servers, 0, 0, },
166 {'V', stats_servers, 0, 0, },
167 {'x', stats_tgecos, 1, 0, },
168 {'X', stats_gecos, 1, 0, },
169 {'y', stats_class, 0, 0, },
170 {'Y', stats_class, 0, 0, },
171 {'z', stats_memory, 1, 0, },
172 {'Z', stats_ziplinks, 1, 0, },
173 {'?', stats_servlinks, 0, 0, },
174 {(char) 0, (void (*)()) 0, 0, 0, }
175 };
176
177 /*
178 * m_stats by fl_
179 * parv[0] = sender prefix
180 * parv[1] = stat letter/command
181 * parv[2] = (if present) server/mask in stats L, or target
182 *
183 * This will search the tables for the appropriate stats letter,
184 * if found execute it.
185 */
186 static int
187 m_stats(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
188 {
189 static time_t last_used = 0;
190 int i;
191 char statchar;
192
193 statchar = parv[1][0];
194
195 if(MyClient(source_p) && !IsOper(source_p))
196 {
197 /* Check the user is actually allowed to do /stats, and isnt flooding */
198 if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
199 {
200 /* safe enough to give this on a local connect only */
201 sendto_one(source_p, form_str(RPL_LOAD2HI),
202 me.name, source_p->name, "STATS");
203 sendto_one_numeric(source_p, RPL_ENDOFSTATS,
204 form_str(RPL_ENDOFSTATS), statchar);
205 return 0;
206 }
207 else
208 last_used = rb_current_time();
209 }
210
211 if(hunt_server (client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
212 return 0;
213
214 if((statchar != 'L') && (statchar != 'l'))
215 stats_spy(source_p, statchar, NULL);
216
217 for (i = 0; stats_cmd_table[i].handler; i++)
218 {
219 if(stats_cmd_table[i].letter == statchar)
220 {
221 /* The stats table says what privs are needed, so check --fl_ */
222 /* Called for remote clients and for local opers, so check need_admin
223 * and need_oper
224 */
225 if(stats_cmd_table[i].need_oper && !IsOper(source_p))
226 {
227 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
228 form_str (ERR_NOPRIVILEGES));
229 break;
230 }
231 if(stats_cmd_table[i].need_admin && !IsOperAdmin(source_p))
232 {
233 sendto_one(source_p, form_str(ERR_NOPRIVS),
234 me.name, source_p->name, "admin");
235 break;
236 }
237
238 /* Blah, stats L needs the parameters, none of the others do.. */
239 if(statchar == 'L' || statchar == 'l')
240 stats_cmd_table[i].handler (source_p, parc, parv);
241 else
242 stats_cmd_table[i].handler (source_p);
243 }
244 }
245
246 /* Send the end of stats notice, and the stats_spy */
247 sendto_one_numeric(source_p, RPL_ENDOFSTATS,
248 form_str(RPL_ENDOFSTATS), statchar);
249
250 return 0;
251 }
252
253 static void
254 stats_dns_servers (struct Client *source_p)
255 {
256 report_dns_servers (source_p);
257 }
258
259 static void
260 stats_delay(struct Client *source_p)
261 {
262 struct nd_entry *nd;
263 struct DictionaryIter iter;
264
265 DICTIONARY_FOREACH(nd, &iter, nd_dict)
266 {
267 sendto_one_notice(source_p, ":Delaying: %s for %ld",
268 nd->name, (long) nd->expire);
269 }
270 }
271
272 static void
273 stats_hash(struct Client *source_p)
274 {
275 hash_stats(source_p);
276 }
277
278 static void
279 stats_connect(struct Client *source_p)
280 {
281 static char buf[5];
282 struct server_conf *server_p;
283 char *s;
284 rb_dlink_node *ptr;
285
286 if((ConfigFileEntry.stats_c_oper_only ||
287 (ConfigServerHide.flatten_links && !IsExemptShide(source_p))) &&
288 !IsOper(source_p))
289 {
290 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
291 form_str(ERR_NOPRIVILEGES));
292 return;
293 }
294
295 RB_DLINK_FOREACH(ptr, server_conf_list.head)
296 {
297 server_p = ptr->data;
298
299 if(ServerConfIllegal(server_p))
300 continue;
301
302 buf[0] = '\0';
303 s = buf;
304
305 if(IsOper(source_p))
306 {
307 if(ServerConfAutoconn(server_p))
308 *s++ = 'A';
309 if(ServerConfTb(server_p))
310 *s++ = 'T';
311 if(ServerConfCompressed(server_p))
312 *s++ = 'Z';
313 }
314
315 if(!buf[0])
316 *s++ = '*';
317
318 *s = '\0';
319
320 sendto_one_numeric(source_p, RPL_STATSCLINE,
321 form_str(RPL_STATSCLINE),
322 #ifndef HIDE_SERVERS_IPS
323 server_p->host,
324 #else
325 "*@127.0.0.1",
326 #endif
327 buf, server_p->name,
328 server_p->port, server_p->class_name);
329 }
330 }
331
332 /* stats_tdeny()
333 *
334 * input - client to report to
335 * output - none
336 * side effects - client is given temp dline list.
337 */
338 static void
339 stats_tdeny (struct Client *source_p)
340 {
341 char *host, *pass, *user, *oper_reason;
342 struct AddressRec *arec;
343 struct ConfItem *aconf;
344 int i;
345
346 for (i = 0; i < ATABLE_SIZE; i++)
347 {
348 for (arec = atable[i]; arec; arec = arec->next)
349 {
350 if(arec->type == CONF_DLINE)
351 {
352 aconf = arec->aconf;
353
354 if(!(aconf->flags & CONF_FLAGS_TEMPORARY))
355 continue;
356
357 get_printable_kline(source_p, aconf, &host, &pass, &user, &oper_reason);
358
359 sendto_one_numeric(source_p, RPL_STATSDLINE,
360 form_str (RPL_STATSDLINE),
361 'd', host, pass,
362 oper_reason ? "|" : "",
363 oper_reason ? oper_reason : "");
364 }
365 }
366 }
367 }
368
369 /* stats_deny()
370 *
371 * input - client to report to
372 * output - none
373 * side effects - client is given dline list.
374 */
375 static void
376 stats_deny (struct Client *source_p)
377 {
378 char *host, *pass, *user, *oper_reason;
379 struct AddressRec *arec;
380 struct ConfItem *aconf;
381 int i;
382
383 for (i = 0; i < ATABLE_SIZE; i++)
384 {
385 for (arec = atable[i]; arec; arec = arec->next)
386 {
387 if(arec->type == CONF_DLINE)
388 {
389 aconf = arec->aconf;
390
391 if(aconf->flags & CONF_FLAGS_TEMPORARY)
392 continue;
393
394 get_printable_kline(source_p, aconf, &host, &pass, &user, &oper_reason);
395
396 sendto_one_numeric(source_p, RPL_STATSDLINE,
397 form_str (RPL_STATSDLINE),
398 'D', host, pass,
399 oper_reason ? "|" : "",
400 oper_reason ? oper_reason : "");
401 }
402 }
403 }
404 }
405
406
407 /* stats_exempt()
408 *
409 * input - client to report to
410 * output - none
411 * side effects - client is given list of exempt blocks
412 */
413 static void
414 stats_exempt(struct Client *source_p)
415 {
416 char *name, *host, *pass, *user, *classname;
417 struct AddressRec *arec;
418 struct ConfItem *aconf;
419 int i, port;
420
421 if(ConfigFileEntry.stats_e_disabled)
422 {
423 sendto_one_numeric(source_p, ERR_DISABLED,
424 form_str(ERR_DISABLED), "STATS e");
425 return;
426 }
427
428 for (i = 0; i < ATABLE_SIZE; i++)
429 {
430 for (arec = atable[i]; arec; arec = arec->next)
431 {
432 if(arec->type == CONF_EXEMPTDLINE)
433 {
434 aconf = arec->aconf;
435 get_printable_conf (aconf, &name, &host, &pass,
436 &user, &port, &classname);
437
438 sendto_one_numeric(source_p, RPL_STATSDLINE,
439 form_str(RPL_STATSDLINE),
440 'e', host, pass, "", "");
441 }
442 }
443 }}
444
445
446 static void
447 stats_events_cb(char *str, void *ptr)
448 {
449 sendto_one_numeric(ptr, RPL_STATSDEBUG, "E :%s", str);
450 }
451
452 static void
453 stats_events (struct Client *source_p)
454 {
455 rb_dump_events(stats_events_cb, source_p);
456 }
457
458 /* stats_pending_glines()
459 *
460 * input - client pointer
461 * output - none
462 * side effects - client is shown list of pending glines
463 */
464 static void
465 stats_pending_glines (struct Client *source_p)
466 {
467 if(ConfigFileEntry.glines)
468 {
469 rb_dlink_node *pending_node;
470 struct gline_pending *glp_ptr;
471 char timebuffer[MAX_DATE_STRING];
472 struct tm *tmptr;
473
474 RB_DLINK_FOREACH (pending_node, pending_glines.head)
475 {
476 glp_ptr = pending_node->data;
477
478 tmptr = localtime (&glp_ptr->time_request1);
479 strftime (timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
480
481 sendto_one_notice(source_p,
482 ":1) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
483 glp_ptr->oper_nick1,
484 glp_ptr->oper_user1, glp_ptr->oper_host1,
485 glp_ptr->oper_server1, timebuffer,
486 glp_ptr->user, glp_ptr->host, glp_ptr->reason1);
487
488 if(glp_ptr->oper_nick2[0])
489 {
490 tmptr = localtime (&glp_ptr->time_request2);
491 strftime (timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
492 sendto_one_notice(source_p,
493 ":2) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
494 glp_ptr->oper_nick2,
495 glp_ptr->oper_user2, glp_ptr->oper_host2,
496 glp_ptr->oper_server2, timebuffer,
497 glp_ptr->user, glp_ptr->host, glp_ptr->reason2);
498 }
499 }
500
501 if(rb_dlink_list_length (&pending_glines) > 0)
502 sendto_one_notice(source_p, ":End of Pending G-lines");
503 }
504 else
505 sendto_one_notice(source_p, ":This server does not support G-Lines");
506
507 }
508
509 /* stats_glines()
510 *
511 * input - client pointer
512 * output - none
513 * side effects - client is shown list of glines
514 */
515 static void
516 stats_glines (struct Client *source_p)
517 {
518 if(ConfigFileEntry.glines)
519 {
520 rb_dlink_node *gline_node;
521 struct ConfItem *kill_ptr;
522
523 RB_DLINK_FOREACH_PREV (gline_node, glines.tail)
524 {
525 kill_ptr = gline_node->data;
526
527 sendto_one_numeric(source_p, RPL_STATSKLINE,
528 form_str(RPL_STATSKLINE), 'G',
529 kill_ptr->host ? kill_ptr->host : "*",
530 kill_ptr->user ? kill_ptr->user : "*",
531 kill_ptr->passwd ? kill_ptr->passwd : "No Reason",
532 kill_ptr->spasswd ? "|" : "",
533 kill_ptr->spasswd ? kill_ptr->spasswd : "");
534 }
535 }
536 else
537 sendto_one_notice(source_p, ":This server does not support G-Lines");
538 }
539
540
541 static void
542 stats_hubleaf(struct Client *source_p)
543 {
544 struct remote_conf *hub_p;
545 rb_dlink_node *ptr;
546
547 if((ConfigFileEntry.stats_h_oper_only ||
548 (ConfigServerHide.flatten_links && !IsExemptShide(source_p))) &&
549 !IsOper(source_p))
550 {
551 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
552 form_str (ERR_NOPRIVILEGES));
553 return;
554 }
555
556 RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head)
557 {
558 hub_p = ptr->data;
559
560 if(hub_p->flags & CONF_HUB)
561 sendto_one_numeric(source_p, RPL_STATSHLINE,
562 form_str(RPL_STATSHLINE),
563 hub_p->host, hub_p->server);
564 else
565 sendto_one_numeric(source_p, RPL_STATSLLINE,
566 form_str(RPL_STATSLLINE),
567 hub_p->host, hub_p->server);
568 }
569 }
570
571
572 static void
573 stats_auth (struct Client *source_p)
574 {
575 /* Oper only, if unopered, return ERR_NOPRIVS */
576 if((ConfigFileEntry.stats_i_oper_only == 2) && !IsOper (source_p))
577 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
578 form_str (ERR_NOPRIVILEGES));
579
580 /* If unopered, Only return matching auth blocks */
581 else if((ConfigFileEntry.stats_i_oper_only == 1) && !IsOper (source_p))
582 {
583 struct ConfItem *aconf;
584 char *name, *host, *pass, *user, *classname;
585 int port;
586
587 if(MyConnect (source_p))
588 aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL,
589 (struct sockaddr *)&source_p->localClient->ip,
590 CONF_CLIENT,
591 source_p->localClient->ip.ss_family,
592 source_p->username);
593 else
594 aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_CLIENT,
595 0, source_p->username);
596
597 if(aconf == NULL)
598 return;
599
600 get_printable_conf (aconf, &name, &host, &pass, &user, &port, &classname);
601
602 sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE),
603 name, show_iline_prefix(source_p, aconf, user),
604 host, port, classname);
605 }
606
607 /* Theyre opered, or allowed to see all auth blocks */
608 else
609 report_auth (source_p);
610 }
611
612
613 static void
614 stats_tklines(struct Client *source_p)
615 {
616 /* Oper only, if unopered, return ERR_NOPRIVS */
617 if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper (source_p))
618 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
619 form_str (ERR_NOPRIVILEGES));
620
621 /* If unopered, Only return matching klines */
622 else if((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper (source_p))
623 {
624 struct ConfItem *aconf;
625 char *host, *pass, *user, *oper_reason;
626
627 if(MyConnect (source_p))
628 aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL,
629 (struct sockaddr *)&source_p->localClient->ip,
630 CONF_KILL,
631 source_p->localClient->ip.ss_family,
632 source_p->username);
633 else
634 aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_KILL,
635 0, source_p->username);
636
637 if(aconf == NULL)
638 return;
639
640 /* dont report a permanent kline as a tkline */
641 if((aconf->flags & CONF_FLAGS_TEMPORARY) == 0)
642 return;
643
644 get_printable_kline(source_p, aconf, &host, &pass, &user, &oper_reason);
645
646 sendto_one_numeric(source_p, RPL_STATSKLINE,
647 form_str(RPL_STATSKLINE), aconf->flags & CONF_FLAGS_TEMPORARY ? 'k' : 'K',
648 host, user, pass, oper_reason ? "|" : "",
649 oper_reason ? oper_reason : "");
650 }
651 /* Theyre opered, or allowed to see all klines */
652 else
653 {
654 struct ConfItem *aconf;
655 rb_dlink_node *ptr;
656 int i;
657 char *user, *host, *pass, *oper_reason;
658
659 for(i = 0; i < LAST_TEMP_TYPE; i++)
660 {
661 RB_DLINK_FOREACH(ptr, temp_klines[i].head)
662 {
663 aconf = ptr->data;
664
665 get_printable_kline(source_p, aconf, &host, &pass,
666 &user, &oper_reason);
667
668 sendto_one_numeric(source_p, RPL_STATSKLINE,
669 form_str(RPL_STATSKLINE),
670 'k', host, user, pass,
671 oper_reason ? "|" : "",
672 oper_reason ? oper_reason : "");
673 }
674 }
675 }
676 }
677
678 static void
679 stats_klines(struct Client *source_p)
680 {
681 /* Oper only, if unopered, return ERR_NOPRIVS */
682 if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper (source_p))
683 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
684 form_str (ERR_NOPRIVILEGES));
685
686 /* If unopered, Only return matching klines */
687 else if((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper (source_p))
688 {
689 struct ConfItem *aconf;
690 char *host, *pass, *user, *oper_reason;
691
692 /* search for a kline */
693 if(MyConnect (source_p))
694 aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL,
695 (struct sockaddr *)&source_p->localClient->ip,
696 CONF_KILL,
697 source_p->localClient->ip.ss_family,
698 source_p->username);
699 else
700 aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_KILL,
701 0, source_p->username);
702
703 if(aconf == NULL)
704 return;
705
706 get_printable_kline(source_p, aconf, &host, &pass, &user, &oper_reason);
707
708 sendto_one_numeric(source_p, RPL_STATSKLINE, form_str(RPL_STATSKLINE),
709 aconf->flags & CONF_FLAGS_TEMPORARY ? 'k' : 'K',
710 host, user, pass, oper_reason ? "|" : "",
711 oper_reason ? oper_reason : "");
712 }
713 /* Theyre opered, or allowed to see all klines */
714 else
715 report_Klines (source_p);
716 }
717
718 static void
719 stats_messages(struct Client *source_p)
720 {
721 report_messages(source_p);
722 }
723
724 static void
725 stats_dnsbl(struct Client *source_p)
726 {
727 rb_dlink_node *ptr;
728 struct Blacklist *blptr;
729
730 RB_DLINK_FOREACH(ptr, blacklist_list.head)
731 {
732 blptr = ptr->data;
733
734 /* use RPL_STATSDEBUG for now -- jilles */
735 sendto_one_numeric(source_p, RPL_STATSDEBUG, "n :%d %s %s (%d)",
736 blptr->hits,
737 blptr->host,
738 blptr->status & CONF_ILLEGAL ? "disabled" : "active",
739 blptr->refcount);
740 }
741 }
742
743 static void
744 stats_oper(struct Client *source_p)
745 {
746 struct oper_conf *oper_p;
747 rb_dlink_node *ptr;
748
749 if(!IsOper(source_p) && ConfigFileEntry.stats_o_oper_only)
750 {
751 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
752 form_str (ERR_NOPRIVILEGES));
753 return;
754 }
755
756 RB_DLINK_FOREACH(ptr, oper_conf_list.head)
757 {
758 oper_p = ptr->data;
759
760 sendto_one_numeric(source_p, RPL_STATSOLINE,
761 form_str(RPL_STATSOLINE),
762 oper_p->username, oper_p->host, oper_p->name,
763 IsOper(source_p) ? get_oper_privs(oper_p->flags) : "0", "-1");
764 }
765 }
766
767
768 /* stats_operedup()
769 *
770 * input - client pointer
771 * output - none
772 * side effects - client is shown a list of active opers
773 */
774 static void
775 stats_operedup (struct Client *source_p)
776 {
777 struct Client *target_p;
778 rb_dlink_node *oper_ptr;
779 unsigned int count = 0;
780
781 RB_DLINK_FOREACH (oper_ptr, oper_list.head)
782 {
783 target_p = oper_ptr->data;
784
785 if(IsOperInvis(target_p) && !IsOper(source_p))
786 continue;
787
788 if(target_p->user->away)
789 continue;
790
791 count++;
792
793 sendto_one_numeric(source_p, RPL_STATSDEBUG,
794 "p :%s (%s@%s)",
795 target_p->name, target_p->username,
796 target_p->host);
797 }
798
799 sendto_one_numeric(source_p, RPL_STATSDEBUG,
800 "p :%u staff members", count);
801
802 stats_p_spy (source_p);
803 }
804
805 static void
806 stats_ports (struct Client *source_p)
807 {
808 if(!IsOper (source_p) && ConfigFileEntry.stats_P_oper_only)
809 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
810 form_str (ERR_NOPRIVILEGES));
811 else
812 show_ports (source_p);
813 }
814
815 static void
816 stats_tresv(struct Client *source_p)
817 {
818 struct ConfItem *aconf;
819 rb_dlink_node *ptr;
820 int i;
821
822 RB_DLINK_FOREACH(ptr, resv_conf_list.head)
823 {
824 aconf = ptr->data;
825 if(aconf->hold)
826 sendto_one_numeric(source_p, RPL_STATSQLINE,
827 form_str(RPL_STATSQLINE),
828 'q', aconf->port, aconf->name, aconf->passwd);
829 }
830
831 HASH_WALK(i, R_MAX, ptr, resvTable)
832 {
833 aconf = ptr->data;
834 if(aconf->hold)
835 sendto_one_numeric(source_p, RPL_STATSQLINE,
836 form_str(RPL_STATSQLINE),
837 'q', aconf->port, aconf->name, aconf->passwd);
838 }
839 HASH_WALK_END
840 }
841
842
843 static void
844 stats_resv(struct Client *source_p)
845 {
846 struct ConfItem *aconf;
847 rb_dlink_node *ptr;
848 int i;
849
850 RB_DLINK_FOREACH(ptr, resv_conf_list.head)
851 {
852 aconf = ptr->data;
853 if(!aconf->hold)
854 sendto_one_numeric(source_p, RPL_STATSQLINE,
855 form_str(RPL_STATSQLINE),
856 'Q', aconf->port, aconf->name, aconf->passwd);
857 }
858
859 HASH_WALK(i, R_MAX, ptr, resvTable)
860 {
861 aconf = ptr->data;
862 if(!aconf->hold)
863 sendto_one_numeric(source_p, RPL_STATSQLINE,
864 form_str(RPL_STATSQLINE),
865 'Q', aconf->port, aconf->name, aconf->passwd);
866 }
867 HASH_WALK_END
868 }
869
870 static void
871 stats_usage (struct Client *source_p)
872 {
873 struct rusage rus;
874 time_t secs;
875 time_t rup;
876 #ifdef hz
877 # define hzz hz
878 #else
879 # ifdef HZ
880 # define hzz HZ
881 # else
882 int hzz = 1;
883 # endif
884 #endif
885
886 if(getrusage(RUSAGE_SELF, &rus) == -1)
887 {
888 sendto_one_notice(source_p, ":Getruseage error: %s.",
889 strerror(errno));
890 return;
891 }
892 secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec;
893 if(0 == secs)
894 secs = 1;
895
896 rup = (rb_current_time() - startup_time) * hzz;
897 if(0 == rup)
898 rup = 1;
899
900 sendto_one_numeric(source_p, RPL_STATSDEBUG,
901 "R :CPU Secs %d:%d User %d:%d System %d:%d",
902 (int) (secs / 60), (int) (secs % 60),
903 (int) (rus.ru_utime.tv_sec / 60),
904 (int) (rus.ru_utime.tv_sec % 60),
905 (int) (rus.ru_stime.tv_sec / 60),
906 (int) (rus.ru_stime.tv_sec % 60));
907 sendto_one_numeric(source_p, RPL_STATSDEBUG,
908 "R :RSS %ld ShMem %ld Data %ld Stack %ld",
909 rus.ru_maxrss, (rus.ru_ixrss / rup),
910 (rus.ru_idrss / rup), (rus.ru_isrss / rup));
911 sendto_one_numeric(source_p, RPL_STATSDEBUG,
912 "R :Swaps %d Reclaims %d Faults %d",
913 (int) rus.ru_nswap, (int) rus.ru_minflt, (int) rus.ru_majflt);
914 sendto_one_numeric(source_p, RPL_STATSDEBUG,
915 "R :Block in %d out %d",
916 (int) rus.ru_inblock, (int) rus.ru_oublock);
917 sendto_one_numeric(source_p, RPL_STATSDEBUG,
918 "R :Msg Rcv %d Send %d",
919 (int) rus.ru_msgrcv, (int) rus.ru_msgsnd);
920 sendto_one_numeric(source_p, RPL_STATSDEBUG,
921 "R :Signals %d Context Vol. %d Invol %d",
922 (int) rus.ru_nsignals, (int) rus.ru_nvcsw,
923 (int) rus.ru_nivcsw);
924 }
925
926 static void
927 stats_tstats (struct Client *source_p)
928 {
929 tstats (source_p);
930 }
931
932 static void
933 stats_uptime (struct Client *source_p)
934 {
935 time_t now;
936
937 now = rb_current_time() - startup_time;
938 sendto_one_numeric(source_p, RPL_STATSUPTIME,
939 form_str (RPL_STATSUPTIME),
940 now / 86400, (now / 3600) % 24,
941 (now / 60) % 60, now % 60);
942 sendto_one_numeric(source_p, RPL_STATSCONN,
943 form_str (RPL_STATSCONN),
944 MaxConnectionCount, MaxClientCount,
945 Count.totalrestartcount);
946 }
947
948 struct shared_flags
949 {
950 int flag;
951 char letter;
952 };
953 static struct shared_flags shared_flagtable[] =
954 {
955 { SHARED_PKLINE, 'K' },
956 { SHARED_TKLINE, 'k' },
957 { SHARED_UNKLINE, 'U' },
958 { SHARED_PXLINE, 'X' },
959 { SHARED_TXLINE, 'x' },
960 { SHARED_UNXLINE, 'Y' },
961 { SHARED_PRESV, 'Q' },
962 { SHARED_TRESV, 'q' },
963 { SHARED_UNRESV, 'R' },
964 { SHARED_LOCOPS, 'L' },
965 { SHARED_REHASH, 'H' },
966 { 0, '\0'}
967 };
968
969
970 static void
971 stats_shared (struct Client *source_p)
972 {
973 struct remote_conf *shared_p;
974 rb_dlink_node *ptr;
975 char buf[15];
976 char *p;
977 int i;
978
979 RB_DLINK_FOREACH(ptr, shared_conf_list.head)
980 {
981 shared_p = ptr->data;
982
983 p = buf;
984
985 *p++ = 'c';
986
987 for(i = 0; shared_flagtable[i].flag != 0; i++)
988 {
989 if(shared_p->flags & shared_flagtable[i].flag)
990 *p++ = shared_flagtable[i].letter;
991 }
992
993 *p = '\0';
994
995 sendto_one_numeric(source_p, RPL_STATSULINE,
996 form_str(RPL_STATSULINE),
997 shared_p->server, shared_p->username,
998 shared_p->host, buf);
999 }
1000
1001 RB_DLINK_FOREACH(ptr, cluster_conf_list.head)
1002 {
1003 shared_p = ptr->data;
1004
1005 p = buf;
1006
1007 *p++ = 'C';
1008
1009 for(i = 0; shared_flagtable[i].flag != 0; i++)
1010 {
1011 if(shared_p->flags & shared_flagtable[i].flag)
1012 *p++ = shared_flagtable[i].letter;
1013 }
1014
1015 *p = '\0';
1016
1017 sendto_one_numeric(source_p, RPL_STATSULINE,
1018 form_str(RPL_STATSULINE),
1019 shared_p->server, "*", "*", buf);
1020 }
1021 }
1022
1023 /* stats_servers()
1024 *
1025 * input - client pointer
1026 * output - none
1027 * side effects - client is shown lists of who connected servers
1028 */
1029 static void
1030 stats_servers (struct Client *source_p)
1031 {
1032 struct Client *target_p;
1033 rb_dlink_node *ptr;
1034 time_t seconds;
1035 int days, hours, minutes;
1036 int j = 0;
1037
1038 if(ConfigServerHide.flatten_links && !IsOper(source_p) &&
1039 !IsExemptShide(source_p))
1040 {
1041 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
1042 form_str (ERR_NOPRIVILEGES));
1043 return;
1044 }
1045
1046 RB_DLINK_FOREACH (ptr, serv_list.head)
1047 {
1048 target_p = ptr->data;
1049
1050 j++;
1051 seconds = rb_current_time() - target_p->localClient->firsttime;
1052
1053 days = (int) (seconds / 86400);
1054 seconds %= 86400;
1055 hours = (int) (seconds / 3600);
1056 seconds %= 3600;
1057 minutes = (int) (seconds / 60);
1058 seconds %= 60;
1059
1060 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1061 "V :%s (%s!*@*) Idle: %d SendQ: %d "
1062 "Connected: %d day%s, %d:%02d:%02d",
1063 target_p->name,
1064 (target_p->serv->by[0] ? target_p->serv->by : "Remote."),
1065 (int) (rb_current_time() - target_p->localClient->lasttime),
1066 (int) rb_linebuf_len (&target_p->localClient->buf_sendq),
1067 days, (days == 1) ? "" : "s", hours, minutes,
1068 (int) seconds);
1069 }
1070
1071 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1072 "V :%d Server(s)", j);
1073 }
1074
1075 static void
1076 stats_tgecos(struct Client *source_p)
1077 {
1078 struct ConfItem *aconf;
1079 rb_dlink_node *ptr;
1080
1081 RB_DLINK_FOREACH(ptr, xline_conf_list.head)
1082 {
1083 aconf = ptr->data;
1084
1085 if(aconf->hold)
1086 sendto_one_numeric(source_p, RPL_STATSXLINE,
1087 form_str(RPL_STATSXLINE),
1088 'x', aconf->port, aconf->name,
1089 aconf->passwd);
1090 }
1091 }
1092
1093 static void
1094 stats_gecos(struct Client *source_p)
1095 {
1096 struct ConfItem *aconf;
1097 rb_dlink_node *ptr;
1098
1099 RB_DLINK_FOREACH(ptr, xline_conf_list.head)
1100 {
1101 aconf = ptr->data;
1102
1103 if(!aconf->hold)
1104 sendto_one_numeric(source_p, RPL_STATSXLINE,
1105 form_str(RPL_STATSXLINE),
1106 'X', aconf->port, aconf->name,
1107 aconf->passwd);
1108 }
1109 }
1110
1111 static void
1112 stats_class(struct Client *source_p)
1113 {
1114 if(ConfigFileEntry.stats_y_oper_only && !IsOper(source_p))
1115 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
1116 form_str (ERR_NOPRIVILEGES));
1117 else
1118 report_classes(source_p);
1119 }
1120
1121 static void
1122 stats_memory (struct Client *source_p)
1123 {
1124 count_memory (source_p);
1125 }
1126
1127 static void
1128 stats_ziplinks (struct Client *source_p)
1129 {
1130 rb_dlink_node *ptr;
1131 struct Client *target_p;
1132 int sent_data = 0;
1133
1134 RB_DLINK_FOREACH (ptr, serv_list.head)
1135 {
1136 target_p = ptr->data;
1137 if(IsCapable (target_p, CAP_ZIP))
1138 {
1139 /* we use memcpy(3) and a local copy of the structure to
1140 * work around a register use bug on GCC on the SPARC.
1141 * -jmallett, 04/27/2002
1142 */
1143 struct ZipStats zipstats;
1144 memcpy (&zipstats, &target_p->localClient->zipstats,
1145 sizeof (struct ZipStats));
1146 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1147 "Z :ZipLinks stats for %s send[%.2f%% compression "
1148 "(%lu kB data/%lu kB wire)] recv[%.2f%% compression "
1149 "(%lu kB data/%lu kB wire)]",
1150 target_p->name,
1151 zipstats.out_ratio, zipstats.outK, zipstats.outK_wire,
1152 zipstats.in_ratio, zipstats.inK, zipstats.inK_wire);
1153 sent_data++;
1154 }
1155 }
1156
1157 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1158 "Z :%u ziplink(s)", sent_data);
1159 }
1160
1161 static void
1162 stats_servlinks (struct Client *source_p)
1163 {
1164 static char Sformat[] = ":%s %d %s %s %u %u %u %u %u :%u %u %s";
1165 long uptime, sendK, receiveK;
1166 struct Client *target_p;
1167 rb_dlink_node *ptr;
1168 int j = 0;
1169
1170 if(ConfigServerHide.flatten_links && !IsOper (source_p) &&
1171 !IsExemptShide(source_p))
1172 {
1173 sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
1174 form_str (ERR_NOPRIVILEGES));
1175 return;
1176 }
1177
1178 sendK = receiveK = 0;
1179
1180 RB_DLINK_FOREACH (ptr, serv_list.head)
1181 {
1182 target_p = ptr->data;
1183
1184 j++;
1185 sendK += target_p->localClient->sendK;
1186 receiveK += target_p->localClient->receiveK;
1187
1188 sendto_one(source_p, Sformat,
1189 get_id(&me, source_p), RPL_STATSLINKINFO, get_id(source_p, source_p),
1190 get_server_name(target_p, SHOW_IP),
1191 (int) rb_linebuf_len (&target_p->localClient->buf_sendq),
1192 (int) target_p->localClient->sendM,
1193 (int) target_p->localClient->sendK,
1194 (int) target_p->localClient->receiveM,
1195 (int) target_p->localClient->receiveK,
1196 rb_current_time() - target_p->localClient->firsttime,
1197 (rb_current_time() > target_p->localClient->lasttime) ?
1198 (rb_current_time() - target_p->localClient->lasttime) : 0,
1199 IsOper (source_p) ? show_capabilities (target_p) : "TS");
1200 }
1201
1202 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1203 "? :%u total server(s)", j);
1204
1205 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1206 "? :Sent total : %7.2f %s",
1207 _GMKv (sendK), _GMKs (sendK));
1208 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1209 "? :Recv total : %7.2f %s",
1210 _GMKv (receiveK), _GMKs (receiveK));
1211
1212 uptime = (rb_current_time() - startup_time);
1213
1214 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1215 "? :Server send: %7.2f %s (%4.1f K/s)",
1216 _GMKv (me.localClient->sendK),
1217 _GMKs (me.localClient->sendK),
1218 (float) ((float) me.localClient->sendK / (float) uptime));
1219 sendto_one_numeric(source_p, RPL_STATSDEBUG,
1220 "? :Server recv: %7.2f %s (%4.1f K/s)",
1221 _GMKv (me.localClient->receiveK),
1222 _GMKs (me.localClient->receiveK),
1223 (float) ((float) me.localClient->receiveK / (float) uptime));
1224 }
1225
1226 static void
1227 stats_ltrace(struct Client *source_p, int parc, const char *parv[])
1228 {
1229 int doall = 0;
1230 int wilds = 0;
1231 const char *name;
1232 char statchar = parv[1][0];
1233
1234 /* this is def targeted at us somehow.. */
1235 if(parc > 2 && !EmptyString(parv[2]))
1236 {
1237 /* directed at us generically? */
1238 if(match(parv[2], me.name) ||
1239 (!MyClient(source_p) && !irccmp(parv[2], me.id)))
1240 {
1241 name = me.name;
1242 doall = 1;
1243 }
1244 else
1245 {
1246 name = parv[2];
1247 wilds = strchr(name, '*') || strchr(name, '?');
1248 }
1249
1250 /* must be directed at a specific person thats not us */
1251 if(!doall && !wilds)
1252 {
1253 struct Client *target_p;
1254
1255 if(MyClient(source_p))
1256 target_p = find_named_person(name);
1257 else
1258 target_p = find_person(name);
1259
1260 if(target_p != NULL)
1261 {
1262 stats_spy(source_p, statchar, target_p->name);
1263 stats_l_client(source_p, target_p, statchar);
1264 }
1265 else
1266 sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
1267 form_str(ERR_NOSUCHSERVER),
1268 name);
1269
1270 return;
1271 }
1272 }
1273 else
1274 {
1275 name = me.name;
1276 doall = 1;
1277 }
1278
1279 stats_spy(source_p, statchar, name);
1280
1281 if(doall)
1282 {
1283 /* local opers get everyone */
1284 if(MyOper(source_p))
1285 {
1286 stats_l_list(source_p, name, doall, wilds, &unknown_list, statchar);
1287 stats_l_list(source_p, name, doall, wilds, &lclient_list, statchar);
1288 }
1289 else
1290 {
1291 /* they still need themselves if theyre local.. */
1292 if(MyClient(source_p))
1293 stats_l_client(source_p, source_p, statchar);
1294
1295 stats_l_list(source_p, name, doall, wilds, &local_oper_list, statchar);
1296 }
1297
1298 if (!ConfigServerHide.flatten_links || IsOper(source_p) ||
1299 IsExemptShide(source_p))
1300 stats_l_list(source_p, name, doall, wilds, &serv_list, statchar);
1301
1302 return;
1303 }
1304
1305 /* ok, at this point theyre looking for a specific client whos on
1306 * our server.. but it contains a wildcard. --fl
1307 */
1308 stats_l_list(source_p, name, doall, wilds, &lclient_list, statchar);
1309
1310 return;
1311 }
1312
1313
1314 static void
1315 stats_l_list(struct Client *source_p, const char *name, int doall, int wilds,
1316 rb_dlink_list * list, char statchar)
1317 {
1318 rb_dlink_node *ptr;
1319 struct Client *target_p;
1320
1321 /* send information about connections which match. note, we
1322 * dont need tests for IsInvisible(), because non-opers will
1323 * never get here for normal clients --fl
1324 */
1325 RB_DLINK_FOREACH(ptr, list->head)
1326 {
1327 target_p = ptr->data;
1328
1329 if(!doall && wilds && !match(name, target_p->name))
1330 continue;
1331
1332 stats_l_client(source_p, target_p, statchar);
1333 }
1334 }
1335
1336 void
1337 stats_l_client(struct Client *source_p, struct Client *target_p,
1338 char statchar)
1339 {
1340 if(IsAnyServer(target_p))
1341 {
1342 sendto_one_numeric(source_p, RPL_STATSLINKINFO, Lformat,
1343 get_server_name(target_p, SHOW_IP),
1344 (int) rb_linebuf_len(&target_p->localClient->buf_sendq),
1345 (int) target_p->localClient->sendM,
1346 (int) target_p->localClient->sendK,
1347 (int) target_p->localClient->receiveM,
1348 (int) target_p->localClient->receiveK,
1349 rb_current_time() - target_p->localClient->firsttime,
1350 (rb_current_time() > target_p->localClient->lasttime) ?
1351 (rb_current_time() - target_p->localClient->lasttime) : 0,
1352 IsOper(source_p) ? show_capabilities(target_p) : "-");
1353 }
1354
1355 else
1356 {
1357 sendto_one_numeric(source_p, RPL_STATSLINKINFO, Lformat,
1358 show_ip(source_p, target_p) ?
1359 (IsUpper(statchar) ?
1360 get_client_name(target_p, SHOW_IP) :
1361 get_client_name(target_p, HIDE_IP)) :
1362 get_client_name(target_p, MASK_IP),
1363 (int) rb_linebuf_len(&target_p->localClient->buf_sendq),
1364 (int) target_p->localClient->sendM,
1365 (int) target_p->localClient->sendK,
1366 (int) target_p->localClient->receiveM,
1367 (int) target_p->localClient->receiveK,
1368 rb_current_time() - target_p->localClient->firsttime,
1369 (rb_current_time() > target_p->localClient->lasttime) ?
1370 (rb_current_time() - target_p->localClient->lasttime) : 0,
1371 "-");
1372 }
1373 }
1374
1375 static void
1376 rb_dump_fd_callback(int fd, const char *desc, void *data)
1377 {
1378 struct Client *source_p = data;
1379 sendto_one_numeric(source_p, RPL_STATSDEBUG, "F :fd %-3d desc '%s'", fd, desc);
1380 }
1381
1382 static void
1383 stats_comm(struct Client *source_p)
1384 {
1385 rb_dump_fd(rb_dump_fd_callback, source_p);
1386 }
1387
1388 /*
1389 * stats_spy
1390 *
1391 * inputs - pointer to client doing the /stats
1392 * - char letter they are doing /stats on
1393 * output - none
1394 * side effects -
1395 * This little helper function reports to opers if configured.
1396 * personally, I don't see why opers need to see stats requests
1397 * at all. They are just "noise" to an oper, and users can't do
1398 * any damage with stats requests now anyway. So, why show them?
1399 * -Dianora
1400 */
1401 static void
1402 stats_spy(struct Client *source_p, char statchar, const char *name)
1403 {
1404 hook_data_int data;
1405
1406 data.client = source_p;
1407 data.arg1 = name;
1408 data.arg2 = (int) statchar;
1409
1410 call_hook(doing_stats_hook, &data);
1411 }
1412
1413 /* stats_p_spy()
1414 *
1415 * input - pointer to client doing stats
1416 * ouput -
1417 * side effects - call hook doing_stats_p
1418 */
1419 static void
1420 stats_p_spy (struct Client *source_p)
1421 {
1422 hook_data data;
1423
1424 data.client = source_p;
1425 data.arg1 = data.arg2 = NULL;
1426
1427 call_hook(doing_stats_p_hook, &data);
1428 }
1429