Kaynağa Gözat

Reduce duplicate logic.

Bryan Drewery 10 yıl önce
ebeveyn
işleme
7ce9bf9640
1 değiştirilmiş dosya ile 12 ekleme ve 14 silme
  1. 12 14
      src/mod/irc.mod/irc.cc

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

@@ -1583,30 +1583,28 @@ check_expired_chanstuff(struct chanset_t *chan)
       }
 
       if (im_opped) {
-        if (dovoice(chan) && !loading) {      /* autovoice of +v users if bot is +y */
+        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_hasop(m) && !chan_sentop(m) && chk_autoop(m, fr, chan)) {
+          if (!chan_sentop(m) && chk_autoop(m, fr, chan)) {
             do_op(m, chan, 0, 0);
           }
 
           /* +v or +voice */
-          if (!chan_hasop(m) && !chan_hasvoice(m) && !chan_sentvoice(m)) {
+          if (!chan_hasvoice(m) && !chan_sentvoice(m)) {
             member_getuser(m, 1);
 
             if (m->user) {
-              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)) {
               add_mode(chan, '+', 'v', m);