about summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-08-26 12:59:57 -0400
committerJune McEnroe <june@causal.agency>2021-08-26 12:59:57 -0400
commitbe9bffdf497594aa321b620093cef1f180764576 (patch)
tree034c4e50530c7ffafc76767ba39401eca13efff8 /chat.h
parentRemove trailing tab (diff)
downloadtest-be9bffdf497594aa321b620093cef1f180764576.tar.gz
test-be9bffdf497594aa321b620093cef1f180764576.zip
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
Diffstat (limited to '')
-rw-r--r--chat.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/chat.h b/chat.h
index dd9c823..d9d9bdc 100644
--- a/chat.h
+++ b/chat.h
@@ -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;
 }
... And of course server-time which pounce implements itself. 2019-11-09Avoid the reserved _A names with BIT macroJune McEnroe 2019-11-09Define macro for bit flag enumsJune McEnroe 2019-11-08Check that password is hashedJune McEnroe 2019-11-08Avoid calling getopt_long again after it returns -1June McEnroe On GNU, calling getopt_long again will reset optind back to the first non-option argument, which would cause an infinite loop of reading the same configurtion file forever. 2019-11-08Only change AWAY status for registered clientsJune McEnroe Turns out I did eventually fix this, because I may want to implement "passive clients" for logging or notification stuff, which wouldn't affect AWAY status either. 2019-11-07Just write the example normallyJune McEnroe 2019-11-07Include path in readlinkat errorJune McEnroe 2019-11-07Call clientConsume before clientRecvJune McEnroe This might reduce the frequency of a client getting its own message back because it was behind in the ring when it sent it. 2019-11-06Use -l:filename in Linux.mkJune McEnroe 2019-11-06Fix compat.h for #defined strlcpyJune McEnroe 2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe 2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe