summaryrefslogtreecommitdiff
path: root/src/core/servers.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-09-14 22:46:18 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-09-14 22:46:18 +0000
commit05577dce01d415dcafb4dfa9641a7cae276d90ae (patch)
tree5eb99c357c4b2b0bb71cad0f9853e17c911a57d6 /src/core/servers.c
parent70ac684095c0cea8876aa59ffc877f001257b37e (diff)
downloadirssi-05577dce01d415dcafb4dfa9641a7cae276d90ae.zip
tag generation didn't check the tags from connecting servers, so same tag
could have been duplicated git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2919 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/servers.c')
-rw-r--r--src/core/servers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/servers.c b/src/core/servers.c
index 6bd843af..ef43e4f6 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -110,6 +110,7 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn)
server_create_address_tag(conn->address);
if (conn->tag != NULL && server_find_tag(conn->tag) == NULL &&
+ server_find_lookup_tag(conn->tag) == NULL &&
strncmp(conn->tag, tag, strlen(tag)) == 0) {
/* use the existing tag if it begins with the same ID -
this is useful when you have several connections to
@@ -123,8 +124,13 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn)
/* then just append numbers after tag until unused is found.. */
str = g_string_new(tag);
- for (num = 2; server_find_tag(str->str) != NULL; num++)
+
+ num = 2;
+ while (server_find_tag(str->str) != NULL &&
+ server_find_lookup_tag(str->str) != NULL) {
g_string_sprintf(str, "%s%d", tag, num);
+ num++;
+ }
g_free(tag);
tag = str->str;