Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-09-24 02:57:30 UTC

Modified files:
     ChangeLog include/whocmds.h ircd/m_who.c ircd/whocmds.c

Log message:

Support showing join-delayed users in /WHO output.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.705 ircu2.10/ChangeLog:1.706
--- ircu2.10/ChangeLog:1.705    Thu Sep 22 18:15:49 2005
+++ ircu2.10/ChangeLog  Fri Sep 23 19:57:20 2005
@@ -1,3 +1,15 @@
+2005-09-23  Michael Poole <[EMAIL PROTECTED]>
+
+       * include/whocmds.h (WHOSELECT_DELAY): Define new constant.
+
+       * ircd/m_who.c (m_who): Accept 'd'/'D' as a way to set
+       WHOSELECT_DELAY, just like 'o' for WHOSELECT_OPER.  Do not skip
+       join-delayed users if WHOSELECT_DELAY is set.
+
+       * ircd/whocmds.c (do_who): Remember membership for shared channel
+       if one exists.  Use it when displaying flags, adding '<' for
+       join-delayed users.
+
 2005-09-22  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (mode_parse_key): Only accept the new key when
Index: ircu2.10/include/whocmds.h
diff -u ircu2.10/include/whocmds.h:1.9 ircu2.10/include/whocmds.h:1.10
--- ircu2.10/include/whocmds.h:1.9      Mon Oct  4 21:21:36 2004
+++ ircu2.10/include/whocmds.h  Fri Sep 23 19:57:20 2005
@@ -1,6 +1,6 @@
 /** @file whocmds.h
  * @brief Support functions for /WHO-like commands.
- * @version $Id: whocmds.h,v 1.9 2004/10/05 04:21:36 entrope Exp $
+ * @version $Id: whocmds.h,v 1.10 2005/09/24 02:57:20 entrope Exp $
  */
 #ifndef INCLUDED_whocmds_h
 #define INCLUDED_whocmds_h
@@ -23,6 +23,7 @@
 
 #define WHOSELECT_OPER 1   /**< Flag for /WHO: Show IRC operators. */
 #define WHOSELECT_EXTRA 2  /**< Flag for /WHO: Pull rank to see users. */
+#define WHOSELECT_DELAY 4  /**< Flag for /WHO: Show join-delayed users. */
 
 #define WHO_FIELD_QTY 1    /**< Display query type. */
 #define WHO_FIELD_CHA 2    /**< Show common channel name. */
Index: ircu2.10/ircd/m_who.c
diff -u ircu2.10/ircd/m_who.c:1.21 ircu2.10/ircd/m_who.c:1.22
--- ircu2.10/ircd/m_who.c:1.21  Sun Mar 20 08:06:26 2005
+++ ircu2.10/ircd/m_who.c       Fri Sep 23 19:57:20 2005
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_who.c,v 1.21 2005/03/20 16:06:26 entrope Exp $
+ * $Id: m_who.c,v 1.22 2005/09/24 02:57:20 entrope Exp $
  */
 
 /*
@@ -174,6 +174,10 @@
     while (((ch = *(p++))) && (ch != '%') && (ch != ','))
       switch (ch)
       {
+        case 'd':
+        case 'D':
+          bitsel |= WHOSELECT_DELAY;
+          continue;
         case 'o':
         case 'O':
           bitsel |= WHOSELECT_OPER;
@@ -322,7 +326,10 @@
             acptr = member->user;
             if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr))
               continue;
-            if ((acptr != sptr) && (member->status & (CHFL_ZOMBIE | 
CHFL_DELAYED)))
+            if ((acptr != sptr)
+                && ((member->status & CHFL_ZOMBIE)
+                    || ((member->status & CHFL_DELAYED)
+                        && !(bitsel & WHOSELECT_DELAY))))
               continue;
             if (!(isthere || (SEE_USER(sptr, acptr, bitsel))))
               continue;
Index: ircu2.10/ircd/whocmds.c
diff -u ircu2.10/ircd/whocmds.c:1.23 ircu2.10/ircd/whocmds.c:1.24
--- ircu2.10/ircd/whocmds.c:1.23        Tue Dec 28 14:35:38 2004
+++ ircu2.10/ircd/whocmds.c     Fri Sep 23 19:57:20 2005
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Support functions for /WHO-like commands.
- * @version $Id: whocmds.c,v 1.23 2004/12/28 22:35:38 entrope Exp $
+ * @version $Id: whocmds.c,v 1.24 2005/09/24 02:57:20 entrope Exp $
  */
 #include "config.h"
 
@@ -72,7 +72,7 @@
             int fields, char* qrt)
 {
   char *p1;
-  struct Channel *chptr = repchan;
+  struct Membership *chan;
 
   static char buf1[512];
   /* NOTE: with current fields list and sizes this _cannot_ overrun, 
@@ -85,14 +85,15 @@
      unless the listing is for a channel service, we already know
      that there are no common channels, thus use PubChannel and not
      SeeChannel */
-  if (!chptr && (!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA))) &&
-      !IsChannelService(acptr))
+  if (repchan)
+    chan = find_channel_member(acptr, repchan);
+  else if ((!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA)))
+           && !IsChannelService(acptr))
   {
-    struct Membership* chan;
-    for (chan = cli_user(acptr)->channel; chan && !chptr; chan = 
chan->next_channel)
+    for (chan = cli_user(acptr)->channel; chan; chan = chan->next_channel)
       if (PubChannel(chan->channel) &&
           (acptr == sptr || !IsZombie(chan)))
-        chptr = chan->channel;
+        break;
   }
 
   /* Place the fields one by one in the buffer and send it
@@ -111,7 +112,7 @@
   {
     char *p2;
     *(p1++) = ' ';
-    if ((p2 = (chptr ? chptr->chname : NULL)))
+    if ((p2 = (chan ? chan->channel->chname : NULL)))
       while ((*p2) && (*(p1++) = *(p2++)));
     else
       *(p1++) = '*';
@@ -165,25 +166,32 @@
       *(p1++) = 'H';
     if SeeOper(sptr,acptr)
       *(p1++) = '*';
-    if (fields) {
+    if (!chan) {
+      /* No flags possible for the channel, so skip them all. */
+    }
+    else if (fields) {
       /* If you specified flags then we assume you know how to parse
        * multiple channel status flags, as this is currently the only
        * way to know if someone has @'s *and* is +'d.
        */
-      if (chptr && is_chan_op(acptr, chptr))
+      if (IsChanOp(chan))
         *(p1++) = '@';
-      if (chptr && has_voice(acptr, chptr))
+      if (HasVoice(chan))
         *(p1++) = '+';
-      if (chptr && is_zombie(acptr, chptr))
+      if (IsZombie(chan))
         *(p1++) = '!';
+      if (IsDelayedJoin(chan))
+        *(p1++) = '<';
     }
     else {
-      if (chptr && is_chan_op(acptr, chptr))
+      if (IsChanOp(chan))
         *(p1++) = '@';
-      else if (chptr && has_voice(acptr, chptr))
+      else if (HasVoice(chan))
         *(p1++) = '+';
-      else if (chptr && is_zombie(acptr, chptr))
+      else if (IsZombie(chan))
         *(p1++) = '!';
+      else if (IsDelayedJoin(chan))
+        *(p1++) = '<';
     }
     if (IsDeaf(acptr))
       *(p1++) = 'd';
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to