Do not include unregistered +i clients in /lusers's invisible count.
[ircu2.10.12-pk.git] / ircd / whocmds.c
index 1388238b33b077e649ac10baeb6c45b05ba4c8d9..2cee53f2b48b299fc3f891d75d9c94fd25486a00 100644 (file)
@@ -86,7 +86,9 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
      that there are no common channels, thus use PubChannel and not
      SeeChannel */
   if (repchan)
+  {
     chan = find_channel_member(acptr, repchan);
+  }
   else if ((!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA)))
            && !IsChannelService(acptr))
   {
@@ -242,6 +244,23 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
       *(p1++) = '0';
   }
 
+  if (fields & WHO_FIELD_OPL)
+  {
+      if (!chan || !IsChanOp(chan))
+      {
+        strcpy(p1, " n/a");
+        p1 += 4;
+      }
+      else
+      {
+        int vis_level = MAXOPLEVEL;
+        if ((IsGlobalChannel(chan->channel->chname) ? IsOper(sptr) : IsAnOper(sptr))
+            || is_chan_op(sptr, chan->channel))
+          vis_level = OpLevel(chan);
+        p1 += ircd_snprintf(0, p1, 5, " %d", vis_level);
+      }
+  }
+
   if (!fields || (fields & WHO_FIELD_REN))
   {
     char *p2 = cli_info(acptr);
@@ -268,7 +287,7 @@ count_users(char *mask)
   struct Client *acptr;
   int count = 0;
   char namebuf[USERLEN + HOSTLEN + 2];
-  char ipbuf[USERLEN + 16 + 2];
+  char ipbuf[USERLEN + SOCKIPLEN + 2];
 
   for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) {
     if (!IsUser(acptr))