diff options
author | Tollef Fog Heen <tfheen@err.no> | 2018-06-11 21:19:36 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-06-11 21:19:36 +0200 |
commit | a8b11534fbb5d9543f8b556a5ac4fc1d7b219486 (patch) | |
tree | 53e46d37be18a9cc24ddd56ec4c7f88b53b6fe7d /wee_slack.py | |
parent | eea510fb7839a0269fc637a9d91bb935bef60486 (diff) | |
download | wee-slack-a8b11534fbb5d9543f8b556a5ac4fc1d7b219486.tar.gz |
Re-add support for prefix_same_nick (#590)
Remember the last nick printed and re-add support prefix_same_nick.
Fixes: #357
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index 284b08b..c0eda21 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1248,6 +1248,7 @@ class SlackChannel(object): self.current_short_name = self.name self.set_members(kwargs.get('members', [])) self.unread_count_display = 0 + self.last_line_from = None def __eq__(self, compare_str): if compare_str == self.slack_name or compare_str == self.formatted_name() or compare_str == self.formatted_name(style="long_default"): @@ -1406,7 +1407,8 @@ class SlackChannel(object): self.eventrouter.receive(s) def buffer_prnt(self, nick, text, timestamp=str(time.time()), tagset=None, tag_nick=None, **kwargs): - data = "{}\t{}".format(format_nick(nick), text) + data = "{}\t{}".format(format_nick(nick, self.last_line_from), text) + self.last_line_from = nick ts = SlackTS(timestamp) last_read = SlackTS(self.last_read) # without this, DMs won't open automatically @@ -1833,6 +1835,7 @@ class SlackThreadChannel(object): self.label = None self.members = self.parent_message.channel.members self.team = self.parent_message.team + self.last_line_from = None # self.set_name(self.slack_name) # def set_name(self, slack_name): # self.name = "#" + slack_name @@ -1855,7 +1858,8 @@ class SlackThreadChannel(object): w.buffer_set(self.channel_buffer, "hotlist", "-1") def buffer_prnt(self, nick, text, timestamp, **kwargs): - data = "{}\t{}".format(format_nick(nick), text) + data = "{}\t{}".format(format_nick(nick, self.last_line_from), text) + self.last_line_from = nick ts = SlackTS(timestamp) if self.channel_buffer: # backlog messages - we will update the read marker as we print these @@ -3016,7 +3020,9 @@ def modify_print_time(buffer, new_id, time): return w.WEECHAT_RC_OK -def format_nick(nick): +def format_nick(nick, previous_nick=None): + 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')) nick_prefix_color_name = w.config_string(w.config_get('weechat.color.chat_nick_prefix')) nick_prefix_color = w.color(nick_prefix_color_name) |