Fix typos in comments and strings to reduce future slumming for credit.
[ircu2.10.12-pk.git] / ircd / m_who.c
index 473509e861117cccef746770d77352da7f010912..d2a4411ab6b7494a7bbafb5579e98100f48d51de 100644 (file)
 #include "numeric.h"
 #include "numnicks.h"
 #include "send.h"
-#include "support.h"
 #include "whocmds.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <string.h>
 
 
 /*
- * A little spin-marking utility to tell us wich clients we have already
- * processed and wich not
+ * A little spin-marking utility to tell us which clients we have already
+ * processed and which not
  */
 static int who_marker = 0;
 static void move_marker(void)
@@ -144,7 +143,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   struct Client *acptr;         /* Client to show                           */
 
   int bitsel;                   /* Mask of selectors to apply               */
-  int matchsel;                 /* Wich fields the match should apply on    */
+  int matchsel;                 /* Which fields the match should apply on    */
   int counter;                  /* Query size counter,
                                    initially used to count fields           */
   int commas;                   /* Does our mask contain any comma ?
@@ -323,7 +322,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
             acptr = member->user;
             if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr))
               continue;
-            if ((acptr != sptr) && (member->status & CHFL_ZOMBIE))
+            if ((acptr != sptr) && (member->status & (CHFL_ZOMBIE | CHFL_DELAYED)))
               continue;
             if (!(isthere || (SEE_USER(sptr, acptr, bitsel))))
               continue;
@@ -351,12 +350,14 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      real mask and try to match all relevant fields */
   if (!(commas || (counter < 1)))
   {
+    struct irc_in_addr imask;
     int minlen, cset;
-    static struct in_mask imask;
+    unsigned char ibits;
+
     if (mask)
     {
       matchcomp(mymask, &minlen, &cset, mask);
-      if (matchcompIP(&imask, mask))
+      if (!ipmask_parse(mask, &imask, &ibits))
         matchsel &= ~WHO_FIELD_NIP;
       if ((minlen > NICKLEN) || !(cset & NTL_IRCNK))
         matchsel &= ~WHO_FIELD_NIC;
@@ -401,9 +402,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
               || matchexec(cli_info(acptr), mymask, minlen))
               && ((!(matchsel & WHO_FIELD_NIP))
              || (HasHiddenHost(acptr) && !IsAnOper(sptr))
-              || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) !=
-              imask.bits.s_addr)) || (imask.fall
-              && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen)))))
+              || !ipmask_check(&cli_ip(acptr), &imask, ibits)))
             continue;
           if (!SHOW_MORE(sptr, counter))
             break;
@@ -439,9 +438,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
             || matchexec(cli_info(acptr), mymask, minlen))
             && ((!(matchsel & WHO_FIELD_NIP))
            || (HasHiddenHost(acptr) && !IsAnOper(sptr))
-            || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) != imask.bits.s_addr))
-            || (imask.fall
-            && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen)))))
+            || !ipmask_check(&cli_ip(acptr), &imask, ibits)))
           continue;
         if (!SHOW_MORE(sptr, counter))
           break;