Explorar el Código

* Fix bot forgetting server uptime on restart

Bryan Drewery hace 16 años
padre
commit
44b6f3e31e
Se han modificado 3 ficheros con 6 adiciones y 1 borrados
  1. 2 0
      doc/UPDATES
  2. 3 0
      src/misc.c
  3. 1 1
      src/mod/server.mod/servmsg.c

+ 2 - 0
doc/UPDATES

@@ -1,3 +1,5 @@
+* Fix bot forgetting server uptime on restart
+
 1.3 - http://wraith.botpack.net/milestone/1.3
 * Binary / shell / startup changes
   * Binary error messages are no longer obscure numbers or fake segfaults. (Compile with OBSCURE_ERRORS to re-enable)

+ 3 - 0
src/misc.c

@@ -647,6 +647,8 @@ readsocks(const char *fname)
       dprintf(DP_STDOUT, STR("Added fd: %d\n"), sock_read(stream));
     else if (type == STR("+online_since"))
       online_since = strtol(str.c_str(), NULL, 10);
+    else if (type == STR("+server_online"))
+      server_online = strtol(str.c_str(), NULL, 10);
     else if (type == STR("+server_floodless"))
       floodless = 1;
     else if (type == STR("+buildts"))
@@ -749,6 +751,7 @@ restart(int idx)
   if (server_online) {
     if (botname[0])
       stream << buf.printf(STR("+botname %s\n"), botname);
+    stream << buf.printf(STR("+server_online %li\n"), server_online);
   }
   stream << buf.printf(STR("+online_since %li\n"), online_since);
   if (floodless)

+ 1 - 1
src/mod/server.mod/servmsg.c

@@ -185,7 +185,6 @@ void rehash_monitor_list() {
 
 void rehash_server(const char *servname, const char *nick)
 {
-  server_online = now;
   altnick_char = 0;
   strlcpy(cursrvname, servname, sizeof(cursrvname));
   if (servidx >= 0)
@@ -220,6 +219,7 @@ static int got001(char *from, char *msg)
 {
 
   fixcolon(msg);
+  server_online = now;
   rehash_server(from, msg);
   /* Ok...param #1 of 001 = what server thinks my nick is */