mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 12:53:42 +02:00
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
This commit is contained in:
parent
bd7cc25590
commit
7773aabb2c
4 changed files with 22 additions and 6 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue