ergochat/irc-go

unify NUH splitting, handle bare nicks

Closed this issue · 3 comments

Currently we have:

  1. ircutils.ParseUserhost
  2. ircevent.SplitNUH
  3. ircevent.ExtractNick

These have subtly different behaviors, and it looks like none of them correctly handle a bare nickname (the ircevent functions will return the empty string, ParseUserhost will interpret it as a username instead of a nick.

These should be consolidated and the behavior made consistent and in line with best practices; in particular they should all handle bare nicks.

We can make a new ircutils.ParseNUH and have that do the right thing. I do need to add a nick-only test to this but this is I think a pretty good summation of how it should interpret results: https://github.com/ircdocs/parser-tests/blob/master/tests/userhost-split.yaml

The upshot of #58 is that the ambiguity between bare nicknames and bare servernames is basically unresolvable. So I'm not sure we even want to do this? The behavior implemented in SplitNUH (returning empty strings in the absence of a full n!u@h) seems like the safest and most correct option. Maybe we should just bring everything into line with that?

This got rebased into #66