ソースを参照

Merge branch 'mop-improvements'

* mop-improvements:
  * Update docs
  * When 'mop' is set, and not +bitch, punish newly opped user (and the opper) as if +bitch were set

Conflicts:
	doc/UPDATES
	src/mod/irc.mod/mode.c
Bryan Drewery 14 年 前
コミット
8acaf9bf27
2 ファイル変更11 行追加2 行削除
  1. 1 0
      doc/UPDATES
  2. 10 2
      src/mod/irc.mod/mode.c

+ 1 - 0
doc/UPDATES

@@ -17,6 +17,7 @@
   * FiSH support for DH1080 key-exchange. 'keyx' command added to start from bot, and responds to key-exchanges.
   * Auto FiSH key-exchange when accepting users via callerid
   * When 'mdop' protection is on, re-op all previously opped clients automatically.
+  * When 'mop' protection is on, deop all previously regular clients automatically.
 
 maint
   * Fix --disable-ipv6 compiling

+ 10 - 2
src/mod/irc.mod/mode.c

@@ -31,6 +31,7 @@
 
 /* Reversing this mode? */
 static bool reversing = 0;
+static bool massop = 0;
 static bool mdop_reversing = 1;
 
 #  define PLUS    BIT0
@@ -542,8 +543,13 @@ static void
 got_op(struct chanset_t *chan, memberlist *m, memberlist *mv)
 {
   bool check_chan = 0;
-  bool me_opped = mv->is_me;
+  const bool me_opped = mv->is_me;
   bool meop = me_op(chan);
+  const bool was_op = chan_hasop(mv);
+
+  // No need to punish someone who was already opped.
+  if (massop && was_op)
+    return;
 
   /* Did *I* just get opped? */
   if (!meop && me_opped) {
@@ -1024,7 +1030,7 @@ gotmode(char *from, char *msg)
       memberlist *mv = NULL;
 
 
-      reversing = 0;
+      massop = reversing = 0;
 
       irc_log(chan, "%s!%s sets mode: %s", nick, from, msg);
       get_user_flagrec(u, &user, ch);
@@ -1122,6 +1128,8 @@ gotmode(char *from, char *msg)
               // Don't mass deop if protect is set, it'll happen anyway below
               if (channel_bitch(chan) && !channel_protect(chan))
                 enforce_bitch(chan);        /* deop quick! */
+              else
+                reversing = massop = 1; // Reverse via got_op
             }
             if (channel_protect(chan))
               do_protect(chan, "Mass OP");