Skip to content


Nick/Host lookups should be case-insensitive #11

khaytsus opened this Issue · 4 comments

3 participants


Using /nick_lookup is currently case sensitive and fails to find a user when the case is not exact. I have locally kludged this, but don't think this is the best solution.

in _get_hosts_from_nick
$sth = $DBH->prepare( "SELECT nick, host FROM records WHERE nick = lower(?) " );


I'm not convinced this is the correct behaviour. If we do go this router, I'd suggest having the script run all incoming adds and lookups through a lc() and not having the SQL do the lower().


I probably should have just logged the bug and left my kludgy code out of it :-) Please feel free to fix any way you think is best.


I agree that it should be case-insensitive. IRC itself is case-insensitive when it comes to the protocol, but the display logic preserves case (at least on any IRC server I've ever been on). However, I have seen networks without services where multiple unique users share the same nickname and come and go at different times -- hostnames and the capitalization being the only real differentiating factors.

I would side on a two-fold solution:

  • Give the user the option with a setting like stalker_case_insensitive_search and default to true
  • Use the SQLite lower function as opposed to changing records as they come in, this allows the setting to be changed arbitrarily without impacting the DB's records (or requiring more initialization code to add the upgrade and fix old records).

Correct me if I'm wrong, but I believe the correct syntax for that SQL would be more like:

$sth = $DBH->prepare( "SELECT nick, host FROM records WHERE lower(nick) = ?" );
$sth->execute( lc($query) );

You're right, that syntax is correct for exact matches, I think I pasted my partial match code section. Oops :) And I agree with the config part, on smaller networks this could be something someone would want although these days I'm "only" on about 4 large ones, all with services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.