aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-01-27 18:51:53 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2019-01-27 18:52:08 +0100
commit9c178fb3346550f547e9198dbaca05f871ff85f5 (patch)
tree3ed1321e51df045a6beb73062a3b61fc3ae129d3 /wee_slack.py
parent6fb7a1532b6032d00422703769a2b6b117bfef3c (diff)
downloadwee-slack-9c178fb3346550f547e9198dbaca05f871ff85f5.tar.gz
Don't override server_aliases with short_buffer_names
There's no reason to not use the server aliases even when short_buffer_names is on. Now, it will use server aliases for the servers that has it defined, and short names for the rest if short_buffer_names is on.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 1eb3bab..74027a5 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1087,15 +1087,14 @@ class SlackTeam(object):
def create_buffer(self):
if not self.channel_buffer:
- if config.short_buffer_names:
+ alias = config.server_aliases.get(self.subdomain)
+ if alias:
+ self.preferred_name = alias
+ elif config.short_buffer_names:
self.preferred_name = self.subdomain
- elif config.server_aliases not in ['', None]:
- name = config.server_aliases.get(self.subdomain, None)
- if name:
- self.preferred_name = name
else:
self.preferred_name = self.domain
- self.channel_buffer = w.buffer_new("{}".format(self.preferred_name), "buffer_input_callback", "EVENTROUTER", "", "")
+ self.channel_buffer = w.buffer_new(self.preferred_name, "buffer_input_callback", "EVENTROUTER", "", "")
self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
w.buffer_set(self.channel_buffer, "localvar_set_type", 'server')
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.nick)
@@ -4112,7 +4111,7 @@ class PluginConfig(object):
'short_buffer_names': Setting(
default='false',
desc='Use `foo.#channel` rather than `foo.slack.com.#channel` as the'
- ' internal name for Slack buffers. Overrides server_aliases.'),
+ ' internal name for Slack buffers.'),
'show_buflist_presence': Setting(
default='true',
desc='Display a `+` character in the buffer list for present users.'),
@@ -4229,8 +4228,7 @@ class PluginConfig(object):
def get_server_aliases(self, key):
alias_list = w.config_get_plugin(key)
- if len(alias_list) > 0:
- return dict(item.split(":") for item in alias_list.split(","))
+ return dict(item.split(":") for item in alias_list.split(",") if ':' in item)
def get_slack_api_token(self, key):
token = w.config_get_plugin("slack_api_token")