this patch makes "op levels" behavior, as it appears to users, a feature 
(FEAT_OPLEVELS).

it controls the following behavior:

- can't deop one with a lower/equal op level
- can't kick one with a lower/equal op level
- can change cmodes +Au
- channel stays after the last user leaves

it does not hide cmodes Au in the "supported" replies because ircu does not have in 
code that those replies can change at runtime, that may be another patch.

please send a reply.

beware
diff -ur ircu2.10.orig/include/ircd_features.h ircu2.10/include/ircd_features.h
--- ircu2.10.orig/include/ircd_features.h       Tue Jan  7 11:06:44 2003
+++ ircu2.10/include/ircd_features.h    Sat Jun 21 19:54:40 2003
@@ -49,6 +49,7 @@
   FEAT_HIDDEN_IP,
   FEAT_AUTOHIDE,
   FEAT_CONNEXIT_NOTICES,
+  FEAT_OPLEVELS,
 
   /* features that probably should not be touched */
   FEAT_KILLCHASETIMELIMIT,
diff -ur ircu2.10.orig/ircd/channel.c ircu2.10/ircd/channel.c
--- ircu2.10.orig/ircd/channel.c        Sat Jan 11 13:49:25 2003
+++ ircu2.10/ircd/channel.c     Sat Jun 21 19:32:06 2003
@@ -218,11 +218,14 @@
    * who then will educate them on the use of Apass/upass.
    */
 
-  if (TStime() - chptr->creationtime < 172800) /* Channel younger than 48 hours? */
-    schedule_destruct_event_1m(chptr);         /* Get rid of it in approximately 4-5 
minutes */
-  else
-    schedule_destruct_event_48h(chptr);                /* Get rid of it in 
approximately 48 hours */
-
+  if (feature_bool(FEAT_OPLEVELS)) {
+    if (TStime() - chptr->creationtime < 172800)       /* Channel younger than 48 
hours? */
+      schedule_destruct_event_1m(chptr);               /* Get rid of it in 
approximately 4-5 minutes */
+    else
+      schedule_destruct_event_48h(chptr);              /* Get rid of it in 
approximately 48 hours */
+  } else
+      destruct_channel(chptr);
+    
   return 0;
 }
 
@@ -2796,18 +2799,20 @@
          continue;
         }
 
-       /* 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 */
+        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)) {
-           int equal = (OpLevel(member) == OpLevel(state->member));
-           send_reply(state->sptr, ERR_NOTLOWEROPLEVEL,
+             int equal = (OpLevel(member) == OpLevel(state->member));
+             send_reply(state->sptr, ERR_NOTLOWEROPLEVEL,
                       cli_name(state->cli_change[i].client),
                       state->chptr->chname,
                       OpLevel(state->member), OpLevel(member),
                       "deop", equal ? "the same" : "a higher");
-         continue;
-       }
+           continue;
+         }
+        }
       }
     }
 
@@ -2974,11 +2979,13 @@
        break;
 
       case 'A': /* deal with Admin passes */
-       mode_parse_apass(&state, flag_p);
+       if (feature_bool(FEAT_OPLEVELS))
+          mode_parse_apass(&state, flag_p);
        break;
 
       case 'u': /* deal with user passes */
-       mode_parse_upass(&state, flag_p);
+       if (feature_bool(FEAT_OPLEVELS))
+          mode_parse_upass(&state, flag_p);
        break;
 
       case 'b': /* deal with bans */
diff -ur ircu2.10.orig/ircd/ircd_features.c ircu2.10/ircd/ircd_features.c
--- ircu2.10.orig/ircd/ircd_features.c  Sat Jan 11 12:24:22 2003
+++ ircu2.10/ircd/ircd_features.c       Sat Jun 21 19:50:35 2003
@@ -255,6 +255,7 @@
   F_S(HIDDEN_IP, 0, "127.0.0.1", 0),
   F_B(AUTOHIDE, 0, 1, 0),
   F_B(CONNEXIT_NOTICES, 0, 0, 0),
+  F_B(OPLEVELS, 0, 1, 0),
 
   /* features that probably should not be touched */
   F_I(KILLCHASETIMELIMIT, 0, 30, 0),
diff -ur ircu2.10.orig/ircd/m_kick.c ircu2.10/ircd/m_kick.c
--- ircu2.10.orig/ircd/m_kick.c Wed Jan  8 04:17:19 2003
+++ ircu2.10/ircd/m_kick.c      Sat Jun 21 19:26:57 2003
@@ -91,6 +91,7 @@
 #include "numeric.h"
 #include "numnicks.h"
 #include "send.h"
+#include "ircd_features.h"
 
 #include <assert.h>
 
@@ -141,7 +142,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))
+  if ((OpLevel(member) <= OpLevel(member2)) && feature_bool(FEAT_OPLEVELS))
     return send_reply(sptr, ERR_NOTLOWEROPLEVEL, cli_name(who), chptr->chname,
        OpLevel(member2), OpLevel(member), "kick",
        OpLevel(member) == OpLevel(member2) ? "the same" : "a higher");

Reply via email to