Просмотр исходного кода

* Auto re-op clients if mdop protection is on

Bryan Drewery 16 лет назад
Родитель
Сommit
fcae4bbf79
3 измененных файлов с 9 добавлено и 1 удалено
  1. 2 0
      doc/UPDATES
  2. 1 1
      src/chanprog.c
  3. 6 0
      src/mod/irc.mod/mode.c

+ 2 - 0
doc/UPDATES

@@ -1,3 +1,5 @@
+* When 'mdop' protection is on, re-op all previously opped clients automatically.
+
 1.3 - http://wraith.botpack.net/milestone/1.3
 * Binary / shell / startup changes
   * Binary error messages are no longer obscure numbers or fake segfaults. (Compile with OBSCURE_ERRORS to re-enable)

+ 1 - 1
src/chanprog.c

@@ -841,7 +841,7 @@ bool bot_shouldjoin(struct userrec* u, struct flag_record* fr, struct chanset_t*
   // No user record, can't make any safe assumptions really
   if (!u) return 0;
 
-#ifdef DEBUG
+#ifdef DEBUGx
   /* Force debugging bots to only join 3 channels */
   if (!strncmp(u->handle, "wtest", 5)) {
     if (!strcmp(chan->dname, "#skynet") || 

+ 6 - 0
src/mod/irc.mod/mode.c

@@ -31,6 +31,7 @@
 
 /* Reversing this mode? */
 static bool reversing = 0;
+static bool mdop_reversing = 1;
 
 #  define PLUS    BIT0
 #  define MINUS   BIT1
@@ -628,6 +629,10 @@ static void
 got_deop(struct chanset_t *chan, memberlist *m, memberlist *mv, char *isserver)
 {
   char s1[UHOSTLEN] = "";
+  const bool was_op = chan_hasop(mv);
+
+  if (mdop_reversing && !was_op)
+    return;
   
   if (m)
     simple_snprintf(s1, sizeof(s1), "%s!%s", m->nick, m->userhost);
@@ -1085,6 +1090,7 @@ gotmode(char *from, char *msg)
                   deflag_user(u, DEFLAG_MDOP, tmp, chan);
                 }
               }
+              reversing = mdop_reversing = 1;
             }
             if (channel_protect(chan))
               do_protect(chan, "Mass Deop");