Преглед на файлове

Auto reop bots to speedup opping (#35)

Bryan Drewery преди 14 години
родител
ревизия
9b239cc98a
променени са 2 файла, в които са добавени 17 реда и са изтрити 9 реда
  1. 2 0
      doc/UPDATES
  2. 15 9
      src/mod/irc.mod/mode.c

+ 2 - 0
doc/UPDATES

@@ -1,3 +1,5 @@
+* Bots now auto-reop other bots that get deopped
+
 1.4.0 - http://wraith.botpack.net/milestone/1.4.0
   * Updated server list, 'set -yes servers -' and 'set -yes servers6 -' to get new list.
   * Change +bitch reaction to use normal queue for deopping opper/opped clients

+ 15 - 9
src/mod/irc.mod/mode.c

@@ -647,11 +647,14 @@ got_deop(struct chanset_t *chan, memberlist *m, memberlist *mv, char *isserver)
 
   if (mdop_reversing && !was_op)
     return;
-  
+
+  /* m is NULL if a server made the change */
   if (m)
     simple_snprintf(s1, sizeof(s1), "%s!%s", m->nick, m->userhost);
 
-  get_user_flagrec(mv->user, &victim, chan->dname, chan);
+  if (mv->user) {
+    get_user_flagrec(mv->user, &victim, chan->dname, chan);
+  }
 
   /* Flags need to be set correctly right from the beginning now, so that
    * add_mode() doesn't get irritated.
@@ -667,13 +670,16 @@ got_deop(struct chanset_t *chan, memberlist *m, memberlist *mv, char *isserver)
   if (me_op(chan)) {
     /* do we want to reop victim? */
     if (
-        /*
-         * reversing
-         * I didn't deop the victim
-         * They didn't deop themselves
-         * They are either an op or this chan is -bitch
-         */
-        (reversing && ((m && !m->is_me && mv != m) || (!m)) && (!chan_bitch(chan) || chk_op(victim, chan)))
+        /* I didn't deop them and they didn't deop themselves. */
+        ((m && !m->is_me && mv != m) || (!m)) && (
+          /*
+           * reversing
+           * They are either an op or this chan is -bitch
+           */
+          (reversing && (!chan_bitch(chan) || chk_op(victim, chan))) ||
+          /* Reop bots to avoid them needing to ask */
+          (mv->user && mv->user->bot && chk_op(victim, chan))
+        )
        ) {
       /* Then we'll bless the victim */
       do_op(mv->nick, chan, 0, 0);