diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-11 18:36:19 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-11 18:45:05 +0200 |
commit | 3f4e64ce8fa5657ac04d33ce1e580fa8b06dc607 (patch) | |
tree | 87d035af8af37552a9d37f386c73ef25cbb0a080 /wee_slack.py | |
parent | c60c1870e7e64a929ecfb9f605e1c14f7ecdf62a (diff) | |
download | wee-slack-3f4e64ce8fa5657ac04d33ce1e580fa8b06dc607.tar.gz |
Remove log* tags when using no_log
When including both a log tag and a no_log tag, the message may be
logged.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/wee_slack.py b/wee_slack.py index ee74612..5f016e1 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1775,13 +1775,9 @@ class SlackChannel(SlackChannelCommon): else: tagset = "channel" - if history_message and backlog: - if extra_tags is None: - extra_tags = [] - extra_tags.append("no_log") - + no_log = history_message and backlog self_msg = tag_nick == self.team.nick - tags = tag(tagset, user=tag_nick, self_msg=self_msg, backlog=backlog, extra_tags=extra_tags) + tags = tag(tagset, user=tag_nick, self_msg=self_msg, backlog=backlog, no_log=no_log, extra_tags=extra_tags) try: if (config.unhide_buffers_with_activity @@ -1834,7 +1830,7 @@ class SlackChannel(SlackChannelCommon): if self.team.connected: self.clear_messages() w.prnt_date_tags(self.channel_buffer, SlackTS().major, - tag(backlog=True, extra_tags=['no_log']), '\tgetting channel history...') + tag(backlog=True, no_log=True), '\tgetting channel history...') s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["history"], {"channel": self.identifier, "count": BACKLOG_SIZE}, team_hash=self.team.team_hash, channel_identifier=self.identifier, clear=True) if not slow_queue: self.eventrouter.receive(s) @@ -3493,7 +3489,7 @@ def format_nick(nick, previous_nick=None): return nick_prefix_color + nick_prefix + w.color("reset") + nick + nick_suffix_color + nick_suffix + w.color("reset") -def tag(tagset=None, user=None, self_msg=False, backlog=False, extra_tags=None): +def tag(tagset=None, user=None, self_msg=False, backlog=False, no_log=False, extra_tags=None): tagsets = { "team_info": {"no_highlight", "log3"}, "team_message": {"irc_privmsg", "notify_message", "log1"}, @@ -3513,6 +3509,9 @@ def tag(tagset=None, user=None, self_msg=False, backlog=False, extra_tags=None): tags |= {"self_msg"} if backlog: tags |= {"logger_backlog"} + if no_log: + tags |= {"no_log"} + tags = {tag for tag in tags if not tag.startswith("log")} if extra_tags: tags |= set(extra_tags) return ",".join(tags) |