summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-03 04:31:17 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-03 04:31:17 +0000
commitc8a90566caa3bd2d81d4348708c5019036267065 (patch)
treecf5b7f5c761a124928f5fde60a578bc8832a34ac /src
parent03b33224323d909314af440dab513dea66fd8ec5 (diff)
downloadirssi-c8a90566caa3bd2d81d4348708c5019036267065.zip
/RECONNECT without any parameters and when not connected to any server
reconnects to first server in reconnect list. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@936 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/core/servers-reconnect.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c
index 0541d1b2..cfe19acc 100644
--- a/src/core/servers-reconnect.c
+++ b/src/core/servers-reconnect.c
@@ -290,9 +290,8 @@ static void cmd_reconnect(const char *data, SERVER_REC *server)
char *str;
int tag;
- if (*data == '\0') {
+ if (*data == '\0' && server != NULL) {
/* reconnect back to same server */
- if (server == NULL) cmd_return_error(CMDERR_NOT_CONNECTED);
str = g_strdup_printf("%s %d %s %s", server->connrec->address,
server->connrec->port, server->connrec->password,
server->connrec->nick);
@@ -301,19 +300,25 @@ static void cmd_reconnect(const char *data, SERVER_REC *server)
return;
}
- if (g_strncasecmp(data, "RECON-", 6) == 0)
- data += 6;
+ if (*data == '\0') {
+ /* reconnect to first server in reconnection list */
+ if (reconnects == NULL)
+ cmd_return_error(CMDERR_NOT_CONNECTED);
+ rec = reconnects->data;
+ } else {
+ if (g_strncasecmp(data, "RECON-", 6) == 0)
+ data += 6;
- tag = atoi(data);
- rec = tag <= 0 ? NULL : reconnect_find_tag(tag);
+ tag = atoi(data);
+ rec = tag <= 0 ? NULL : reconnect_find_tag(tag);
- if (rec == NULL)
- signal_emit("server reconnect not found", 1, data);
- else {
- conn = rec->conn;
- server_reconnect_destroy(rec, FALSE);
- server_connect(conn);
+ if (rec == NULL)
+ signal_emit("server reconnect not found", 1, data);
}
+
+ conn = rec->conn;
+ server_reconnect_destroy(rec, FALSE);
+ server_connect(conn);
}
static void cmd_disconnect(const char *data, SERVER_REC *server)