prawnsalad/KiwiIRC — pull request #533 by tonymke (2014-05-05 05:07:45+00:00)
Title: Do not highlight on own messages

Apologies for the second PR. Looks like I broke the link between the two branches somehow.

Your original comments from #530:

> To get the users nick in the context you're in, use this instead: this.model.get('network').get('nick');. This gets the correct IRC connections nick since there may be more than on IRC connection.

It looks like the model isn't fully initialized when the view is first created. When launching, it looks like some messages are passed to the view before we have an initialized network model, so messages hitting the panel (e.g. the MOTD) end up throwing errors. Once the model is there, it's fine. I left the approach that was initially there (yours?) - grabbing the current active conn's nick.

> usersNick.localeCompare(msg.msg.substring(2, usersNick.length + 2)) !== 0
> This part will break if the * is ever changed (and some people do). I would leave this part out for the time being and we will look into finding a way to compare nicks in a cleaner way.

Ugh I'm sort of embarrassed at how ugly that approach is.
The issue was that while messages and actions coming from the gateway would have a populated nick, ones passed directly to the view (that is, user typing their own message) just had an empty string for the nick. So to solve the issue, I just added the nick in. **I'm not sure if there was a reason it was this way, so reject/change as you see fit.**