Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2004-05-15 16:58:21 UTC

Modified files:
     ChangeLog include/channel.h ircd/channel.c ircd/m_list.c

Log message:

Forward port various channel and /list updates

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.407 ircu2.10/ChangeLog:1.408
--- ircu2.10/ChangeLog:1.407    Sat May 15 09:31:26 2004
+++ ircu2.10/ChangeLog  Sat May 15 09:58:01 2004
@@ -1,3 +1,32 @@
+2004-05-15  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/channel.c (can_join): Revert to using IsInvited() rather
+       than walking the list directly.
+       (modebuf_flush_int): Fix errant HEAD_IN_SAND_SNOTICES check to
+       use feature_bool(FEAT_HIS_SNOTICES) instead.
+
+2004-05-15  Kevin L Mitchell  <[EMAIL PROTECTED]>
+
+       [Original ChangeLog date: 2004-01-31 -MDP]
+
+       * ircd/channel.c (mode_parse_key): don't allow , in keys!
+
+2003-04-12  David Mansell (splidge) <[EMAIL PROTECTED]>
+
+       [Original ChangeLog date: 2003-04-14 -MDP]
+
+       * ircd/channel.c: When keys and limits conflict on burst, the key
+       which is first alphabetically or the limit which is lower will be 
+       used by both servers. This matches pre-2.10.11 behaviour.  
+       Closes: (#713930)
+
+2004-05-15  David Mansell <[EMAIL PROTECTED]>
+
+       [Original ChangeLog date: 2002-12-28 -MDP]
+
+       * ircd/channel.c (mode_parse_limit): don't allow -l when no limit is
+       set, don't allow -l with negative parameter (or unsigned >2^31).
+ 
 2004-05-15  David Mansell <[EMAIL PROTECTED]>
 
        [Original ChangeLog date: 2002-12-31 -MDP]
Index: ircu2.10/include/channel.h
diff -u ircu2.10/include/channel.h:1.38 ircu2.10/include/channel.h:1.39
--- ircu2.10/include/channel.h:1.38     Mon May 10 19:10:30 2004
+++ ircu2.10/include/channel.h  Sat May 15 09:58:11 2004
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: channel.h,v 1.38 2004/05/11 02:10:30 entrope Exp $
+ * $Id: channel.h,v 1.39 2004/05/15 16:58:11 entrope Exp $
  */
 #ifndef INCLUDED_channel_h
 #define INCLUDED_channel_h
@@ -119,9 +119,9 @@
                                     (MODE_PRIVATE | MODE_SECRET)) == 0)
 #define is_listed(x)            ((x)->mode.mode & MODE_LISTED)
 
+#define IsGlobalChannel(name)   (*(name) == '#')
 #define IsLocalChannel(name)    (*(name) == '&')
-#define IsChannelName(name)     (*(name) == '#' || \
-                                IsLocalChannel(name))
+#define IsChannelName(name)     (IsGlobalChannel(name) || IsLocalChannel(name))
 
 typedef enum ChannelGetType {
   CGT_NO_CREATE,
@@ -134,6 +134,11 @@
 #define MODE_ADD       0x40000000
 #define MODE_DEL       0x20000000
 
+/* used in ListingArgs.flags */
+
+#define LISTARG_TOPICLIMITS     0x0001
+#define LISTARG_SHOWSECRET      0x0002
+
 /*
  * Maximum acceptable lag time in seconds: A channel younger than
  * this is not protected against hacking admins.
@@ -247,7 +252,7 @@
   time_t min_time;
   unsigned int max_users;
   unsigned int min_users;
-  unsigned int topic_limits;
+  unsigned int flags;
   time_t max_topic_time;
   time_t min_topic_time;
   struct Channel *chptr;
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.89 ircu2.10/ircd/channel.c:1.90
--- ircu2.10/ircd/channel.c:1.89        Mon May 10 19:28:11 2004
+++ ircu2.10/ircd/channel.c     Sat May 15 09:58:11 2004
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: channel.c,v 1.89 2004/05/11 02:28:11 entrope Exp $
+ * $Id: channel.c,v 1.90 2004/05/15 16:58:11 entrope Exp $
  */
 #include "config.h"
 
@@ -1171,7 +1171,6 @@
 
 int can_join(struct Client *sptr, struct Channel *chptr, char *key)
 {
-  struct SLink *lp;
   int overrideJoin = 0;  
   
   /*
@@ -1180,9 +1179,8 @@
    * Now a user CAN escape anything if invited -- Isomer
    */
 
-  for (lp = (cli_user(sptr))->invited; lp; lp = lp->next)
-    if (lp->value.chptr == chptr)
-      return 0;
+  if (IsInvited(sptr, chptr))
+    return 0;
   
   /* An oper can force a join on a local channel using "OVERRIDE" as the key. 
      a HACK(4) notice will be sent if he would not have been supposed
@@ -1346,17 +1344,19 @@
   {
     for (; chptr; chptr = chptr->next)
     {
-      if (!cli_user(cptr) || (!(HasPriv(cptr, PRIV_LIST_CHAN) && IsAnOper(cptr)) && 
+      if (!cli_user(cptr))
+        continue;
+      if (!(HasPriv(cptr, PRIV_LIST_CHAN) && IsAnOper(cptr)) && 
           SecretChannel(chptr) && !find_channel_member(cptr, chptr)))
         continue;
       if (chptr->users > args->min_users && chptr->users < args->max_users &&
           chptr->creationtime > args->min_time &&
           chptr->creationtime < args->max_time &&
-          (!args->topic_limits || (*chptr->topic &&
+          (!(args->flags & LISTARG_TOPICLIMITS) || (*chptr->topic &&
           chptr->topic_time > args->min_topic_time &&
           chptr->topic_time < args->max_topic_time)))
       {
-        if (ShowChannel(cptr,chptr))
+        if ((args->flags & LISTARG_SHOWSECRET) || ShowChannel(cptr,chptr))
          send_reply(cptr, RPL_LIST, chptr->chname, chptr->users,
                     chptr->topic);
         chptr = chptr->next;
@@ -1722,11 +1722,8 @@
     if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
       sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
                           "[%Tu]",
-#ifdef HEAD_IN_SAND_SNOTICES
-                          cli_name(mbuf->mb_source),
-#else
-                          cli_name(app_source),
-#endif
+                          cli_name(feature_bool(FEAT_HIS_SNOTICES) ?
+                                    mbuf->mb_source : app_source),
                           mbuf->mb_channel->chname,
                           rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
                           addbuf, remstr, addstr,
@@ -2175,6 +2172,9 @@
     state->parc--;
     state->max_args--;
 
+    if ((int)t_limit<0) /* don't permit a negative limit */
+      return;
+
     if (!(state->flags & MODE_PARSE_WIPEOUT) &&
        (!t_limit || t_limit == state->chptr->mode.limit))
       return;
@@ -2187,6 +2187,16 @@
     return;
   }
 
+  /* Can't remove a limit that's not there */
+  if (state->dir == MODE_DEL && !state->chptr->mode.limit)
+    return;
+    
+  /* Skip if this is a burst and a lower limit than this is set already */
+  if ((state->flags & MODE_PARSE_BURST) &&
+      (state->chptr->mode.mode & flag_p[0]) &&
+      (state->chptr->mode.limit < t_limit))
+    return;
+
   if (state->done & DONE_LIMIT) /* allow limit to be set only once */
     return;
   state->done |= DONE_LIMIT;
@@ -2244,8 +2254,8 @@
 
   /* clean up the key string */
   s = t_str;
-  while (*++s > ' ' && *s != ':' && --t_len)
-    ;
+  while (*s > ' ' && *s != ':' && *s != ',' && t_len--)
+    s++;
   *s = '\0';
 
   if (!*t_str) { /* warn if empty */
@@ -2258,6 +2268,13 @@
   if (!state->mbuf)
     return;
 
+  /* Skip if this is a burst, we have a key already and the new key is 
+   * after the old one alphabetically */
+  if ((state->flags & MODE_PARSE_BURST) &&
+      *(state->chptr->mode.key) &&
+      ircd_strcmp(state->chptr->mode.key, t_str) <= 0)
+    return;
+
   /* can't add a key if one is set, nor can one remove the wrong key */
   if (!(state->flags & MODE_PARSE_FORCE))
     if ((state->dir == MODE_ADD && *state->chptr->mode.key) ||
@@ -2829,8 +2846,7 @@
       if (MyUser(state->sptr)) {
 
        /* don't allow local opers to be deopped on local channels */
-       if (MyUser(state->sptr) &&
-            state->cli_change[i].client != state->sptr &&
+       if (state->cli_change[i].client != state->sptr &&
            IsLocalChannel(state->chptr->chname) &&
            HasPriv(state->cli_change[i].client, PRIV_DEOP_LCHAN)) {
          send_reply(state->sptr, ERR_ISOPERLCHAN,
Index: ircu2.10/ircd/m_list.c
diff -u ircu2.10/ircd/m_list.c:1.9 ircu2.10/ircd/m_list.c:1.10
--- ircu2.10/ircd/m_list.c:1.9  Thu Feb 14 14:59:27 2002
+++ ircu2.10/ircd/m_list.c      Sat May 15 09:58:11 2004
@@ -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.9 2002/02/14 22:59:27 ghostwolf Exp $
+ * $Id: m_list.c,v 1.10 2004/05/15 16:58:11 entrope Exp $
  */
 
 /*
@@ -158,6 +158,9 @@
   send_reply(sptr, RPL_LISTUSAGE,
             " \002T>\002\037min_minutes\037 ; Channels with a topic last "
             "set more than \037min_minutes\037 ago.");
+  if (IsAnOper(sptr))
+    send_reply(sptr, RPL_LISTUSAGE,
+               " \002S\002             ; Show secret channels.");
   send_reply(sptr, RPL_LISTUSAGE,
             "Example: LIST <3,>1,C<10,T>0  ; 2 users, younger than 10 "
             "min., topic set.");
@@ -183,7 +186,7 @@
     case 'T':
     case 't':
       is_time++;
-      args->topic_limits = 1;
+      args->flags |= LISTARG_TOPICLIMITS;
       /*FALLTHROUGH*/
 
     case 'C':
@@ -233,6 +236,18 @@
       }
       break;
 
+    case 'S':
+    case 's':
+      if (!IsAnOper(sptr))
+        return show_usage(sptr);
+
+      args->flags |= LISTARG_SHOWSECRET;
+      param++;
+
+      if (*param != ',' && *param != ' ' && *param !+ '\0') /* check syntax */
+        return show_usage(sptr);
+      break;
+
     default: /* channel name? */
       if (!permit_chan || !IsChannelName(param))
        return show_usage(sptr);
----------------------- End of diff -----------------------

Reply via email to