From 4da5460d4491abebff8947b9d09f57e8cf51d615 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 19 Dec 2012 20:47:44 +0000 Subject: - Forward-port -r1685 [STATS q|Q now shows how many times a resv{} block has been matched] git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1687 82007160-df01-0410-b94d-b575c5fd34c7 --- modules/core/m_join.c | 5 ++++- modules/core/m_nick.c | 15 ++++++++++----- src/messages.tab | 2 +- src/resv.c | 4 ++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/core/m_join.c b/modules/core/m_join.c index 7f872f7..badef89 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -97,6 +97,7 @@ m_join(struct Client *client_p, struct Client *source_p, char *chan_list = NULL; char *chan = NULL; struct Channel *chptr = NULL; + struct MaskItem *conf = NULL; int i = 0; unsigned int flags = 0; @@ -134,8 +135,10 @@ m_join(struct Client *client_p, struct Client *source_p, if (!IsExemptResv(source_p) && !(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv) && - (!hash_find_resv(chan) == ConfigChannel.restrict_channels)) + (!(conf = hash_find_resv(chan)) == ConfigChannel.restrict_channels)) { + if (conf) + ++conf->count; sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, source_p->name, chan); sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE, diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 8c1d5a8..0f24a10 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -195,6 +195,7 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { struct Client *target_p = NULL; + struct MaskItem *conf = NULL; char nick[NICKLEN + 1]; char *s = NULL; @@ -221,9 +222,10 @@ mr_nick(struct Client *client_p, struct Client *source_p, } /* check if the nick is resv'd */ - if (find_matching_name_conf(CONF_NRESV, nick, NULL, NULL, 0) && - !IsExemptResv(source_p)) + if (!IsExemptResv(source_p) && + (conf = find_matching_name_conf(CONF_NRESV, nick, NULL, NULL, 0))) { + ++conf->count; sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name[0] ? source_p->name : "*", nick); sendto_realops_flags(L_ALL, UMODE_REJ, SEND_NOTICE, @@ -261,6 +263,7 @@ m_nick(struct Client *client_p, struct Client *source_p, { char nick[NICKLEN + 1]; struct Client *target_p = NULL; + struct MaskItem *conf = NULL; assert(source_p == client_p); @@ -286,10 +289,12 @@ m_nick(struct Client *client_p, struct Client *source_p, return; } - if (find_matching_name_conf(CONF_NRESV, nick, - NULL, NULL, 0) && !IsExemptResv(source_p) && - !(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv)) + + if (!IsExemptResv(source_p) && + !(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv) && + (conf = find_matching_name_conf(CONF_NRESV, nick, NULL, NULL, 0))) { + ++conf->count; sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name, nick); sendto_realops_flags(L_ALL, UMODE_REJ, SEND_NOTICE, diff --git a/src/messages.tab b/src/messages.tab index b0514b7..559a0af 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -241,7 +241,7 @@ static struct NumericInfo replies[] = { /* 214 */ {"RPL_STATSNLINE", ":%s 214 %s %c %s * %s %d %s", NULL}, /* 215 */ {"RPL_STATSILINE", ":%s 215 %s %c %s * %s@%s %d %s", NULL}, /* 216 */ {"RPL_STATSKLINE", ":%s 216 %s %s %s * %s :%s", NULL}, -/* 217 */ {"RPL_STATSQLINE", ":%s 217 %s %c %s :%s", NULL}, +/* 217 */ {"RPL_STATSQLINE", ":%s 217 %s %c %u %s :%s", NULL}, /* 218 */ {"RPL_STATSYLINE", ":%s 218 %s %c %s %u %u %u %u %u %u %u/%u %u/%u %s", NULL}, /* 219 */ {"RPL_ENDOFSTATS", ":%s 219 %s %c :End of /STATS report", NULL}, /* 220 */ {"RPL_STATSPLINE", ":%s 220 %s %c %d %s %d %s :%s", NULL}, diff --git a/src/resv.c b/src/resv.c index d83ec75..ccb5c11 100644 --- a/src/resv.c +++ b/src/resv.c @@ -174,7 +174,7 @@ report_resv(struct Client *source_p) conf = ptr->data; sendto_one(source_p, form_str(RPL_STATSQLINE), me.name, source_p->name, - conf->until ? 'q' : 'Q', + conf->until ? 'q' : 'Q', conf->count, conf->name, conf->reason); } @@ -183,7 +183,7 @@ report_resv(struct Client *source_p) conf = ptr->data; sendto_one(source_p, form_str(RPL_STATSQLINE), me.name, source_p->name, - conf->until ? 'q' : 'Q', + conf->until ? 'q' : 'Q', conf->count, conf->name, conf->reason); } } -- cgit