Explorar el Código

Merge branch 'maint'

* maint:
  Reduce duplicate logic.
  Handle auto-op in check_expired_chanstuff.
  Consolidate some chk_autoop() logic.
Bryan Drewery hace 10 años
padre
commit
bdd2e769ed
Se han modificado 5 ficheros con 26 adiciones y 22 borrados
  1. 1 0
      doc/UPDATES.md
  2. 2 2
      src/flags.cc
  3. 1 1
      src/flags.h
  4. 3 5
      src/mod/irc.mod/chan.cc
  5. 19 14
      src/mod/irc.mod/irc.cc

+ 1 - 0
doc/UPDATES.md

@@ -13,6 +13,7 @@
   * Fallback to ISON if the server falsely claims to support MONITOR.
   * Fallback to ISON if the server falsely claims to support MONITOR.
   * Fix bot not auto-opping after just connecting.
   * Fix bot not auto-opping after just connecting.
   * Fix invites not being applied in -dynamicinvites channels when +i is set.
   * Fix invites not being applied in -dynamicinvites channels when +i is set.
+  * Fix not handling auto-op in minutely channel rechecks.
 
 
 # 1.4.6
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.
   * Disable demo TCL support by default to prevent confusion during build.

+ 2 - 2
src/flags.cc

@@ -459,9 +459,9 @@ real_chk_op(const struct flag_record fr, const struct chanset_t *chan, bool botb
 }
 }
 
 
 int
 int
-chk_autoop(const struct flag_record fr, const struct chanset_t *chan)
+chk_autoop(memberlist *m, const struct flag_record fr, const struct chanset_t *chan)
 {
 {
-  if (glob_bot(fr) || !chan)
+  if (glob_bot(fr) || !chan || !m->user || u_pass_match(m->user, "-"))
     return 0;
     return 0;
   if (!channel_take(chan) && !privchan(fr, chan, PRIV_OP) && chk_op(fr, chan) && !chk_deop(fr, chan)) {
   if (!channel_take(chan) && !privchan(fr, chan, PRIV_OP) && chk_op(fr, chan) && !chk_deop(fr, chan)) {
     if (channel_autoop(chan) || chan_autoop(fr) || glob_autoop(fr))
     if (channel_autoop(chan) || chan_autoop(fr) || glob_autoop(fr))

+ 1 - 1
src/flags.h

@@ -153,7 +153,7 @@ char geticon(int);
 int privchan(const struct flag_record, const struct chanset_t *, int);
 int privchan(const struct flag_record, const struct chanset_t *, int);
 #define chk_op(fr, chan) real_chk_op(fr, chan, 1)
 #define chk_op(fr, chan) real_chk_op(fr, chan, 1)
 int real_chk_op(const struct flag_record, const struct chanset_t *, bool);
 int real_chk_op(const struct flag_record, const struct chanset_t *, bool);
-int chk_autoop(const struct flag_record, const struct chanset_t *);
+int chk_autoop(memberlist *, const struct flag_record, const struct chanset_t *);
 #define chk_deop(fr, chan) real_chk_deop(fr, chan, 1)
 #define chk_deop(fr, chan) real_chk_deop(fr, chan, 1)
 int real_chk_deop(const struct flag_record, const struct chanset_t *, bool);
 int real_chk_deop(const struct flag_record, const struct chanset_t *, bool);
 #define chk_voice(fr, chan) (\
 #define chk_voice(fr, chan) (\

+ 3 - 5
src/mod/irc.mod/chan.cc

@@ -1222,7 +1222,7 @@ static void check_this_member(struct chanset_t *chan, char *nick, struct flag_re
        (!loading && userlist && chan_bitch(chan) && !chk_op(*fr, chan)) ) ) {
        (!loading && userlist && chan_bitch(chan) && !chk_op(*fr, chan)) ) ) {
     /* if (target_priority(chan, m, 1)) */
     /* if (target_priority(chan, m, 1)) */
       add_mode(chan, '-', 'o', m);
       add_mode(chan, '-', 'o', m);
-  } else if (!chan_hasop(m) && dovoice(chan) && m->user && !u_pass_match(m->user, "-") && chk_autoop(*fr, chan)) {
+  } else if (!chan_hasop(m) && dovoice(chan) && chk_autoop(m, *fr, chan)) {
     do_op(m, chan, 1, 0);
     do_op(m, chan, 1, 0);
   }
   }
   if (dovoice(chan)) {
   if (dovoice(chan)) {
@@ -2858,17 +2858,15 @@ static int gotjoin(char *from, char *chname)
         }
         }
 #endif /* CACHE */
 #endif /* CACHE */
         if (!splitjoin) {
         if (!splitjoin) {
-          bool common_checks = dovoice(chan) && !glob_bot(fr);
-
           /* Autoop */
           /* Autoop */
           if (!chan_hasop(m) && 
           if (!chan_hasop(m) && 
                (op || 
                (op || 
-               (common_checks && !u_pass_match(m->user, "-") && chk_autoop(fr, chan)))) {
+               (dovoice(chan) && chk_autoop(m, fr, chan)))) {
             do_op(m, chan, 1, 0);
             do_op(m, chan, 1, 0);
           }
           }
 
 
           /* +v or +voice */
           /* +v or +voice */
-          if (!chan_hasvoice(m) && common_checks) {
+          if (!chan_hasvoice(m) && dovoice(chan)) {
             if (m->user) {
             if (m->user) {
               if (!(m->flags & EVOICE) &&
               if (!(m->flags & EVOICE) &&
                   (
                   (

+ 19 - 14
src/mod/irc.mod/irc.cc

@@ -1584,23 +1584,28 @@ check_expired_chanstuff(struct chanset_t *chan)
       }
       }
 
 
       if (im_opped) {
       if (im_opped) {
-        if (dovoice(chan) && !loading) {      /* autovoice of +v users if bot is +y */
-          if (!chan_hasop(m) && !chan_hasvoice(m) && !chan_sentvoice(m)) {
+        if (dovoice(chan) && !loading && !chan_hasop(m)) {      /* autovoice of +v users if bot is +y */
+          get_user_flagrec(m->user, &fr, chan->dname, chan);
+
+          /* Autoop */
+          if (!chan_sentop(m) && chk_autoop(m, fr, chan)) {
+            do_op(m, chan, 0, 0);
+          }
+
+          /* +v or +voice */
+          if (!chan_hasvoice(m) && !chan_sentvoice(m)) {
             member_getuser(m, 1);
             member_getuser(m, 1);
 
 
             if (m->user) {
             if (m->user) {
-              get_user_flagrec(m->user, &fr, chan->dname, chan);
-              if (!glob_bot(fr)) {
-                if (!(m->flags & EVOICE) &&
-                    (
-                     /* +voice: Voice all clients who are not flag:+q. If the chan is +voicebitch, only op flag:+v clients */
-                     (channel_voice(chan) && !chk_devoice(fr) && (!channel_voicebitch(chan) || (channel_voicebitch(chan) && chk_voice(fr, chan)))) ||
-                     /* Or, if the channel is -voice but they still qualify to be voiced */
-                     (!channel_voice(chan) && !privchan(fr, chan, PRIV_VOICE) && chk_voice(fr, chan))
-                    )
-                   ) {
-                  add_mode(chan, '+', 'v', m);
-                }
+              if (!(m->flags & EVOICE) &&
+                  (
+                   /* +voice: Voice all clients who are not flag:+q. If the chan is +voicebitch, only op flag:+v clients */
+                   (channel_voice(chan) && !chk_devoice(fr) && (!channel_voicebitch(chan) || (channel_voicebitch(chan) && chk_voice(fr, chan)))) ||
+                   /* Or, if the channel is -voice but they still qualify to be voiced */
+                   (!channel_voice(chan) && !privchan(fr, chan, PRIV_VOICE) && chk_voice(fr, chan))
+                  )
+                 ) {
+                add_mode(chan, '+', 'v', m);
               }
               }
             } else if (!m->user && channel_voice(chan) && !channel_voicebitch(chan) && voice_ok(m, chan)) {
             } else if (!m->user && channel_voice(chan) && !channel_voicebitch(chan) && voice_ok(m, chan)) {
               add_mode(chan, '+', 'v', m);
               add_mode(chan, '+', 'v', m);