diff options
author | Ryan Huber <rhuber@gmail.com> | 2015-07-18 11:12:39 -0400 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2015-07-18 11:12:39 -0400 |
commit | 2fc75391672b6a5a31cc3a07ad457fedcbd76563 (patch) | |
tree | 01048ab1252099c53280db3f29e0b665e7b2fec1 | |
parent | 121877b2a42d923eb52063c12abb248589c5d249 (diff) | |
download | wee-slack-2fc75391672b6a5a31cc3a07ad457fedcbd76563.tar.gz |
dry up exit functions
-rw-r--r-- | wee_slack.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/wee_slack.py b/wee_slack.py index 4540fbc..8ba7716 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1743,6 +1743,17 @@ def config_changed_cb(data, option, value): return w.WEECHAT_RC_OK def quit_notification_cb(signal, sig_type, data): + stop_talking_to_slack() + +def script_unloaded(): + stop_talking_to_slack() + +def stop_talking_to_slack(): + """ + Prevents a race condition where quitting closes buffers + which triggers leaving the channel because of how close + buffer is handled + """ global STOP_TALKING_TO_SLACK STOP_TALKING_TO_SLACK = True cache_write_cb("", "") @@ -1755,12 +1766,6 @@ def scrolled_cb(signal, sig_type, data): channels.find(w.current_buffer()).unset_scrolling() return w.WEECHAT_RC_OK -def script_unloaded(): - global STOP_TALKING_TO_SLACK - STOP_TALKING_TO_SLACK = True - cache_write_cb("", "") - return w.WEECHAT_RC_OK - # END Utility Methods # Main |