Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-04-17 16:59:59 UTC

Modified files:
     ChangeLog ircd/channel.c ircd/m_kick.c ircd/s_user.c
     tools/linesync/linesync.sh

Log message:

Fix ability to kick and deop users on -A channels when OPLEVELS enabled.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.601 ircu2.10/ChangeLog:1.602
--- ircu2.10/ChangeLog:1.601    Sun Apr 17 07:11:03 2005
+++ ircu2.10/ChangeLog  Sun Apr 17 09:59:48 2005
@@ -1,5 +1,21 @@
 2005-04-17  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/channel.c (mode_process_clients): Only prohibit deops of
+       users with the same or higher oplevel where apass is set.
+       Likewise, when opping users, give them MAXOPLEVEL for non-apass
+       channels.
+       (joinbuf_join): Give new ops MAXOPLEVEL for non-apass channels.
+
+       * ircd/m_kick.c (m_kick): Only prohibit kicks of users with the
+       same or higher oplevel where apass is set.
+
+       * ircd/s_user.c (register_user): Fix order of server version vs
+       various mode strings.
+
+       * tools/linesync/linesync.sh: Add revision id field.
+
+2005-04-17  Michael Poole <[EMAIL PROTECTED]>
+
        * tools/linesync/linesync.sh: Fix typo comment.  Check for
        multiple blocks per line in the linesync input.
 
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.124 ircu2.10/ircd/channel.c:1.125
--- ircu2.10/ircd/channel.c:1.124       Wed Apr  6 19:10:23 2005
+++ ircu2.10/ircd/channel.c     Sun Apr 17 09:59:48 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.124 2005/04/07 02:10:23 entrope Exp $
+ * @version $Id: channel.c,v 1.125 2005/04/17 16:59:48 entrope Exp $
  */
 #include "config.h"
 
@@ -2999,11 +2999,11 @@
          continue;
         }
 
-        if (feature_bool(FEAT_OPLEVELS)) {
        /* don't allow to deop members with an op level that is <= our own 
level */
        if (state->sptr != state->cli_change[i].client          /* but allow to 
deop oneself */
-               && state->member
-               && OpLevel(member) <= OpLevel(state->member)) {
+            && state->chptr->mode.apass[0]
+            && state->member
+            && OpLevel(member) <= OpLevel(state->member)) {
            int equal = (OpLevel(member) == OpLevel(state->member));
            send_reply(state->sptr, ERR_NOTLOWEROPLEVEL,
                       cli_name(state->cli_change[i].client),
@@ -3012,20 +3012,24 @@
                       "deop", equal ? "the same" : "a higher");
          continue;
        }
-      }
     }
     }
 
     /* set op-level of member being opped */
     if ((state->cli_change[i].flag & (MODE_ADD | MODE_CHANOP)) ==
        (MODE_ADD | MODE_CHANOP)) {
-      /* If on a channel with upass set, someone with level x gives ops to 
someone else,
-         then that person gets level x-1.  On other channels, where upass is 
not set,
-        the level stays the same. */
-      int level_increment = *state->chptr->mode.upass ? 1 : 0;
-      /* Someone being opped by a server gets op-level 0 */
-      int old_level = (state->member == NULL) ? -level_increment : 
OpLevel(state->member);
-      SetOpLevel(member, old_level == MAXOPLEVEL ? MAXOPLEVEL : (old_level + 
level_increment));
+      /* If being opped by an outsider, get oplevel 0 for an apass
+       *   channel, else MAXOPLEVEL.
+       * Otherwise, if not an apass channel, or state->member has
+       *   MAXOPLEVEL, get oplevel MAXOPLEVEL.
+       * Otherwise, get state->member's oplevel+1.
+       */
+      if (!state->member)
+        SetOpLevel(member, state->chptr->mode.apass[0] ? 0 : MAXOPLEVEL);
+      else if (!state->chptr->mode.apass[0] || OpLevel(state->member) == 
MAXOPLEVEL)
+        SetOpLevel(member, MAXOPLEVEL);
+      else
+        SetOpLevel(member, OpLevel(state->member) + 1);
     }
 
     /* actually effect the change */
@@ -3368,11 +3372,12 @@
        is_local) /* got to remove user here */
       remove_user_from_channel(jbuf->jb_source, chan);
   } else {
+    int oplevel = chan->mode.apass[0] ? 0 : MAXOPLEVEL;
     /* Add user to channel */
     if ((chan->mode.mode & MODE_DELJOINS) && !(flags & CHFL_VOICED_OR_OPPED))
-      add_user_to_channel(chan, jbuf->jb_source, flags | CHFL_DELAYED, 0);
+      add_user_to_channel(chan, jbuf->jb_source, flags | CHFL_DELAYED, 
oplevel);
     else
-      add_user_to_channel(chan, jbuf->jb_source, flags, 0);
+      add_user_to_channel(chan, jbuf->jb_source, flags, oplevel);
 
     /* send notification to all servers */
     if (jbuf->jb_type != JOINBUF_TYPE_CREATE && !is_local)
Index: ircu2.10/ircd/m_kick.c
diff -u ircu2.10/ircd/m_kick.c:1.14 ircu2.10/ircd/m_kick.c:1.15
--- ircu2.10/ircd/m_kick.c:1.14 Fri Dec 10 21:13:47 2004
+++ ircu2.10/ircd/m_kick.c      Sun Apr 17 09:59:48 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_kick.c,v 1.14 2004/12/11 05:13:47 klmitch Exp $
+ * $Id: m_kick.c,v 1.15 2005/04/17 16:59:48 entrope Exp $
  */
 
 /*
@@ -143,7 +143,7 @@
     return send_reply(sptr, ERR_USERNOTINCHANNEL, cli_name(who), 
chptr->chname);
 
   /* Don't allow to kick member with a higher or equal op-level */
-  if ((OpLevel(member) <= OpLevel(member2)) && feature_bool(FEAT_OPLEVELS))
+  if (chptr->mode.apass[0] && OpLevel(member) <= OpLevel(member2))
     return send_reply(sptr, ERR_NOTLOWEROPLEVEL, cli_name(who), chptr->chname,
        OpLevel(member2), OpLevel(member), "kick",
        OpLevel(member) == OpLevel(member2) ? "the same" : "a higher");
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.90 ircu2.10/ircd/s_user.c:1.91
--- ircu2.10/ircd/s_user.c:1.90 Wed Apr  6 17:25:46 2005
+++ ircu2.10/ircd/s_user.c      Sun Apr 17 09:59:48 2005
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Miscellaneous user-related helper functions.
- * @version $Id: s_user.c,v 1.90 2005/04/07 00:25:46 entrope Exp $
+ * @version $Id: s_user.c,v 1.91 2005/04/17 16:59:48 entrope Exp $
  */
 #include "config.h"
 
@@ -591,8 +591,8 @@
      */
     send_reply(sptr, RPL_YOURHOST, cli_name(&me), version);
     send_reply(sptr, RPL_CREATED, creation);
-    send_reply(sptr, RPL_MYINFO, cli_name(&me), infousermodes, infochanmodes,
-               infochanmodeswithparams, version);
+    send_reply(sptr, RPL_MYINFO, cli_name(&me), version, infousermodes,
+               infochanmodes, infochanmodeswithparams);
     send_supported(sptr);
     m_lusers(sptr, sptr, 1, parv);
     update_load();
Index: ircu2.10/tools/linesync/linesync.sh
diff -u ircu2.10/tools/linesync/linesync.sh:1.4 
ircu2.10/tools/linesync/linesync.sh:1.5
--- ircu2.10/tools/linesync/linesync.sh:1.4     Sun Apr 17 07:11:04 2005
+++ ircu2.10/tools/linesync/linesync.sh Sun Apr 17 09:59:49 2005
@@ -2,6 +2,7 @@
 # linesync.sh, Copyright (c) 2002 Arjen Wolfs
 # 20020604, [EMAIL PROTECTED]
 # 20050417, [EMAIL PROTECTED]  - modified for u2.10.12
+# $Id: linesync.sh,v 1.5 2005/04/17 16:59:49 entrope Exp $
 #
 # The code contained is in this file is licenced under the terms
 # and conditions as specified in the GNU General Public License.
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to