Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-11-05 03:01:44 UTC

Modified files:
  Tag: u2_10_12_branch
     ircd/m_list.c ircd/hash.c include/channel.h doc/example.conf
     ChangeLog

Log message:

Support /LIST M to show modes in channels (using the list_chan privilege).

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.211 ircu2.10/ChangeLog:1.710.2.212
--- ircu2.10/ChangeLog:1.710.2.211      Sun Nov  4 18:42:11 2007
+++ ircu2.10/ChangeLog  Sun Nov  4 19:01:34 2007
@@ -1,5 +1,16 @@
 2007-11-04  Michael Poole <[EMAIL PROTECTED]>
 
+       * doc/example.conf: Document /LIST M as controlled by list_chan.
+
+       * include/channel.h (LISTARG_SHOWMODES): Define.
+
+       * ircd/hash.c (list_next_channels): Handle it.
+
+       * ircd/m_list.c (show_usage): Document 'M' flag.
+       (param_parse): Recognize 'M' as LISTARGS_SHOWMODES.
+
+2007-11-04  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/m_list.c (param_parse): Reverse comparison direction when
        converting from minutes to time_t, and which bound is set (so that
        T<time_t works correctly).  Also switch is_time cases so that 'T'
Index: ircu2.10/doc/example.conf
diff -u ircu2.10/doc/example.conf:1.61.2.18 ircu2.10/doc/example.conf:1.61.2.19
--- ircu2.10/doc/example.conf:1.61.2.18 Fri May 25 19:38:09 2007
+++ ircu2.10/doc/example.conf   Sun Nov  4 19:01:34 2007
@@ -216,7 +216,7 @@
  # local_gline (can set a G-line for this server only)
  # local_badchan (can set a Gchan for this server only)
  # see_chan (can see users in +s channels in /WHO)
- # list_chan (can see +s channels with /LIST S)
+ # list_chan (can see +s channels with /LIST S, or modes with /LIST M)
  # wide_gline (can use ! to force a wide G-line)
  # see_opers (can see opers without DISPLAY privilege)
  # local_opmode (can use OPMODE/CLEARMODE on local channels)
Index: ircu2.10/include/channel.h
diff -u ircu2.10/include/channel.h:1.55.2.2 ircu2.10/include/channel.h:1.55.2.3
--- ircu2.10/include/channel.h:1.55.2.2 Wed Aug  2 20:01:50 2006
+++ ircu2.10/include/channel.h  Sun Nov  4 19:01:34 2007
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance.
- * @version $Id: channel.h,v 1.55.2.2 2006/08/03 03:01:50 entrope Exp $
+ * @version $Id: channel.h,v 1.55.2.3 2007/11/05 03:01:34 entrope Exp $
  */
 #ifndef INCLUDED_channel_h
 #define INCLUDED_channel_h
@@ -149,6 +149,7 @@
 #define LISTARG_TOPICLIMITS     0x0001
 #define LISTARG_SHOWSECRET      0x0002
 #define LISTARG_NEGATEWILDCARD  0x0004
+#define LISTARG_SHOWMODES       0x0008
 
 /**
  * Maximum acceptable lag time in seconds: A channel younger than
Index: ircu2.10/ircd/hash.c
diff -u ircu2.10/ircd/hash.c:1.18 ircu2.10/ircd/hash.c:1.18.2.1
--- ircu2.10/ircd/hash.c:1.18   Mon Jun 27 06:25:51 2005
+++ ircu2.10/ircd/hash.c        Sun Nov  4 19:01:34 2007
@@ -46,7 +46,7 @@
 
 /** @file
  * @brief Hash table management.
- * @version $Id: hash.c,v 1.18 2005/06/27 13:25:51 entrope Exp $
+ * @version $Id: hash.c,v 1.18.2.1 2007/11/05 03:01:34 entrope Exp $
  *
  * This file used to use some very complicated hash function.  Now it
  * uses CRC-32, but effectively remaps each input byte according to a
@@ -452,7 +452,17 @@
           && ((args->flags & LISTARG_SHOWSECRET)
               || ShowChannel(cptr, chptr)))
       {
-        send_reply(cptr, RPL_LIST, chptr->chname, chptr->users, chptr->topic);
+        if (args->flags & LISTARG_SHOWMODES) {
+          char modebuf[MODEBUFLEN];
+          char parabuf[MODEBUFLEN];
+
+          modebuf[0] = modebuf[1] = parabuf[0] = '\0';
+          channel_modes(cptr, modebuf, parabuf, sizeof(parabuf), chptr, NULL);
+          send_reply(cptr, RPL_LIST | SND_EXPLICIT, "%s %u %s %s :%s",
+                     chptr->chname, chptr->users, modebuf, parabuf, 
chptr->topic);
+        } else {
+          send_reply(cptr, RPL_LIST, chptr->chname, chptr->users, 
chptr->topic);
+        }
       }
     }
     /* If, at the end of the bucket, client sendq is more than half
Index: ircu2.10/ircd/m_list.c
diff -u ircu2.10/ircd/m_list.c:1.16.2.1 ircu2.10/ircd/m_list.c:1.16.2.2
--- ircu2.10/ircd/m_list.c:1.16.2.1     Sun Nov  4 18:42:11 2007
+++ ircu2.10/ircd/m_list.c      Sun Nov  4 19:01:34 2007
@@ -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_list.c,v 1.16.2.1 2007/11/05 02:42:11 entrope Exp $
+ * $Id: m_list.c,v 1.16.2.2 2007/11/05 03:01:34 entrope Exp $
  */
 
 /*
@@ -168,9 +168,12 @@
              "matching \037pattern\037. ");
   send_reply(sptr, RPL_LISTUSAGE, "Note: Patterns may contain * and ?. "
              "You may only give one pattern match constraint.");
-  if (IsAnOper(sptr))
+  if (IsAnOper(sptr)) {
     send_reply(sptr, RPL_LISTUSAGE,
                " \002S\002             ; Show secret channels.");
+    send_reply(sptr, RPL_LISTUSAGE,
+               " \002M\002             ; Show channel modes.");
+  }
   send_reply(sptr, RPL_LISTUSAGE,
             "Example: LIST <3,>1,C<10,T>0,#a*  ; 2 users, younger than 10 "
             "min., topic set., starts with #a");
@@ -262,6 +265,18 @@
         return show_usage(sptr);
       break;
 
+    case 'M':
+    case 'm':
+      if (!IsAnOper(sptr) || !HasPriv(sptr, PRIV_LIST_CHAN))
+        return show_usage(sptr);
+
+      args->flags |= LISTARG_SHOWMODES;
+      param++;
+
+      if (*param != ',' && *param != ' ' && *param != '\0') /* check syntax */
+        return show_usage(sptr);
+      break;
+
     default:
       /* It might be a wildcard... */
       if (strchr(param, '*') ||
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to