瀏覽代碼

Merge branch 'internal-users-hubs' into next

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

Conflicts:
	doc/UPDATES
Bryan Drewery 13 年之前
父節點
當前提交
00f663ec5f
共有 2 個文件被更改,包括 18 次插入17 次删除
  1. 1 0
      doc/UPDATES
  2. 17 17
      src/chanprog.c

+ 1 - 0
doc/UPDATES

@@ -3,6 +3,7 @@ next
   * Properly honor exemptions when kicking matched RBL clients
   * Properly honor exemptions when kicking matched RBL clients
   * Fix LASTON not being shared
   * Fix LASTON not being shared
   * Fix './wraith -V' not showing the updated HUB info
   * Fix './wraith -V' not showing the updated HUB info
+  * Fix hub startup not respecting changed HUB lines in config
 
 
 maint
 maint
   * Prevent crashing on startup if openssl can not be loaded
   * Prevent crashing on startup if openssl can not be loaded

+ 17 - 17
src/chanprog.c

@@ -403,30 +403,30 @@ void load_internal_users()
   /* hubs */
   /* hubs */
   for (size_t idx = 0; idx < conf.hubs.length(); ++idx) {
   for (size_t idx = 0; idx < conf.hubs.length(); ++idx) {
     bd::Array<bd::String> params(static_cast<bd::String>(conf.hubs[idx]).split(' '));
     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);
       userlist = adduser(userlist, handle.c_str(), "none", "-", USER_OP, 1);
       u = get_user_by_handle(userlist, const_cast<char*>(handle.c_str()));
       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 */
   /* perm owners */