Przeglądaj źródła

Merge branch 'internal-users-hubs' into maint

* internal-users-hubs:
  Fix hub startup not respecting changed HUB lines in config

Conflicts:
	doc/UPDATES
Bryan Drewery 13 lat temu
rodzic
commit
fc14cdc7c3
2 zmienionych plików z 18 dodań i 17 usunięć
  1. 1 0
      doc/UPDATES
  2. 17 17
      src/chanprog.c

+ 1 - 0
doc/UPDATES

@@ -8,6 +8,7 @@ maint
   * Warn when using 'chattr +a' as some users may expect it to be auto-op (#58)
   * Really fix CAPS/COLOR flood detection not obeying x|x flags
   * Support TCL 8.6 in the beta libtcl support (no scripting support yet)
+  * Fix hub startup not respecting changed HUB lines in config
 
 1.4.1 - http://wraith.botpack.net/milestone/1.4.1
   * Update server list, 'set -yes servers -' and 'set -yes servers6 -' to get new list.

+ 17 - 17
src/chanprog.c

@@ -403,30 +403,30 @@ void load_internal_users()
   /* hubs */
   for (size_t idx = 0; idx < conf.hubs.length(); ++idx) {
     bd::Array<bd::String> params(static_cast<bd::String>(conf.hubs[idx]).split(' '));
-    bd::String handle(params[0]);
-    if (!get_user_by_handle(userlist, const_cast<char*>(handle.c_str()))) {
-      bd::String address(params[1]);
-      in_port_t port = atoi(static_cast<bd::String>(params[2]).c_str());
-      unsigned short hublevel = params.length() == 4 ? atoi(static_cast<bd::String>(params[3]).c_str()) : (idx + 1);
+    const bd::String handle(params[0]);
+    const bd::String address(params[1]);
+    const in_port_t port = atoi(static_cast<bd::String>(params[2]).c_str());
+    const unsigned short hublevel = params.length() == 4 ? atoi(static_cast<bd::String>(params[3]).c_str()) : (idx + 1);
 
+    if (!(u = get_user_by_handle(userlist, const_cast<char*>(handle.c_str())))) {
       userlist = adduser(userlist, handle.c_str(), "none", "-", USER_OP, 1);
       u = get_user_by_handle(userlist, const_cast<char*>(handle.c_str()));
+    }
 
-      simple_snprintf(tmp, sizeof(tmp), "%li [internal]", (long)now);
-      set_user(&USERENTRY_ADDED, u, tmp);
+    simple_snprintf(tmp, sizeof(tmp), "%li [internal]", (long)now);
+    set_user(&USERENTRY_ADDED, u, tmp);
 
-      struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+    struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
 
-      bi->address = strdup(address.c_str());
-      bi->telnet_port = bi->relay_port = port;
-      bi->hublevel = hublevel;
-      if (conf.bot->hub && (!bi->hublevel) && (!strcasecmp(handle.c_str(), conf.bot->nick))) {
-        bi->hublevel = 99;
-      }
-      bi->uplink = (char *) my_calloc(1, 1);
-      set_user(&USERENTRY_BOTADDR, u, bi);
-      /* set_user(&USERENTRY_PASS, get_user_by_handle(userlist, handle.c_str()), SALT2); */
+    bi->address = strdup(address.c_str());
+    bi->telnet_port = bi->relay_port = port;
+    bi->hublevel = hublevel;
+    if (conf.bot->hub && (!bi->hublevel) && (!strcasecmp(handle.c_str(), conf.bot->nick))) {
+      bi->hublevel = 99;
     }
+    bi->uplink = (char *) my_calloc(1, 1);
+    set_user(&USERENTRY_BOTADDR, u, bi);
+    /* set_user(&USERENTRY_PASS, get_user_by_handle(userlist, handle.c_str()), SALT2); */
   }
 
   /* perm owners */