mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
Read new server specific settings when reconnecting to new server.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@338 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
db8918ae61
commit
6d77cdc8b7
@ -86,11 +86,8 @@ static void sserver_connect(SETUP_SERVER_REC *rec, IRC_SERVER_CONNECT_REC *conn)
|
||||
{
|
||||
conn->address = g_strdup(rec->address);
|
||||
conn->port = rec->port;
|
||||
conn->password = rec->password == NULL ? NULL :
|
||||
g_strdup(rec->password);
|
||||
if (rec->cmd_queue_speed > 0)
|
||||
conn->cmd_queue_speed = rec->cmd_queue_speed;
|
||||
|
||||
server_setup_fill_conn(conn, rec);
|
||||
if (rec->last_connect > time(NULL)-reconnect_time) {
|
||||
/* can't reconnect this fast, wait.. */
|
||||
server_reconnect_add(conn, rec->last_connect+reconnect_time);
|
||||
@ -102,20 +99,14 @@ static void sserver_connect(SETUP_SERVER_REC *rec, IRC_SERVER_CONNECT_REC *conn)
|
||||
|
||||
static void server_connect_copy_skeleton(IRC_SERVER_CONNECT_REC *dest, IRC_SERVER_CONNECT_REC *src)
|
||||
{
|
||||
dest->proxy = src->proxy == NULL ? NULL :
|
||||
g_strdup(src->proxy);
|
||||
dest->proxy = g_strdup(src->proxy);
|
||||
dest->proxy_port = src->proxy_port;
|
||||
dest->proxy_string = src->proxy_string == NULL ? NULL :
|
||||
g_strdup(src->proxy_string);
|
||||
dest->proxy_string = g_strdup(src->proxy_string);
|
||||
|
||||
dest->ircnet = src->ircnet == NULL ? NULL :
|
||||
g_strdup(src->ircnet);
|
||||
dest->nick = src->nick == NULL ? NULL :
|
||||
g_strdup(src->nick);
|
||||
dest->username = src->username == NULL ? NULL :
|
||||
g_strdup(src->username);
|
||||
dest->realname = src->realname == NULL ? NULL :
|
||||
g_strdup(src->realname);
|
||||
dest->ircnet = g_strdup(src->ircnet);
|
||||
dest->nick = g_strdup(src->nick);
|
||||
dest->username = g_strdup(src->username);
|
||||
dest->realname = g_strdup(src->realname);
|
||||
|
||||
if (src->own_ip != NULL) {
|
||||
dest->own_ip = g_new(IPADDR, 1);
|
||||
|
@ -74,6 +74,24 @@ static void conn_set_ip(IRC_SERVER_CONNECT_REC *conn, IPADDR **own_ip, const cha
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill information to connection from server setup record */
|
||||
void server_setup_fill_conn(IRC_SERVER_CONNECT_REC *conn, SETUP_SERVER_REC *sserver)
|
||||
{
|
||||
if (sserver->own_host != NULL)
|
||||
conn_set_ip(conn, &sserver->own_ip, sserver->own_host);
|
||||
sserver->last_connect = time(NULL);
|
||||
|
||||
if (sserver->ircnet != NULL && conn->ircnet == NULL)
|
||||
conn->ircnet = g_strdup(sserver->ircnet);
|
||||
|
||||
if (sserver->password != NULL && conn->password == NULL)
|
||||
conn->password = g_strdup(sserver->password);
|
||||
if (sserver->cmd_queue_speed > 0)
|
||||
conn->cmd_queue_speed = sserver->cmd_queue_speed;
|
||||
if (sserver->max_cmds_at_once > 0)
|
||||
conn->max_cmds_at_once = sserver->max_cmds_at_once;
|
||||
}
|
||||
|
||||
/* Create server connection record. `address' is required, rest can be NULL */
|
||||
static IRC_SERVER_CONNECT_REC *
|
||||
create_addr_conn(const char *address, int port, const char *password,
|
||||
@ -116,17 +134,7 @@ create_addr_conn(const char *address, int port, const char *password,
|
||||
sserver = server_setup_find(address, -1);
|
||||
if (sserver == NULL) return conn;
|
||||
|
||||
if (sserver->own_host != NULL)
|
||||
conn_set_ip(conn, &sserver->own_ip, sserver->own_host);
|
||||
sserver->last_connect = time(NULL);
|
||||
|
||||
if (sserver->ircnet) conn->ircnet = g_strdup(sserver->ircnet);
|
||||
if (sserver->password && !conn->password)
|
||||
conn->password = g_strdup(sserver->password);
|
||||
if (sserver->cmd_queue_speed > 0)
|
||||
conn->cmd_queue_speed = sserver->cmd_queue_speed;
|
||||
if (sserver->max_cmds_at_once > 0)
|
||||
conn->max_cmds_at_once = sserver->max_cmds_at_once;
|
||||
server_setup_fill_conn(conn, sserver);
|
||||
|
||||
/* fill the rest from IRC network settings */
|
||||
ircnet = sserver->ircnet == NULL ? NULL : ircnet_find(sserver->ircnet);
|
||||
|
@ -32,6 +32,9 @@ extern gboolean source_host_ok; /* Use source_host_ip .. */
|
||||
IRC_SERVER_CONNECT_REC *
|
||||
irc_server_create_conn(const char *dest, int port, const char *password, const char *nick);
|
||||
|
||||
/* Fill information to connection from server setup record */
|
||||
void server_setup_fill_conn(IRC_SERVER_CONNECT_REC *conn, SETUP_SERVER_REC *sserver);
|
||||
|
||||
void server_setup_add(SETUP_SERVER_REC *rec);
|
||||
void server_setup_remove(SETUP_SERVER_REC *rec);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user