Przeglądaj źródła

Track by handle, not nick

Bryan Drewery 12 lat temu
rodzic
commit
068d83f8c5
2 zmienionych plików z 5 dodań i 5 usunięć
  1. 3 3
      src/mod/irc.mod/chan.c
  2. 2 2
      src/mod/irc.mod/irc.c

+ 3 - 3
src/mod/irc.mod/chan.c

@@ -2938,7 +2938,7 @@ static int gotpart(char *from, char *msg)
       reset_chan_info(chan);
     }
     /* This bot fullfilled a role, need to rebalance. */
-    if (is_bot(u) && (*chan->bot_roles)[nick] != 0) {
+    if (u && u->bot && (*chan->bot_roles)[u->handle] != 0) {
       chan->needs_role_rebalance = 1;
     }
     set_handle_laston(chan->dname, u, now);
@@ -3030,7 +3030,7 @@ static int gotkick(char *from, char *origmsg)
 
       set_handle_laston(chan->dname, mv->user, now);
       /* This bot fullfilled a role, need to rebalance. */
-      if (mv->user->bot && (*chan->bot_roles)[nick] != 0) {
+      if (mv->user->bot && (*chan->bot_roles)[mv->user->handle] != 0) {
         chan->needs_role_rebalance = 1;
       }
     }
@@ -3208,7 +3208,7 @@ static int gotquit(char *from, char *msg)
         if (u->bot) {
           counter_clear(u->handle);
           /* This bot fullfilled a role, need to rebalance. */
-          if ((*chan->bot_roles)[nick] != 0) {
+          if ((*chan->bot_roles)[u->handle] != 0) {
             chan->needs_role_rebalance = 1;
           }
         }

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

@@ -1785,7 +1785,7 @@ static void rebalance_roles_chan(struct chanset_t* chan)
     if (!chk_op(fr, chan)) {
       continue;
     }
-    bots << m->nick;
+    bots << m->user->handle;
   }
   botcount = bots.length();
   if (botcount == 0)
@@ -1843,7 +1843,7 @@ static void rebalance_roles_chan(struct chanset_t* chan)
   }
 
   /* Set my own roles */
-  chan->role = (*chan->bot_roles)[botname];
+  chan->role = (*chan->bot_roles)[conf.bot->nick];
   free(bot_bits);
   chan->needs_role_rebalance = 0;
 }