summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-01-06 21:05:38 +0100
committerSébastien Helleu <flashcode@flashtux.org>2015-01-06 21:05:38 +0100
commit8f668bb18ca50c06b6d3012e6bf656524f149410 (patch)
tree6936925c5a59cc1e5d6a5a66658e6f74d59da13d /src/plugins/irc
parentca5aa6695f13637ec23f471408e82ce45cc60710 (diff)
downloadweechat-8f668bb18ca50c06b6d3012e6bf656524f149410.zip
irc: defer the auto-connection to servers with a timer (closes #279, task #13038)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-server.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 2213cca43..2f6d8329f 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -4415,16 +4415,19 @@ irc_server_reconnect (struct t_irc_server *server)
}
/*
- * Auto-connects to servers (called at startup).
- *
- * If auto_connect == 1, auto-connects to all servers with flag "autoconnect".
- * If auto_connect == 0, auto-connect to temporary servers only.
+ * Callback for auto-connect to servers (called at startup).
*/
-void
-irc_server_auto_connect (int auto_connect)
+int
+irc_server_auto_connect_timer_cb (void *data, int remaining_calls)
{
struct t_irc_server *ptr_server;
+ int auto_connect;
+
+ /* make C compiler happy */
+ (void) remaining_calls;
+
+ auto_connect = (int)data;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -4436,6 +4439,22 @@ irc_server_auto_connect (int auto_connect)
irc_server_reconnect_schedule (ptr_server);
}
}
+
+ return WEECHAT_RC_OK;
+}
+
+/*
+ * Auto-connects to servers (called at startup).
+ *
+ * If auto_connect == 1, auto-connects to all servers with flag "autoconnect".
+ * If auto_connect == 0, auto-connect to temporary servers only.
+ */
+
+void
+irc_server_auto_connect (int auto_connect)
+{
+ weechat_hook_timer (1, 0, 1, &irc_server_auto_connect_timer_cb,
+ (auto_connect) ? (void *)1 : (void *)0);
}
/*