diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-14 22:27:11 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-14 22:27:11 +0200 |
commit | 484abc68fc719c668eec3b000adaac750737aa5c (patch) | |
tree | 0643894d2c173fc17860e4617ca11a8d50b4064f /src/plugins/relay/relay.c | |
parent | f116061868a96a337d174cd03588299d7372edd6 (diff) | |
download | weechat-484abc68fc719c668eec3b000adaac750737aa5c.zip |
relay: add option "autoconnect" in remote
This option enables auto-connection to the remote, unless command line option
`-a` (`--no-connect`) is given.
Diffstat (limited to 'src/plugins/relay/relay.c')
-rw-r--r-- | src/plugins/relay/relay.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c index b81d08ac7..026a5fa4d 100644 --- a/src/plugins/relay/relay.c +++ b/src/plugins/relay/relay.c @@ -245,6 +245,9 @@ relay_debug_dump_cb (const void *pointer, void *data, int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { + int auto_connect; + char *info_auto_connect; + /* make C compiler happy */ (void) argc; (void) argv; @@ -282,7 +285,19 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) relay_info_init (); if (weechat_relay_plugin->upgrading) + { relay_upgrade_load (); + } + else + { + /* check if auto-connect is enabled */ + info_auto_connect = weechat_info_get ("auto_connect", NULL); + auto_connect = (info_auto_connect && (strcmp (info_auto_connect, "1") == 0)) ? + 1 : 0; + free (info_auto_connect); + if (auto_connect) + relay_remote_auto_connect (); + } relay_hook_timer = weechat_hook_timer (1 * 1000, 0, 0, &relay_client_timer_cb, NULL, NULL); |