diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-04-18 10:28:52 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-04-18 10:29:36 +0200 |
commit | cd4f3ce111075adf60d47e3c3aefd5848d41b47c (patch) | |
tree | 9f700349cd3bd5cf12f51beea15410ec3b759666 /wee_slack.py | |
parent | ecf30aadb4780d2e83b56dd312402c6ecc53c931 (diff) | |
download | wee-slack-cd4f3ce111075adf60d47e3c3aefd5848d41b47c.tar.gz |
Don't connect to the teams if auto connect is disabled
Fixes #613
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/wee_slack.py b/wee_slack.py index 200926f..30b9896 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -5244,17 +5244,18 @@ if __name__ == "__main__": EMOJI, EMOJI_WITH_SKIN_TONES_REVERSE = load_emoji() setup_hooks() - # attach to the weechat hooks we need - - tokens = [token.strip() for token in config.slack_api_token.split(',')] - w.prnt('', 'Connecting to {} slack team{}.' - .format(len(tokens), '' if len(tokens) == 1 else 's')) - for t in tokens: - s = initiate_connection(t) - EVENTROUTER.receive(s) if config.record_events: EVENTROUTER.record() - EVENTROUTER.handle_next() - # END attach to the weechat hooks we need hdata = Hdata(w) + + auto_connect = weechat.info_get("auto_connect", "") != "0" + + if auto_connect: + tokens = [token.strip() for token in config.slack_api_token.split(',')] + w.prnt('', 'Connecting to {} slack team{}.' + .format(len(tokens), '' if len(tokens) == 1 else 's')) + for t in tokens: + s = initiate_connection(t) + EVENTROUTER.receive(s) + EVENTROUTER.handle_next() |