diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-19 02:27:10 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-19 02:27:10 +0000 |
commit | 42634d83bc5a168ddcacf90a18d2180a30e12b6d (patch) | |
tree | 018101f29fa5ba4c5a39abff941195752230f1f5 /src/core/servers-reconnect.c | |
parent | 1ee25967d8c380797d3333006c482ca097cb616f (diff) | |
download | irssi-42634d83bc5a168ddcacf90a18d2180a30e12b6d.zip |
/RECONNECT reconnects now to server with identical settings.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1247 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/servers-reconnect.c')
-rw-r--r-- | src/core/servers-reconnect.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index 756a14a6..bb8b0b45 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -117,7 +117,7 @@ static void sserver_connect(SERVER_SETUP_REC *rec, SERVER_CONNECT_REC *conn) } static SERVER_CONNECT_REC * -server_connect_copy_skeleton(SERVER_CONNECT_REC *src) +server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info) { SERVER_CONNECT_REC *dest; @@ -131,6 +131,12 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src) dest->proxy_port = src->proxy_port; dest->proxy_string = g_strdup(src->proxy_string); + if (connect_info) { + dest->address = g_strdup(src->address); + dest->port = src->port; + dest->password = g_strdup(src->password); + } + dest->chatnet = g_strdup(src->chatnet); dest->nick = g_strdup(src->nick); dest->username = g_strdup(src->username); @@ -164,7 +170,7 @@ static void sig_reconnect(SERVER_REC *server) if (reconnect_time == -1 || !server_should_reconnect(server)) return; - conn = server_connect_copy_skeleton(server->connrec); + conn = server_connect_copy_skeleton(server->connrec, FALSE); g_return_if_fail(conn != NULL); /* save the server status */ @@ -189,8 +195,7 @@ static void sig_reconnect(SERVER_REC *server) /* not in any chatnet, just reconnect back to same server */ conn->address = g_strdup(server->connrec->address); conn->port = server->connrec->port; - conn->password = server->connrec->password == NULL ? NULL : - g_strdup(server->connrec->password); + conn->password = g_strdup(server->connrec->password); if (server->connect_time != 0 && time(NULL)-server->connect_time > reconnect_time) { @@ -293,19 +298,21 @@ static void cmd_reconnect(const char *data, SERVER_REC *server) { SERVER_CONNECT_REC *conn; RECONNECT_REC *rec; - char *str; int tag; if (*data == '\0' && server != NULL) { /* reconnect back to same server */ - str = g_strdup_printf("%s %d %s %s", server->connrec->address, - server->connrec->port, - server->connrec->password == NULL ? "-" : - server->connrec->password, - server->connrec->nick); - signal_emit("command server", 2, str, server); - g_free(str); - return; + conn = server_connect_copy_skeleton(server->connrec, TRUE); + + if (server->connected) { + reconnect_save_status(conn, server); + signal_emit("command disconnect", 2, + "* Reconnecting", server); + } + + conn->reconnection = TRUE; + CHAT_PROTOCOL(conn)->server_connect(conn); + return; } if (*data == '\0') { |