Author: Alex Badea <vampire@p16.pub.ro> (by way of Kev <klmitch@mit.edu>)
[ircu2.10.12-pk.git] / ircd / whocmds.c
index 25f354519fcdb43b933cbba95a09df2a4bd52598..fa8def4b5be396fc45af8c3d7f2529d9c7bc837d 100644 (file)
@@ -122,7 +122,9 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
 
   if (fields & WHO_FIELD_NIP)
   {
-    const char* p2 = ircd_ntoa((const char*) &(cli_ip(acptr)));
+    const char* p2 = HasHiddenHost(acptr) && !IsAnOper(sptr) ?
+      feature_str(FEAT_HIDDEN_IP) :
+      ircd_ntoa((const char*) &(cli_ip(acptr)));
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
@@ -136,7 +138,15 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
 
   if (!fields || (fields & WHO_FIELD_SER))
   {
-    char *p2 = cli_name(cli_user(acptr)->server);
+    char *p2;
+#ifdef HEAD_IN_SAND_WHO_SERVERNAME
+    if (IsAnOper(sptr))
+#endif
+      p2 = cli_name(cli_user(acptr)->server);
+#ifdef HEAD_IN_SAND_WHO_SERVERNAME
+    else
+      p2 = HEAD_IN_SAND_SERVERNAME;
+#endif
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
@@ -189,6 +199,8 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
       if (SendDebug(acptr))
         *(p1++) = 'g';
     }
+    if (HasHiddenHost(acptr))
+      *(p1++) = 'x';
   }
 
   if (!fields || (fields & WHO_FIELD_DIS))
@@ -197,8 +209,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
     if (!fields)
       *p1++ = ':';              /* Place colon here for default reply */
 #ifdef HEAD_IN_SAND_WHO_HOPCOUNT
-    strcat(p1, sptr == acptr ? "0" : "3");
-    p1++;
+    *p1++ = (sptr == acptr) ? '0' : '3';
 #else
     /* three digit hopcount maximum */
     p1 += ircd_snprintf(0, p1, 3, "%d", cli_hopcount(acptr));