فهرست منبع

Merge branch 'restart-server-online'

* restart-server-online:
  * Default server_online to 0
  * Set server_online to now if upgrading from older bot
  * Fix bot forgetting server uptime on restart
Bryan Drewery 16 سال پیش
والد
کامیت
73a4e69e67
4فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 1 0
      doc/UPDATES
  2. 4 0
      src/misc.c
  3. 1 1
      src/mod/server.mod/server.c
  4. 1 1
      src/mod/server.mod/servmsg.c

+ 1 - 0
doc/UPDATES

@@ -72,6 +72,7 @@
   * Better +bitch/+botbitch/+closed handling when in floodless mode.
   * Bot now attempts to join a channel immediately on invite.
   * Fix bot not setting 'chanmode' channel modes when getting opped.
+  * Fix bot forgetting server uptime on restart
 * Misc changes
   * Cleanup DCC/Telnet listening so bot only listens on IPV6 if it was specifically given an IPV6 IP.
   * CTCP bot CHAT will no longer work if the bot does not have an IPV4 IP set.

+ 4 - 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"))
@@ -687,6 +689,7 @@ readsocks(const char *fname)
       add_server(nserv);
       curserv = 0;
       keepnick = 0; /* Wait to change nicks until relinking, fixes nick/jupenick switching issues during restart */
+      if (!server_online) server_online = now;
       rehash_server(dcc[servidx].host, nick);
       if (cached_005)
         replay_cache(servidx, NULL);
@@ -749,6 +752,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/server.c

@@ -79,7 +79,7 @@ time_t tried_jupenick = 0;
 time_t tried_nick = 0;
 bool use_monitor = 0;
 static bool waiting_for_awake;	/* set when i unidle myself, cleared when I get the response */
-time_t server_online;	/* server connection time */
+time_t server_online = 0;	/* server connection time */
 char botrealname[121] = "A deranged product of evil coders.";	/* realname of bot */
 static interval_t server_timeout = 15;	/* server timeout for connecting */
 struct server_list *serverlist = NULL;	/* old-style queue, still used by

+ 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 */