From eb7333c8748ed9bcd30a47f6f55a16dbf032d00d Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Tue, 18 Feb 2003 22:29:40 +0000 Subject: [PATCH] - Added /who *.host.com support (ircop only), this was already possible via /who -h but most ppl expect it to work this way too. --- Changes | 2 ++ src/modules/m_who.c | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 393ae24ab..97da98f43 100644 --- a/Changes +++ b/Changes @@ -1924,3 +1924,5 @@ seen. gmtime warning still there - Fixed some case insensitive checks in configfile parsing, fixed to be case sensitive. - Module changes: added two hooks: HOOKTYPE_USERMSG and HOOKTYPE_CHANMSG, changed umode_get. - Fixed bug with chmode +u: Quits/nick changes of other users were shown. +- Added /who *.host.com support (ircop only), this was already possible via /who -h + but most ppl expect it to work this way too. diff --git a/src/modules/m_who.c b/src/modules/m_who.c index 1bd9d7f87..dcf6d3097 100644 --- a/src/modules/m_who.c +++ b/src/modules/m_who.c @@ -667,6 +667,8 @@ static void make_who_status(aClient *sptr, aClient *acptr, aChannel *channel, static void do_other_who(aClient *sptr, char *mask) { +int oper = IsAnOper(sptr); + /* wildcard? */ if (strchr(mask, '*') || strchr(mask, '?')) { @@ -682,9 +684,26 @@ static void do_other_who(aClient *sptr, char *mask) char *channel; int flg; - if (match(mask, acptr->name)) - continue; - + if (!oper) { + if (match(mask, acptr->name)) + continue; + } else { + /* I could have done this with chinese logic, but I prefered + * to do it a bit more clean (ahem :P), like this. -- Syzop + */ + if (!match(mask, acptr->name)) + goto matchok; + if (!oper) + continue; + if (!acptr->user) + continue; + if (!match(mask, acptr->user->realhost)) + goto matchok; + if (IsHidden(acptr) && !match(mask, acptr->user->virthost)) + goto matchok; + continue; +matchok: + } if ((cansee = can_see(sptr, acptr, NULL)) & WHO_CANTSEE) continue;