From 21dc6afa837ddce7b1d54300bc286ed22dcf9cb2 Mon Sep 17 00:00:00 2001 From: Elfyn McBratney Date: Wed, 3 Jan 2007 13:09:13 +0000 Subject: [PATCH] Restore stats_spy hook that was removed in commit 401f2454671ca233e35b0e6e4f3fa4c43cdf648b. --- modules/m_stats.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/m_stats.c b/modules/m_stats.c index f0f60ed..4ab2233 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -74,6 +74,9 @@ static void stats_l_list(struct Client *s, const char *, int, int, dlink_list *, static void stats_l_client(struct Client *source_p, struct Client *target_p, char statchar); +static void stats_spy(struct Client *, char, const char *); +static void stats_p_spy(struct Client *); + /* Heres our struct for the stats table */ struct StatsStruct { @@ -205,6 +208,9 @@ m_stats(struct Client *client_p, struct Client *source_p, int parc, const char * if(hunt_server (client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME) return 0; + if((statchar != 'L') && (statchar != 'l')) + stats_spy(source_p, statchar, NULL); + for (i = 0; stats_cmd_table[i].handler; i++) { if(stats_cmd_table[i].letter == statchar) @@ -1161,6 +1167,7 @@ stats_ltrace(struct Client *source_p, int parc, const char *parv[]) if(target_p != NULL) { + stats_spy(source_p, statchar, target_p->name); stats_l_client(source_p, target_p, statchar); } else @@ -1177,6 +1184,8 @@ stats_ltrace(struct Client *source_p, int parc, const char *parv[]) doall = 1; } + stats_spy(source_p, statchar, name); + if(doall) { /* local opers get everyone */ @@ -1270,3 +1279,28 @@ stats_l_client(struct Client *source_p, struct Client *target_p, "-"); } } + +/* + * stats_spy + * + * inputs - pointer to client doing the /stats + * - char letter they are doing /stats on + * output - none + * side effects - + * This little helper function reports to opers if configured. + * personally, I don't see why opers need to see stats requests + * at all. They are just "noise" to an oper, and users can't do + * any damage with stats requests now anyway. So, why show them? + * -Dianora + */ +static void +stats_spy(struct Client *source_p, char statchar, const char *name) +{ + hook_data_int data; + + data.client = source_p; + data.arg1 = name; + data.arg2 = (int) statchar; + + call_hook(doing_stats_hook, &data); +} -- 2.11.4.GIT