Jelajahi Sumber

* Fix cmd_slowjoin not working on backup bots correctly.

Bryan Drewery 16 tahun lalu
induk
melakukan
08d2232fee
4 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 1 0
      doc/UPDATES
  2. 3 2
      src/chanprog.c
  3. 1 1
      src/chanprog.h
  4. 1 1
      src/mod/channels.mod/cmdschan.c

+ 1 - 0
doc/UPDATES

@@ -51,6 +51,7 @@
 * Default log timestamp now includes seconds
 * Hubs no longer include their own timestamp over botnet
 * Only use oident for server connects, not for bot linking.
+* Fix cmd_slowjoin not working on backup bots correctly.
 
 1.2.16.1
 * Fix linux compile errors

+ 3 - 2
src/chanprog.c

@@ -767,7 +767,7 @@ chans_delbot(const char *bot, struct chanset_t *chan)
 }
 */
 
-bool bot_shouldjoin(struct userrec* u, struct flag_record* fr, struct chanset_t* chan)
+bool bot_shouldjoin(struct userrec* u, struct flag_record* fr, struct chanset_t* chan, bool ignore_inactive)
 {
   /* If the bot is restarting (and hasn't finished getting the userfile for the first time) DO NOT JOIN channels - breaks +B/+backup */
   if (restarting || loading) return 0;
@@ -783,7 +783,8 @@ bool bot_shouldjoin(struct userrec* u, struct flag_record* fr, struct chanset_t*
       return 0;
   }
 #endif
-  return (!channel_inactive(chan) && (channel_backup(chan) || (!glob_backup(*fr) && !chan_backup(*fr))));
+  // Ignore +inactive during cmd_slowjoin to ensure that +backup bots join
+  return ((ignore_inactive || !channel_inactive(chan)) && (channel_backup(chan) || (!glob_backup(*fr) && !chan_backup(*fr))));
 }
 
 bool shouldjoin(struct chanset_t *chan)

+ 1 - 1
src/chanprog.h

@@ -24,7 +24,7 @@ void set_chanlist(const char *host, struct userrec *rec);
 void clear_chanlist(void);
 void clear_chanlist_member(const char *nick);
 int botshouldjoin(struct userrec *u, struct chanset_t *);
-bool bot_shouldjoin(struct userrec* , struct flag_record *, struct chanset_t *);
+bool bot_shouldjoin(struct userrec* , struct flag_record *, struct chanset_t *, bool = 0);
 bool shouldjoin(struct chanset_t *);
 char *samechans(const char *, const char *);
 void add_myself_to_userlist();

+ 1 - 1
src/mod/channels.mod/cmdschan.c

@@ -586,7 +586,7 @@ static void cmd_slowjoin(int idx, char *par)
 
         get_user_flagrec(bot->u, &fr, chname);
 	/* Only send the 'sj' command if the bot is supposed to be in the channel (backups and such) */
-        if (bot_shouldjoin(bot->u, &fr, chan)) {
+        if (bot_shouldjoin(bot->u, &fr, chan, 1)) {
           /* Variation: 60 secs intvl should be 60 +/- 15 */
           int v = (random() % (intvl / 2)) - (intvl / 4);