1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/CONNECT -ircnet didn't load ircnet specific settings correctly

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1363 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-03-08 00:24:27 +00:00 committed by cras
parent f4fe749489
commit 57493acd39
3 changed files with 23 additions and 20 deletions

View File

@ -63,8 +63,10 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr)
proto = chat_protocol_find_net(optlist);
/* connect to server */
conn = server_create_conn(proto != NULL ? proto->id : -1,
addr, atoi(portstr), password, nick);
chatnet = proto == NULL ? NULL :
g_hash_table_lookup(optlist, proto->chatnet);
conn = server_create_conn(proto != NULL ? proto->id : -1, addr,
atoi(portstr), chatnet, password, nick);
if (proto == NULL)
proto = chat_protocol_find_id(conn->chat_type);
@ -81,12 +83,6 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr)
else if (g_hash_table_lookup(optlist, "4") != NULL)
conn->family = AF_INET;
chatnet = g_hash_table_lookup(optlist, proto->chatnet);
if (chatnet != NULL) {
g_free_not_null(conn->chatnet);
conn->chatnet = g_strdup(chatnet);
}
host = g_hash_table_lookup(optlist, "host");
if (host != NULL && *host != '\0') {
IPADDR ip4, ip6;

View File

@ -189,12 +189,13 @@ static void server_setup_fill_chatnet(SERVER_CONNECT_REC *conn,
static SERVER_CONNECT_REC *
create_addr_conn(int chat_type, const char *address, int port,
const char *password, const char *nick)
const char *chatnet, const char *password,
const char *nick)
{
CHAT_PROTOCOL_REC *proto;
SERVER_CONNECT_REC *conn;
SERVER_SETUP_REC *sserver;
CHATNET_REC *chatnet;
CHATNET_REC *chatnetrec;
g_return_val_if_fail(address != NULL, NULL);
@ -210,16 +211,19 @@ create_addr_conn(int chat_type, const char *address, int port,
chat_protocol_get_default();
conn = proto->create_server_connect();
conn->chat_type = proto->id;
conn->chat_type = proto->id;
if (chatnet != NULL && *chatnet != '\0')
conn->chatnet = g_strdup(chatnet);
/* fill in the defaults */
server_setup_fill(conn, address, port);
/* fill the rest from chat network settings */
chatnet = sserver == NULL || sserver->chatnet == NULL ? NULL :
chatnet_find(sserver->chatnet);
if (chatnet != NULL)
server_setup_fill_chatnet(conn, chatnet);
chatnetrec = chatnet != NULL ? chatnet_find(chatnet) :
(sserver == NULL || sserver->chatnet == NULL ? NULL :
chatnet_find(sserver->chatnet));
if (chatnetrec != NULL)
server_setup_fill_chatnet(conn, chatnetrec);
/* fill the information from setup */
if (sserver != NULL)
@ -271,15 +275,16 @@ create_chatnet_conn(const char *dest, int port,
}
return bestrec == NULL ? NULL :
create_addr_conn(bestrec->chat_type,
bestrec->address, 0, NULL, nick);
create_addr_conn(bestrec->chat_type, bestrec->address, 0,
dest, NULL, nick);
}
/* Create server connection record. `dest' is required, rest can be NULL.
`dest' is either a server address or chat network */
SERVER_CONNECT_REC *
server_create_conn(int chat_type, const char *dest, int port,
const char *password, const char *nick)
const char *chatnet, const char *password,
const char *nick)
{
SERVER_CONNECT_REC *rec;
@ -291,7 +296,8 @@ server_create_conn(int chat_type, const char *dest, int port,
return rec;
}
return create_addr_conn(chat_type, dest, port, password, nick);
return create_addr_conn(chat_type, dest, port,
chatnet, password, nick);
}
/* Find matching server from setup. Try to find record with a same port,

View File

@ -28,7 +28,8 @@ void server_setup_fill_reconn(SERVER_CONNECT_REC *conn,
`dest' is either a server address or chat network */
SERVER_CONNECT_REC *
server_create_conn(int chat_type, const char *dest, int port,
const char *password, const char *nick);
const char *chatnet, const char *password,
const char *nick);
/* Find matching server from setup. Try to find record with a same port,
but fallback to any server with the same address. */