Wee-slack: Broken DM notification handling

Created on 14 Mar 2018  路  8Comments  路  Source: wee-slack/wee-slack

So, I've been wondering why I was getting notifications for my own messages and I've added logging here ~ https://github.com/wee-slack/wee-slack/blob/master/wee_slack.py#L1374-L1379:

w.prnt("", "nick: '{}', self.team.nick: '{}', eq: {}, types: {}, {}".format(repr(nick[4:]), repr(self.team.nick), nick == self.team.nick, type(nick), type(self.team.nick))

And I got following output which is why comparison fails and my messages are treated as if I didn't send them myself:

19:38 nick: 'u'\x19F16luk1337'', self.team.nick: 'u'luk1337'', eq: False, types: <type 'unicode'>, <type 'unicode'>

For now I just replaced the comparison with nick[4:] != self.team.nick but that doesn't sound like a legitimate solution. Is there anything I should try to fix this properly?

Most helpful comment

diff --git a/wee_slack.py b/wee_slack.py index 14d56f0..53cd395 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1372,7 +1372,7 @@ class SlackChannel(object): elif ts <= last_read: tags = tag("backlog", user=tag_nick) elif self.type in ["im", "mpdm"]: - if nick != self.team.nick: + if tag_nick != self.team.nick: tags = tag("dm", user=tag_nick) self.new_messages = True else:
might be a plausible workaround for this, leaving this here so we don't forget.

All 8 comments

Oh also /me seems to send me notifications too lol.

Yeah, I keep getting notifications on my phone which uses weechat-android.

diff --git a/wee_slack.py b/wee_slack.py index 14d56f0..53cd395 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1372,7 +1372,7 @@ class SlackChannel(object): elif ts <= last_read: tags = tag("backlog", user=tag_nick) elif self.type in ["im", "mpdm"]: - if nick != self.team.nick: + if tag_nick != self.team.nick: tags = tag("dm", user=tag_nick) self.new_messages = True else:
might be a plausible workaround for this, leaving this here so we don't forget.

The above seemed to have fixed the beep for me.

It's been working well for the half hour I've been using it :).

Thanks for testing and feedback, now to figure out what's the best way to properly do this, since the code above is more of a hack.

I think your change is actually the way to go since nick is the name with color (\x19F16 is white) while tag_nick is the name without it. nick used to be the same as tag_nick (no color) so the comparison worked before, but that changed in 826c46b (which properly colors your nick in messages).

I pushed this as the fix. I think there was something more that needed fixing, but I no longer remember and this is an improvement on the previous state, so I'll leave at at this for now. :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tedwardd picture tedwardd  路  7Comments

deflax picture deflax  路  5Comments

neverfox picture neverfox  路  4Comments

SevereOverfl0w picture SevereOverfl0w  路  3Comments

GideonWolfe picture GideonWolfe  路  4Comments