Fix loading encoding from network list on connect
- Fix setting new encoding when switching networks - Ignore ports when looking for network by hostname - Only set UTF-8 when nothing explicitly set Fixes #1628
This commit is contained in:
parent
ebb0fd6905
commit
7c078db879
3 changed files with 17 additions and 6 deletions
|
@ -3439,10 +3439,9 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to associate this connection with a listed network */
|
/* try to associate this connection with a listed network */
|
||||||
if (!serv->network)
|
/* may return NULL, but that's OK */
|
||||||
/* search for this hostname in the entire server list */
|
if ((serv->network = servlist_net_find_from_server (server_name)))
|
||||||
serv->network = servlist_net_find_from_server (server_name);
|
server_set_encoding (serv, ((ircnet*)serv->network)->encoding);
|
||||||
/* may return NULL, but that's OK */
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1728,7 +1728,8 @@ server_set_defaults (server *serv)
|
||||||
serv->nick_modes = g_strdup ("ohv");
|
serv->nick_modes = g_strdup ("ohv");
|
||||||
serv->sasl_mech = MECH_PLAIN;
|
serv->sasl_mech = MECH_PLAIN;
|
||||||
|
|
||||||
server_set_encoding (serv, "UTF-8");
|
if (!serv->encoding)
|
||||||
|
server_set_encoding (serv, "UTF-8");
|
||||||
|
|
||||||
serv->nickcount = 1;
|
serv->nickcount = 1;
|
||||||
serv->end_of_motd = FALSE;
|
serv->end_of_motd = FALSE;
|
||||||
|
|
|
@ -714,8 +714,19 @@ servlist_net_find_from_server (char *server_name)
|
||||||
slist = net->servlist;
|
slist = net->servlist;
|
||||||
while (slist)
|
while (slist)
|
||||||
{
|
{
|
||||||
|
gsize hostname_len;
|
||||||
|
const char *hostname, *p;
|
||||||
|
|
||||||
serv = slist->data;
|
serv = slist->data;
|
||||||
if (g_ascii_strcasecmp (serv->hostname, server_name) == 0)
|
hostname = serv->hostname;
|
||||||
|
|
||||||
|
/* Ignore port when comparing */
|
||||||
|
if ((p = strchr (hostname, '/')))
|
||||||
|
hostname_len = p - hostname;
|
||||||
|
else
|
||||||
|
hostname_len = strlen (hostname);
|
||||||
|
|
||||||
|
if (g_ascii_strncasecmp (hostname, server_name, hostname_len) == 0)
|
||||||
return net;
|
return net;
|
||||||
slist = slist->next;
|
slist = slist->next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue