diff options
author | Timo Sirainen <cras@irssi.org> | 2001-06-08 21:19:08 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-06-08 21:19:08 +0000 |
commit | 7773aabb2c24031f75c4e06fe55fae7a8e5b8437 (patch) | |
tree | 8dc66d6ce27afc8849d76482620662f21da7e5eb /src/core/servers.c | |
parent | bd7cc25590a8fd29e8fd490106ee7a7dc85d7860 (diff) | |
download | irssi-7773aabb2c24031f75c4e06fe55fae7a8e5b8437.zip |
Try to keep the number after server tag always the same when there's
multiple connections to the same server.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1540 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/servers.c')
-rw-r--r-- | src/core/servers.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core/servers.c b/src/core/servers.c index f74e7f58..0707645c 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -101,12 +101,23 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn) char *tag; int num; - g_return_val_if_fail(IS_SERVER_CONNECT(conn), NULL); + g_return_val_if_fail(IS_SERVER_CONNECT(conn), NULL); tag = conn->chatnet != NULL && *conn->chatnet != '\0' ? g_strdup(conn->chatnet) : server_create_address_tag(conn->address); + if (conn->tag != NULL && server_find_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 + same server and you want to keep the same tags with + the servers (or it would cause problems when rejoining + /LAYOUT SAVEd channels). */ + return g_strdup(conn->tag); + } + + /* 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++) @@ -410,6 +421,7 @@ void server_connect_free(SERVER_CONNECT_REC *conn) g_free_not_null(conn->proxy_string); g_free_not_null(conn->proxy_password); + g_free_not_null(conn->tag); g_free_not_null(conn->address); g_free_not_null(conn->chatnet); |