Match id names case-insensitively

This fixes the case where an IRCd does not normalize channel names,
e.g. PRIVMSG #TEST is relayed as-is, rather than as #test or whatever
the canonical casing of the channel name is. It also fixes the case
of opening a query window with incorrect case, e.g. /query nickserv.

However, this solution is only completely correct when
CASEMAPPING=ascii.[1] I do not think the extra mappings of
CASEMAPPING=rfc1459 are relevant enough to justify adding the code
to handle it.

[1]: https://modern.ircdocs.horse/#casemapping-parameter
master
C. McEnroe 2021-08-26 12:59:57 -04:00
parent 1f800bcf69
commit be9bffdf49
1 changed files with 2 additions and 1 deletions

3
chat.h
View File

@ -34,6 +34,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <sysexits.h>
#include <time.h>
#include <wchar.h>
@ -119,7 +120,7 @@ extern uint idNext;
static inline uint idFind(const char *name) {
for (uint id = 0; id < idNext; ++id) {
if (!strcmp(idNames[id], name)) return id;
if (!strcasecmp(idNames[id], name)) return id;
}
return None;
}