Jelajahi Sumber

Fix cmd_netnick formatting issue with offline bots

Bryan Drewery 12 tahun lalu
induk
melakukan
3a92f4c3a2
2 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 1 0
      doc/UPDATES
  2. 2 4
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -9,6 +9,7 @@ maint
   * Fix build on systems without working libssp
   * Fix build detecting invalid openssl installations (ones with only static libs)
   * Give hint on bot when disconnected from hub for reason
+  * Fix cmd_netnick formatting issue with offline bots
 
 1.4.3
   * Default 'set promisc' to ignore since it's usually a false positive

+ 2 - 4
src/cmds.c

@@ -4128,16 +4128,14 @@ static void rcmd_curnick(char * fbot, char * fhand, char * fidx) {
   if (!conf.bot->hub) {
     char tmp[301] = "";
 
-    if (server_online)
-      simple_snprintf(tmp, sizeof(tmp), "Currently: %-20s ", botname);
+    simple_snprintf(tmp, sizeof(tmp), "Currently: %-20s ",
+        server_online ? botname : "(not online)");
     if (jupenick[0] && strncmp(botname, jupenick, strlen(botname)))
       simple_snprintf(&tmp[strlen(tmp)], sizeof(tmp) - strlen(tmp), "Jupe: %s ", jupenick);
     else if (jupenick[0] && strcmp(botname, origbotname))
       simple_snprintf(&tmp[strlen(tmp)], sizeof(tmp) - strlen(tmp), "Jupe: %s Main: %s ", jupenick, origbotname);
     else if (strcmp(botname, origbotname))
       simple_snprintf(&tmp[strlen(tmp)], sizeof(tmp) - strlen(tmp), "Main: %s ", origbotname);
-    if (!server_online)
-      strlcat(tmp, "(not online)", sizeof(tmp));
     botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
   }
 }