From 331d10b5a4073bb8c72e3db02760ef5bfbe5ca4a Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 31 Aug 2003 20:04:00 +0000 Subject: [PATCH] - Fixed bug regarding hidden opers + m_whois cleanup (#0001208). --- Changes | 1 + src/modules/m_whois.c | 39 +++++++++++++++------------------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Changes b/Changes index 9af88452e..1cb78b5e7 100644 --- a/Changes +++ b/Changes @@ -2377,3 +2377,4 @@ seen. gmtime warning still there - Moved EOS debugging code to DEBUGMODE. - Fixed a channel sync bug reported by thilo&Rocko (#0001218). - Fixed minor config parser memleak reported by AngryWolf (#0001214). +- Fixed bug regarding hidden opers + m_whois cleanup (#0001208). diff --git a/src/modules/m_whois.c b/src/modules/m_whois.c index 70be08e66..b7d785cce 100644 --- a/src/modules/m_whois.c +++ b/src/modules/m_whois.c @@ -147,7 +147,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) for (tmp = parv[1]; (nick = strtoken(&p, tmp, ",")); tmp = NULL) { - int invis, showchannel, member, wilds; + unsigned char invis, showchannel, member, wilds, hideoper; /* <- these are all boolean-alike */ found = 0; /* We do not support "WHOIS *" */ @@ -181,6 +181,10 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) a2cptr = find_server_quick(user->server); + hideoper = 0; + if (IsHideOper(acptr) && (acptr != sptr) && !IsAnOper(sptr)) + hideoper = 1; + if (IsWhois(acptr) && (sptr != acptr)) { sendto_one(acptr, @@ -233,7 +237,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (acptr == sptr) showchannel = 1; /* Hey, if you are editting here... don't forget to change the webtv w_whois ;p. */ - + if (showchannel) { long access; @@ -297,9 +301,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) /* makesure they aren't +H (we'll also check before we display a helpop or IRCD Coder msg) -- codemastr */ - if ((IsAnOper(acptr) || IsServices(acptr)) - && (!IsHideOper(acptr) || sptr == acptr - || IsAnOper(sptr))) + if ((IsAnOper(acptr) || IsServices(acptr)) && !hideoper) { buf[0] = '\0'; if (IsNetAdmin(acptr)) @@ -323,32 +325,21 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) parv[0], name, buf); } - if (IsHelpOp(acptr) && (!IsHideOper(acptr) - || sptr == acptr || IsAnOper(sptr))) - if (!user->away) - sendto_one(sptr, - rpl_str(RPL_WHOISHELPOP), me.name, - parv[0], name); + if (IsHelpOp(acptr) && !hideoper && !user->away) + sendto_one(sptr, rpl_str(RPL_WHOISHELPOP), me.name, parv[0], name); if (acptr->umodes & UMODE_BOT) - { - sendto_one(sptr, rpl_str(RPL_WHOISBOT), - me.name, parv[0], name, ircnetwork); - } + sendto_one(sptr, rpl_str(RPL_WHOISBOT), me.name, parv[0], name, ircnetwork); + if (acptr->umodes & UMODE_SECURE) - { sendto_one(sptr, ":%s %d %s %s :%s", me.name, - RPL_WHOISSPECIAL, - parv[0], name, - "is a Secure Connection"); - } - if (user->swhois && !IsHideOper(acptr)) - { - if (*user->swhois != '\0') + RPL_WHOISSPECIAL, parv[0], name, "is a Secure Connection"); + + if (!BadPtr(user->swhois) && !hideoper) sendto_one(sptr, ":%s %d %s %s :%s", me.name, RPL_WHOISSPECIAL, parv[0], name, acptr->user->swhois); - } + /* * Fix /whois to not show idle times of * global opers to anyone except another