aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-22 23:18:29 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-05-23 00:01:55 +0200
commita4871067b5c89ba45bc0575dda9c5e864a626038 (patch)
tree8630168461fcaddcfd7bdab6f1be4e765d1c2841
parent87480a91372c7f893e08fbde6b46981bac14636a (diff)
downloadwee-slack-a4871067b5c89ba45bc0575dda9c5e864a626038.tar.gz
Combine channel rename methods
This fixes typing indicators for mpdms, which was previously not working.
-rw-r--r--wee_slack.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/wee_slack.py b/wee_slack.py
index ee0e8bd..aefa27f 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1694,8 +1694,10 @@ class SlackChannel(SlackChannelCommon):
if self.channel_buffer:
if typing is None:
typing = self.is_someone_typing()
- name = self.formatted_name("long_default", typing)
- short_name = self.formatted_name("sidebar", typing)
+ present = self.team.is_user_present(self.user) if self.type == "im" else None
+
+ name = self.formatted_name("long_default", typing, present)
+ short_name = self.formatted_name("sidebar", typing, present)
w.buffer_set(self.channel_buffer, "name", name)
w.buffer_set(self.channel_buffer, "short_name", short_name)
@@ -1714,7 +1716,7 @@ class SlackChannel(SlackChannelCommon):
else:
w.buffer_set(self.channel_buffer, "hotlist", "1")
- def formatted_name(self, style="default", typing=False, **kwargs):
+ def formatted_name(self, style="default", typing=False, present=None, **kwargs):
if style == "sidebar" and typing and config.channel_name_typing_indicator:
prepend = ">"
elif self.type == "group" or self.type == "private":
@@ -2111,14 +2113,6 @@ class SlackDMChannel(SlackChannel):
s = SlackRequest(self.team, join_method, {"users": self.user, "return_im": True}, channel=self)
self.eventrouter.receive(s)
- def rename(self, typing=None):
- if self.channel_buffer:
- present = self.team.is_user_present(self.user)
- name = self.formatted_name("long_default", typing, present)
- short_name = self.formatted_name("sidebar", typing, present)
- w.buffer_set(self.channel_buffer, "name", name)
- w.buffer_set(self.channel_buffer, "short_name", short_name)
-
class SlackGroupChannel(SlackChannel):
"""
@@ -2176,7 +2170,7 @@ class SlackMPDMChannel(SlackChannel):
s = SlackRequest(self.team, join_method, {'users': ','.join(self.members)}, channel=self)
self.eventrouter.receive(s)
- def formatted_name(self, style="default", typing=False, **kwargs):
+ def formatted_name(self, style="default", typing=False, present=None, **kwargs):
if style == "sidebar":
if typing and config.channel_name_typing_indicator:
prepend = ">"
@@ -2188,9 +2182,6 @@ class SlackMPDMChannel(SlackChannel):
else:
return self.slack_name
- def rename(self, typing=None):
- pass
-
class SlackSharedChannel(SlackChannel):
def __init__(self, eventrouter, **kwargs):