Closed xPaw closed 3 years ago
Makes sense to add this. Wouldn't it have an upper and lower function rather than a single casefold function though?
I guess so. I haven't seen upper case being relevant anywhere though.
What would custom casefolding apply to? Nicks and channel names? Should it also be done on command names and whatnot?
Spoke to the inspircd dev on this:
[13:20:03] prawnsalad: so if we use it to just compare channel names and nicks, then thats prtty much all it would be used for in the client side?
[13:21:27] SadieP: yeah
So I guess a fast (since it would be a very hot function getting called all the time in clients) simple string compare function would work I guess? IrcClient.caseCompare(str1, str2)
?
I think a separate function to lowercase would be good to have too. I think TL has a couple of places where it's beneficial.
But caseCompare
likely solves quite a few of these use cases.
Prototyped here: https://github.com/kiwiirc/irc-framework/compare/casefolding
The functions should be good to go. Can you verify the use of these functions across the code base and write up some docs for it?
Example code: https://github.com/jesopo/ircstates/blob/ca9abfc34b78b12e34bacd5515b5cae64d690dd5/ircstates/casemap.py#L9
We use
toLowerCase
now, but that's not correct as that will also apply to unicode characters, not just ascii.Something like
IrcClient.casefold(string)
would probably work here. It would look atoptions.CASEMAPPING
to determine how to fold.@prawnsalad thoughts? Neither kiwi or lounge currently handle it.