Просмотр исходного кода

Backout change-server-keeps-old, it's not ready

Bryan Drewery 11 лет назад
Родитель
Сommit
a1c5348f8b
9 измененных файлов с 10 добавлено и 55 удалено
  1. 0 1
      doc/UPDATES
  2. 0 35
      src/chanprog.c
  3. 0 1
      src/chanprog.h
  4. 1 4
      src/misc.c
  5. 3 3
      src/mod/server.mod/server.c
  6. 1 1
      src/mod/server.mod/server.h
  7. 0 2
      src/mod/share.mod/share.c
  8. 5 6
      src/set.c
  9. 0 2
      src/userent.c

+ 0 - 1
doc/UPDATES

@@ -1,5 +1,4 @@
 next
-  * Bot will now jump from the server it's on if it is removed from the server list. (fixes a changing network bug)
   * Properly honor exemptions when kicking matched RBL clients
   * Fix LASTON not being shared
   * Wraith now automatically assigns roles to bots for channels, no longer

+ 0 - 35
src/chanprog.c

@@ -919,41 +919,6 @@ void notice(bd::String target, bd::String msg, int idx) {
 }
 
 
-void check_removed_server(bool jump_no_match) {
-  if (server_online) {
-    int found_server = 0;
-
-    for (struct server_list *n = serverlist; n; n = n->next) {
-      // Check if server list contains a match to the 'real server name' we're connected to
-      // ie, irc.sucks.net -> irc.servercentral.net (expected (dcc) -> real (cursrvname))
-      if (((n->port && n->port == curservport) || (!n->port && default_port == curservport)) &&
-          !strcmp(n->name, cursrvname)) {
-        found_server = 1;
-        break;
-        // Check if server list contains a match to the 'expected server name' we're connected to
-        // ie, irc.sucks.net -> irc.servercentral.net (expected (dcc) -> real (cursrvname))
-      } else if (servidx != -1 && ((n->port && n->port == dcc[servidx].port) || (!n->port && default_port == dcc[servidx].port)) &&
-          !strcmp(n->name, dcc[servidx].host)) {
-        found_server = 2;
-        break;
-      }
-    }
-
-    if (!found_server) {
-      if (jump_no_match) {
-        // Current server not found in new list, jump!
-        putlog(LOG_SERV, "*", "Server removed from list, jumping!");
-        nuke_server("server removed");
-        cycle_time = 0;
-      }
-    } else {
-      // Update current server in list.
-      curserv = -1;
-      next_server(&curserv, found_server == 1 ? cursrvname : dcc[servidx].host, &curservport, NULL);
-    }
-  }
-}
-
 void keyx(const bd::String &target) {
   bd::String myPublicKeyB64, myPrivateKey, sharedKey;
 

+ 0 - 1
src/chanprog.h

@@ -33,7 +33,6 @@ void load_internal_users();
 void setup_HQ(int);
 void privmsg(bd::String target, bd::String msg, int idx);
 void notice(bd::String target, bd::String msg, int idx);
-void check_removed_server(bool = 1);
 void keyx(const bd::String& target);
 void set_fish_key(char *, bd::String);
 

+ 1 - 4
src/misc.c

@@ -673,8 +673,6 @@ readsocks(const char *fname)
       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("+cursrvname"))
-      strlcpy(cursrvname, str.c_str(), sizeof(cursrvname));
     else if (type == STR("+server_floodless"))
       floodless = 1;
     else if (type == STR("+in_deaf"))
@@ -749,7 +747,7 @@ readsocks(const char *fname)
       keepnick = 0; /* Wait to change nicks until relinking, fixes nick/jupenick switching issues during restart */
       reset_flood();
       if (!server_online) server_online = now;
-      rehash_server(cursrvname[0] ? cursrvname : dcc[servidx].host, nick);
+      rehash_server(dcc[servidx].host, nick);
       if (cached_005)
         replay_cache(servidx, NULL);
       else
@@ -821,7 +819,6 @@ restart(int idx)
     if (my_cookie_counter)
       stream << bd::String::printf(STR("+my_cookie_counter %lu\n"), my_cookie_counter);
     stream << bd::String::printf(STR("+server_online %li\n"), (long)server_online);
-    stream << bd::String::printf(STR("+cursrvname %s\n"), cursrvname);
   }
   stream << bd::String::printf(STR("+online_since %li\n"), (long)online_since);
   if (floodless)

+ 3 - 3
src/mod/server.mod/server.c

@@ -801,7 +801,7 @@ void clearq(struct server_list *xx)
 
 /* Set botserver to the next available server.
  *
- * -> if (*ptr == -1) then add that particular server
+ * -> if (*ptr == -1) then jump to that particular server
  */
 void next_server(int *ptr, char *servname, in_port_t *port, char *pass)
 {
@@ -815,7 +815,7 @@ void next_server(int *ptr, char *servname, in_port_t *port, char *pass)
   /* -1  -->  Go to specified server */
   if (*ptr == (-1)) {
     for (; x; x = x->next) {
-      if ((x->port && x->port == *port) || (!x->port && default_port == *port)) {
+      if (x->port == *port) {
 	if (!strcasecmp(x->name, servname)) {
 	  *ptr = i;
 	  return;
@@ -1151,7 +1151,7 @@ void server_report(int idx, int details)
     }
   }
   if ((trying_server || server_online) && (servidx != (-1))) {
-    dprintf(idx, "    Server %s:%d %s\n", cursrvname, dcc[servidx].port,
+    dprintf(idx, "    Server %s:%d %s\n", dcc[servidx].host, dcc[servidx].port,
 	    trying_server ? "(trying)" : s);
   } else
     dprintf(idx, "    No server currently.\n");

+ 1 - 1
src/mod/server.mod/server.h

@@ -62,7 +62,7 @@ extern unsigned int     rolls;
 extern in_port_t		default_port, default_port_ssl, newserverport, curservport;
 extern time_t		server_online, tried_jupenick, tried_nick, release_time, connect_bursting;
 extern interval_t	cycle_time;
-extern char		cursrvname[120], botrealname[121], botuserhost[], ctcp_reply[1024],
+extern char		cursrvname[], botrealname[121], botuserhost[], ctcp_reply[1024],
 			newserver[], newserverpass[], curnetwork[], botuserip[], altnick_char, deaf_char, callerid_char;
 extern struct server_list *serverlist;
 extern struct dcc_table SERVER_SOCKET;

+ 0 - 2
src/mod/share.mod/share.c

@@ -1454,8 +1454,6 @@ static void share_read_stream(int idx, bd::Stream& stream) {
    */
   clear_userlist(ou);
 
-  check_removed_server();
-
   /* The userfile we received may just be bogus or missing important users */
   load_internal_users();
   add_myself_to_userlist();

+ 5 - 6
src/set.c

@@ -401,8 +401,11 @@ sdprintf("var (mem): %s -> %s", var->name, datain ? datain : "(NULL)");
 
     if (data)
       add_server(data);
-
-    check_removed_server(0);
+    
+    if (server_online) {
+      curserv = -1;
+      next_server(&curserv, cursrvname, &curservport, NULL);
+    }
   }
 
   if (!conf.bot->hub && !strcmp(var->name, "server-use-ssl")) {
@@ -684,7 +687,6 @@ void init_vars()
 }
 
 /* This is used to parse (GLOBAL) userfile var lines and changes via .set from a remote hub */
-// per-bot is set in userent.c: set_gotshare
 void var_userfile_share_line(char *line, int idx, bool share)
 {
   char *name = newsplit(&line);
@@ -701,9 +703,6 @@ void var_userfile_share_line(char *line, int idx, bool share)
   if (share && (conf.bot->hub || conf.bot->localhub))
     botnet_send_var_broad(idx, var);
   set_noshare = 0;
-
-  if (!conf.bot->hub && !strncmp(var->name, "servers", 7))
-    check_removed_server();
 }
 
 const char *var_get_bot_data(struct userrec *u, const char *name, bool useDefault)

+ 0 - 2
src/userent.c

@@ -347,8 +347,6 @@ static bool set_gotshare(struct userrec *u, struct user_entry *e, char *buf, int
     var_set_by_name(conf.bot->nick, name, buf[0] ? buf : NULL);
     set_noshare = 0;
   /* var_set_by_name() called set_user(), no need to do it again... */
-    if (!conf.bot->hub && !strncmp(name, "servers", 7))
-      check_removed_server();
   } 
   /* not else if as the hub might have gotten a botset for itself */
   if (conf.bot->hub || conf.bot->localhub) {