00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "stdinc.h"
00026 #ifndef STATIC_MODULES
00027 #include "tools.h"
00028 #include "modules.h"
00029 #include "hook.h"
00030 #include "client.h"
00031 #include "ircd.h"
00032 #include "send.h"
00033
00034 static struct Callback *stats_cb = NULL;
00035 static dlink_node *prev_hook;
00036
00037 static void *show_stats(va_list);
00038
00039 void
00040 _modinit(void)
00041 {
00042 if ((stats_cb = find_callback("doing_stats")))
00043 prev_hook = install_hook(stats_cb, show_stats);
00044 }
00045
00046 void
00047 _moddeinit(void)
00048 {
00049 if (stats_cb)
00050 uninstall_hook(stats_cb, show_stats);
00051 }
00052
00053 const char *_version = "$Revision: 33 $";
00054
00055
00056 static void *
00057 show_stats(va_list args)
00058 {
00059 struct Client *source_p = va_arg(args, struct Client *);
00060 int parc = va_arg(args, int);
00061 char **parv = va_arg(args, char **);
00062 char statchar;
00063
00064 if (parc < 2)
00065 return NULL;
00066
00067 statchar = parv[1][0];
00068 if (statchar == 'L' || statchar == 'l')
00069 {
00070 if (parc > 2 && *parv[2])
00071 sendto_realops_flags(UMODE_SPY, L_ALL,
00072 "STATS %c requested by %s (%s@%s) [%s] on %s",
00073 statchar, source_p->name, source_p->username,
00074 source_p->host, source_p->servptr->name, parv[2]);
00075 else
00076 sendto_realops_flags(UMODE_SPY, L_ALL,
00077 "STATS %c requested by %s (%s@%s) [%s]",
00078 statchar, source_p->name, source_p->username,
00079 source_p->host, source_p->servptr->name);
00080 }
00081 else if (statchar != 'p')
00082 sendto_realops_flags(UMODE_SPY, L_ALL,
00083 "STATS %c requested by %s (%s@%s) [%s]",
00084 statchar, source_p->name, source_p->username,
00085 source_p->host, source_p->servptr->name);
00086
00087 return pass_callback(prev_hook, source_p, parc, parv);
00088 }
00089 #endif