aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 6ffc994..3d11a06 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1940,6 +1940,7 @@ class SlackChannelCommon(object):
message.ts,
tagset=tagset,
tag_nick=message.sender_plain,
+ prefix_color=message.prefix_color,
history_message=history_message,
no_log=no_log,
extra_tags=extra_tags,
@@ -2468,6 +2469,7 @@ class SlackChannel(SlackChannelCommon):
timestamp,
tagset,
tag_nick=None,
+ prefix_color=None,
history_message=False,
no_log=False,
extra_tags=None,
@@ -2491,6 +2493,7 @@ class SlackChannel(SlackChannelCommon):
tagset,
user=tag_nick,
self_msg=self_msg,
+ prefix_color=prefix_color,
backlog=backlog,
no_log=no_log,
extra_tags=extra_tags,
@@ -3095,6 +3098,7 @@ class SlackThreadChannel(SlackChannelCommon):
timestamp,
tagset,
tag_nick=None,
+ prefix_color=None,
history_message=False,
no_log=False,
extra_tags=None,
@@ -3115,6 +3119,7 @@ class SlackThreadChannel(SlackChannelCommon):
tagset,
user=tag_nick,
self_msg=self_msg,
+ prefix_color=prefix_color,
backlog=backlog,
no_log=no_log,
extra_tags=extra_tags,
@@ -3481,6 +3486,14 @@ class SlackMessage(object):
def sender_plain(self):
return self.get_sender(True)
+ @property
+ def prefix_color(self):
+ user = self.team.users.get(self.user_identifier)
+ if user:
+ return user.color_name
+ else:
+ return get_nick_color(self.sender_plain)
+
def get_reaction(self, reaction_name):
for reaction in self.message_json.get("reactions", []):
if reaction["name"] == reaction_name:
@@ -5018,6 +5031,9 @@ def nick_from_profile(profile, username):
def format_nick(nick, previous_nick=None):
+ if weechat_version >= 0x04000000:
+ return nick
+
if nick == previous_nick:
nick = w.config_string(w.config_get("weechat.look.prefix_same_nick")) or nick
nick_prefix = w.config_string(w.config_get("weechat.look.nick_prefix"))
@@ -5048,6 +5064,7 @@ def tag(
tagset=None,
user=None,
self_msg=False,
+ prefix_color=None,
backlog=False,
no_log=False,
extra_tags=None,
@@ -5064,7 +5081,12 @@ def tag(
ts_tag = "slack_ts_{}".format(ts)
slack_tag = "slack_{}".format(tagset or "default")
nick_tag = ["nick_{}".format(user).replace(" ", "_")] if user else []
- tags = [ts_tag, slack_tag] + nick_tag + tagsets.get(tagset, [])
+ prefix_nick_tag = (
+ ["prefix_nick_{}".format(prefix_color.replace(",", ":"))]
+ if prefix_color and weechat_version >= 0x04000000
+ else []
+ )
+ tags = [ts_tag, slack_tag] + nick_tag + prefix_nick_tag + tagsets.get(tagset, [])
if self_msg or backlog:
tags = tags_set_notify_none(tags)
if self_msg: