From 57dd75afaa84c94fc9c76116eaa2e1406168d411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Sun, 5 Oct 2014 22:54:55 +0200 Subject: [PATCH] Handle WeeChat -a/--no-autoconnect flag. --- src/twc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/twc.c b/src/twc.c index b59b2aa..3833911 100644 --- a/src/twc.c +++ b/src/twc.c @@ -59,8 +59,17 @@ weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[]) twc_config_init(); twc_config_read(); - // TODO: respect weechat flag for no autoconnect - twc_profile_autoload(); + bool no_autoconnect = false; + for (int i = 0; i < argc; i++) + { + if (weechat_strcasecmp(argv[i], "-a") == 0 + || weechat_strcasecmp(argv[i], "--no-connect") == 0) + { + no_autoconnect = true; + } + } + if (!no_autoconnect) + twc_profile_autoload(); return WEECHAT_RC_OK; }