summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-11-03 13:11:10 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-11-03 13:11:10 +0100
commite62cf7c57d443682ce3308e4bb58238b98414fac (patch)
tree544080073099bdac21e29819274bca8bcb76b258 /src/plugins/irc
parentc87558d3dbe979fd2924a1d2d35efaf7d344044e (diff)
downloadweechat-e62cf7c57d443682ce3308e4bb58238b98414fac.zip
irc: auto-connect to servers created with "irc://" on command line but not other servers if "-a" ("--no-connect") is given
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-server.c9
-rw-r--r--src/plugins/irc/irc-server.h2
-rw-r--r--src/plugins/irc/irc.c3
3 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index d4ce9ae41..eb76285e5 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -3497,17 +3497,22 @@ irc_server_reconnect (struct t_irc_server *server)
/*
* irc_server_auto_connect: auto-connect to servers (called at startup)
+ * if auto_connect = 1, auto connect to all servers
+ * with flag "autoconnect"
+ * = 0, auto connect to temp servers
+ * only (created with "irc://..")
*/
void
-irc_server_auto_connect ()
+irc_server_auto_connect (int auto_connect)
{
struct t_irc_server *ptr_server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
- if (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_AUTOCONNECT))
+ if ((auto_connect || ptr_server->temp_server)
+ && (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_AUTOCONNECT)))
{
if (!irc_server_connect (ptr_server))
irc_server_reconnect_schedule (ptr_server);
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 14c58802d..86f5254bf 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -250,7 +250,7 @@ extern struct t_irc_server *irc_server_search (const char *server_name);
extern void irc_server_set_buffer_title (struct t_irc_server *server);
extern struct t_gui_buffer *irc_server_create_buffer (struct t_irc_server *server);
extern int irc_server_connect (struct t_irc_server *server);
-extern void irc_server_auto_connect ();
+extern void irc_server_auto_connect (int auto_connect);
extern void irc_server_autojoin_channels ();
extern int irc_server_recv_cb (void *data, int fd);
extern int irc_server_timer_sasl_cb (void *data, int remaining_calls);
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index 0703273a8..3ebaacd1b 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -233,8 +233,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
}
else
{
- if (auto_connect)
- irc_server_auto_connect ();
+ irc_server_auto_connect (auto_connect);
}
irc_hook_timer = weechat_hook_timer (1 * 1000, 0, 0,