diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-08-20 15:48:10 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-08-20 15:48:10 +0200 |
commit | c561fb7de35175fa5db58aef3ce227ba3cf9eedb (patch) | |
tree | 9217d3a986837e5ebd7b50e29ad50ddbaec4a249 | |
parent | 14ea3ef85acfa3e08ee067fb3fe4dcb0342327f5 (diff) | |
download | wee-slack-c561fb7de35175fa5db58aef3ce227ba3cf9eedb.tar.gz |
Set correct localvar type for threads in pms
Previously threads in pms had localvar type set to channel. Now the type
is set to the same as the parent channel.
Fixes #789
-rw-r--r-- | wee_slack.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/wee_slack.py b/wee_slack.py index 993fe01..1aaa069 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -348,6 +348,13 @@ def format_exc_only(): return ''.join(decode_from_utf8(traceback.format_exception_only(etype, value))) +def get_localvar_type(slack_type): + if slack_type in ("im", "mpim"): + return "private" + else: + return "channel" + + def get_nick_color(nick): info_name_prefix = "irc_" if weechat_version < 0x1050000 else "" return w.info_get(info_name_prefix + "nick_color_name", nick) @@ -1963,10 +1970,7 @@ class SlackChannel(SlackChannelCommon): self.channel_buffer = w.buffer_new(self.formatted_name(style="long_default"), "buffer_input_callback", "EVENTROUTER", "", "") self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self) w.buffer_set(self.channel_buffer, "input_multiline", "1") - if self.type in ("im", "mpim"): - w.buffer_set(self.channel_buffer, "localvar_set_type", 'private') - else: - w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel') + w.buffer_set(self.channel_buffer, "localvar_set_type", get_localvar_type(self.type)) w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type) w.buffer_set(self.channel_buffer, "localvar_set_channel", self.formatted_name()) w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick) @@ -2595,7 +2599,7 @@ class SlackThreadChannel(SlackChannelCommon): self.channel_buffer = w.buffer_new(self.formatted_name(style="long_default"), "buffer_input_callback", "EVENTROUTER", "", "") self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self) w.buffer_set(self.channel_buffer, "input_multiline", "1") - w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel') + w.buffer_set(self.channel_buffer, "localvar_set_type", get_localvar_type(self.parent_channel.type)) w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type) w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick) w.buffer_set(self.channel_buffer, "localvar_set_channel", self.formatted_name()) |