diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index 32d8195a..e2815bc4 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -197,7 +197,8 @@ static void sig_reconnect(SERVER_REC *server) } sserver = server_setup_find(server->connrec->address, - server->connrec->port); + server->connrec->port, + server->connrec->chatnet); if (sserver != NULL) { /* save the last connection time/status */ diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index deaf3cc9..92f977b8 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -200,7 +200,7 @@ create_addr_conn(int chat_type, const char *address, int port, g_return_val_if_fail(address != NULL, NULL); - sserver = server_setup_find(address, port); + sserver = server_setup_find(address, port, chatnet); if (sserver != NULL) { if (chat_type < 0) chat_type = sserver->chat_type; @@ -303,7 +303,8 @@ server_create_conn(int chat_type, const char *dest, int port, /* Find matching server from setup. Try to find record with a same port, but fallback to any server with the same address. */ -SERVER_SETUP_REC *server_setup_find(const char *address, int port) +SERVER_SETUP_REC *server_setup_find(const char *address, int port, + const char *chatnet) { SERVER_SETUP_REC *server; GSList *tmp; @@ -314,7 +315,9 @@ SERVER_SETUP_REC *server_setup_find(const char *address, int port) for (tmp = setupservers; tmp != NULL; tmp = tmp->next) { SERVER_SETUP_REC *rec = tmp->data; - if (g_strcasecmp(rec->address, address) == 0) { + if (g_strcasecmp(rec->address, address) == 0 && + (chatnet == NULL || rec->chatnet == NULL || + g_strcasecmp(rec->chatnet, chatnet) == 0)) { server = rec; if (rec->port == port) break; @@ -329,7 +332,7 @@ SERVER_SETUP_REC *server_setup_find_port(const char *address, int port) { SERVER_SETUP_REC *rec; - rec = server_setup_find(address, port); + rec = server_setup_find(address, port, NULL); return rec == NULL || rec->port != port ? NULL : rec; } diff --git a/src/core/servers-setup.h b/src/core/servers-setup.h index d0807d11..d0101bcb 100644 --- a/src/core/servers-setup.h +++ b/src/core/servers-setup.h @@ -33,7 +33,8 @@ server_create_conn(int chat_type, const char *dest, int port, /* Find matching server from setup. Try to find record with a same port, but fallback to any server with the same address. */ -SERVER_SETUP_REC *server_setup_find(const char *address, int port); +SERVER_SETUP_REC *server_setup_find(const char *address, int port, + const char *chatnet); /* Find matching server from setup. Ports must match or NULL is returned. */ SERVER_SETUP_REC *server_setup_find_port(const char *address, int port); diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index f2327c59..025c77d7 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -175,7 +175,7 @@ static void cmd_server_remove(const char *data) if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); if (*port == '\0') - rec = server_setup_find(addr, -1); + rec = server_setup_find(addr, -1, NULL); else rec = server_setup_find_port(addr, atoi(port));