From 2b31a5eef5129e11d4a86b66fb76ca08fc8fd012 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Mon, 25 Jun 2001 16:12:09 +0000 Subject: [PATCH] Author: Kev Log message: Forward-port of several pl15 changes to u2.10.11; waiting on clarification on the supported.h changes before I forward-port those. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@517 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 12 ++++++++++++ include/ircd_policy.h | 6 ++++++ ircd/m_whois.c | 20 ++++++++++++-------- ircd/whocmds.c | 6 ++++++ 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b950e9..97010cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2001-06-25 Kevin L. Mitchell + + * ircd/whocmds.c: include ircd_policy.h and implement + HEAD_IN_SAND_WHO_OPCOUNT--forward-port from pl15 + + * ircd/m_whois.c: forward-port of the idle-time hiding code from + pl15; this also required passing parc into do_whois(), which also + meant passing parc into do_wilds()--*sigh* + + * include/ircd_policy.h: add a couple more HEAD_IN_SAND + #define's--WHOIS_IDLETIME and WHO_HOPCOUNT + 2001-06-22 Kevin L. Mitchell * tools/wrapper.c: add a wrapper program that can be used to diff --git a/include/ircd_policy.h b/include/ircd_policy.h index 8f25e65..864229a 100644 --- a/include/ircd_policy.h +++ b/include/ircd_policy.h @@ -26,6 +26,10 @@ * braindead and silly. These aren't configurable as they are network * policy, and should not be changed (depending on what network your * on different ones of these should be defined + * + * If you want nothing to do with any of this nonsense, add the line + * #define INCLUDED_ircd_policy_h + * *above* the #ifndef above. */ /* CFV-165 - Hiding Nonessential information from non-opers @@ -121,7 +125,9 @@ */ #define HEAD_IN_SAND_WHOIS_SERVERNAME +#define HEAD_IN_SAND_WHOIS_IDLETIME #define HEAD_IN_SAND_WHO_SERVERNAME +#define HEAD_IN_SAND_WHO_HOPCOUNT /* CFV-165 - Hiding Nonessential information from non-opers * diff --git a/ircd/m_whois.c b/ircd/m_whois.c index be6a2ef..5a5d8cb 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -134,7 +134,7 @@ /* * Send whois information for acptr to sptr */ -static void do_whois(struct Client* sptr, struct Client *acptr) +static void do_whois(struct Client* sptr, struct Client *acptr, int parc) { struct Client *a2cptr=0; struct Channel *chptr=0; @@ -213,7 +213,11 @@ static void do_whois(struct Client* sptr, struct Client *acptr) * probably a good place to add them :) */ - if (MyConnect(acptr)) + if (MyConnect(acptr) +#ifdef HEAD_IN_SAND_WHOIS_IDLETIME + && (sptr == acptr || IsAnOper(sptr) || parc >= 3) +#endif + ) send_reply(sptr, RPL_WHOISIDLE, name, CurrentTime - user->last, cli_firsttime(acptr)); } @@ -224,7 +228,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr) * returns the number of people found (or, obviously, 0, if none where * found). */ -static int do_wilds(struct Client* sptr,char *nick,int count) +static int do_wilds(struct Client* sptr, char *nick, int count, int parc) { struct Client *acptr; /* Current client we're concidering */ struct User *user; /* the user portion of the client */ @@ -276,7 +280,7 @@ static int do_wilds(struct Client* sptr,char *nick,int count) /* Should we show this person now? */ if (showperson) { found++; - do_whois(sptr,acptr); + do_whois(sptr, acptr, parc); if (count+found>MAX_WHOIS_LINES) return found; continue; @@ -318,7 +322,7 @@ static int do_wilds(struct Client* sptr,char *nick,int count) if (!showperson) continue; - do_whois(sptr,acptr); + do_whois(sptr, acptr, parc); found++; if (count+found>MAX_WHOIS_LINES) return found; @@ -389,12 +393,12 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* No wildcards */ acptr = FindUser(nick); if (acptr && !IsServer(acptr)) { - do_whois(sptr,acptr); + do_whois(sptr, acptr, parc); found = 1; } } else /* wilds */ - found=do_wilds(sptr,nick,total); + found=do_wilds(sptr, nick, total, parc); if (!found) send_reply(sptr, ERR_NOSUCHNICK, nick); @@ -466,7 +470,7 @@ int ms_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) acptr = FindUser(nick); if (acptr && !IsServer(acptr)) { found++; - do_whois(sptr,acptr); + do_whois(sptr, acptr, parc); } if (!found) diff --git a/ircd/whocmds.c b/ircd/whocmds.c index 69829a8..26c12d4 100644 --- a/ircd/whocmds.c +++ b/ircd/whocmds.c @@ -30,6 +30,7 @@ #include "hash.h" #include "ircd.h" #include "ircd_chattr.h" +#include "ircd_policy.h" #include "ircd_reply.h" #include "ircd_string.h" #include "list.h" @@ -195,7 +196,12 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, *p1++ = ' '; if (!fields) *p1++ = ':'; /* Place colon here for default reply */ +#ifdef HEAD_IN_SAND_WHO_HOPCOUNT + strcat(p1, sptr == acptr ? "0" : "3"); + p1++; +#else p1 = sprintf_irc(p1, "%d", cli_hopcount(acptr)); +#endif } if (fields & WHO_FIELD_IDL) -- 2.20.1