aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-09-29 00:08:36 +0200
committerGitHub <noreply@github.com>2017-09-29 00:08:36 +0200
commit7f7cebf2c70e827958f9e0ba72e846223002e5cd (patch)
treeaad02e7b225a06667df3c45997f4be12245adf68
parent9fd7ca208bf56cc47796696399f5d603130267e4 (diff)
parent371efb265cdaf532b54ea807c036b34cc2a5bcdb (diff)
downloadwee-slack-7f7cebf2c70e827958f9e0ba72e846223002e5cd.tar.gz
Merge pull request #413 from auscompgeek/buffer-name
Make groups and MPDMs distinguishable by prefix
-rw-r--r--wee_slack.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 5ea3729..42b0dbe 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1184,11 +1184,10 @@ class SlackChannel(object):
w.buffer_set(self.channel_buffer, "hotlist", "1")
def formatted_name(self, style="default", typing=False, **kwargs):
- if config.channel_name_typing_indicator:
- if not typing:
- prepend = "#"
- else:
- prepend = ">"
+ if typing and config.channel_name_typing_indicator:
+ prepend = ">"
+ elif self.type == "group":
+ prepend = config.group_name_prefix
else:
prepend = "#"
select = {
@@ -1646,12 +1645,11 @@ class SlackGroupChannel(SlackChannel):
def __init__(self, eventrouter, **kwargs):
super(SlackGroupChannel, self).__init__(eventrouter, **kwargs)
- self.name = "#" + kwargs['name']
self.type = "group"
self.set_name(self.slack_name)
def set_name(self, slack_name):
- self.name = "#" + slack_name
+ self.name = config.group_name_prefix + slack_name
# def formatted_name(self, prepend="#", enable_color=True, basic=False):
# return prepend + self.slack_name
@@ -1678,18 +1676,19 @@ class SlackMPDMChannel(SlackChannel):
self.eventrouter.receive(s)
# self.create_buffer()
+ @staticmethod
+ def adjust_name(n):
+ return "|".join("-".join(n.split("-")[1:-1]).split("--"))
+
def set_name(self, n):
- self.name = "|".join("-".join(n.split("-")[1:-1]).split("--"))
+ self.name = self.adjust_name(n)
def formatted_name(self, style="default", typing=False, **kwargs):
- adjusted_name = "|".join("-".join(self.slack_name.split("-")[1:-1]).split("--"))
- if config.channel_name_typing_indicator:
- if not typing:
- prepend = "#"
- else:
- prepend = ">"
+ adjusted_name = self.adjust_name(self.slack_name)
+ if typing and config.channel_name_typing_indicator:
+ prepend = ">"
else:
- prepend = "#"
+ prepend = "@"
select = {
"default": adjusted_name,
"sidebar": prepend + adjusted_name,
@@ -3390,6 +3389,9 @@ class PluginConfig(object):
'distracting_channels': Setting(
default='',
desc='List of channels to hide.'),
+ 'group_name_prefix': Setting(
+ default='&',
+ desc='The prefix of buffer names for groups (private channels).'),
'map_underline_to': Setting(
default='_',
desc='When sending underlined text to slack, use this formatting'
@@ -3500,6 +3502,7 @@ class PluginConfig(object):
return int(w.config_get_plugin(key))
get_debug_level = get_int
+ get_group_name_prefix = get_string
get_map_underline_to = get_string
get_render_bold_as = get_string
get_render_italic_as = get_string