aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py17
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