Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Mon, 25 Jun 2001 16:12:09 +0000 (16:12 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Mon, 25 Jun 2001 16:12:09 +0000 (16:12 +0000)
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
include/ircd_policy.h
ircd/m_whois.c
ircd/whocmds.c

index 3b950e9814cbba848ceb456bac839dea7904bc75..97010cff7363ce67f0f1f89b3ce6948beaed6216 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-06-25  Kevin L. Mitchell  <klmitch@mit.edu>
+
+       * 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  <klmitch@mit.edu>
 
        * tools/wrapper.c: add a wrapper program that can be used to
index 8f25e651f2a77b883e73b5c944e3625c08863092..864229a486e211f981a8ebe01a55bc5cde6585c1 100644 (file)
  * 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
  */
 
 #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
  *
index be6a2ef33567a8cacda2aeeeec60ddef84234d57..5a5d8cb3809ed10e52c79af1f4215f485ae83c83 100644 (file)
 /*
  * 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)
index 69829a8fe7bccd592a3200bb11f046f6ec678963..26c12d4e2507a2a3646e322507bae183f6ed0b54 100644 (file)
@@ -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)