1
0
mirror of https://github.com/irssi/irssi.git synced 2024-08-04 03:34:18 -04: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); proto = chat_protocol_find_net(optlist);
/* connect to server */ /* connect to server */
conn = server_create_conn(proto != NULL ? proto->id : -1, chatnet = proto == NULL ? NULL :
addr, atoi(portstr), password, nick); 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) if (proto == NULL)
proto = chat_protocol_find_id(conn->chat_type); 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) else if (g_hash_table_lookup(optlist, "4") != NULL)
conn->family = AF_INET; 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"); host = g_hash_table_lookup(optlist, "host");
if (host != NULL && *host != '\0') { if (host != NULL && *host != '\0') {
IPADDR ip4, ip6; IPADDR ip4, ip6;

View File

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