diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-02-13 19:32:54 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-02-23 18:55:07 +0100 |
commit | 3280e1a188875d4e769497f6f14ab674c5feb2d6 (patch) | |
tree | 1797d64b10fb2a13fc1c9c14a4d735204513f826 /wee_slack.py | |
parent | 2c74d66ea9ef30ed83da762313e6320685a2916d (diff) | |
download | wee-slack-3280e1a188875d4e769497f6f14ab674c5feb2d6.tar.gz |
(Un)merge team buffers when irc.look.server_buffer is changed
Fixes #712
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py index 7f4d3d8..d6934d3 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1312,8 +1312,15 @@ class SlackTeam(object): w.buffer_set(self.channel_buffer, "localvar_set_type", 'server') w.buffer_set(self.channel_buffer, "localvar_set_nick", self.nick) w.buffer_set(self.channel_buffer, "localvar_set_server", self.preferred_name) - if w.config_string(w.config_get('irc.look.server_buffer')) == 'merge_with_core': - w.buffer_merge(self.channel_buffer, w.buffer_search_main()) + self.buffer_merge() + + def buffer_merge(self, config_value=None): + if not config_value: + config_value = w.config_string(w.config_get('irc.look.server_buffer')) + if config_value == 'merge_with_core': + w.buffer_merge(self.channel_buffer, w.buffer_search_main()) + else: + w.buffer_unmerge(self.channel_buffer, 0) def destroy_buffer(self, update_remote): pass @@ -4836,6 +4843,11 @@ class PluginConfig(object): w.config_set_plugin("color_thread_suffix", old_thread_color_config) +def config_server_buffer_cb(data, key, value): + for team in EVENTROUTER.teams.values(): + team.buffer_merge(value) + return w.WEECHAT_RC_OK + # to Trace execution, add `setup_trace()` to startup # and to a function and sys.settrace(trace_calls) to a function @@ -4902,6 +4914,7 @@ if __name__ == "__main__": hide_distractions = False w.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_changed_cb", "") + w.hook_config("irc.look.server_buffer", "config_server_buffer_cb", "") w.hook_modifier("input_text_for_buffer", "input_text_for_buffer_cb", "") EMOJI, EMOJI_WITH_SKIN_TONES_REVERSE = load_emoji() |