flackr / circ

An IRC packaged chrome app
BSD 3-Clause "New" or "Revised" License
388 stars 79 forks source link

Preserve intentional underscores when detecting mentions in irc. #354

Open willsheppard opened 8 years ago

willsheppard commented 8 years ago

CIRC like many other IRC clients detects when your name is mentioned and notifies the user. My name is an English word "will", and for that reason my IRC nick is "will_" (trailing underscore) to prevent me being notified when people happen to say "Yes I will do that".

But this trick doesn't work with CIRC! Even though my nick is not mentioned as written, I still get notified every time someone mentions the word "will". I suspect the regex for name matching needs to be a bit more clever about word boundaries and only match the exact nick.

CaptainLexington commented 8 years ago

This seems to be a feature, not a bug. Here: https://github.com/flackr/circ/blob/7c84942223c81ae49e8196d563fac531c5eda185/package/bin/chat/nick_mentioned_notification.js#L45

On line 45 of the nick_mentionednotification file, underscores are specifically filtered out of the nick for matching against. This is because if you lose connectivity and rejoin a server before your original nick pings out, CIRC uses {nick} as your temporary nick, and you would still want to receive mentions directed at your old nick.

flackr commented 8 years ago

But it does sound like it should only strip extra underscores on top of what you've set your nick to.