3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

remove unnecessary uses of Casefold

This commit is contained in:
Shivaram Lingamneni 2019-12-18 07:01:26 -05:00
parent 9d56677691
commit ab444a3980
3 changed files with 8 additions and 17 deletions

View File

@ -948,12 +948,7 @@ func (client *Client) updateNickMaskNoMutex() {
return // pre-registration, don't bother generating the hostname
}
cfhostname, err := Casefold(client.hostname)
if err != nil {
client.server.logger.Error("internal", "hostname couldn't be casefolded", client.hostname, err.Error())
cfhostname = client.hostname // YOLO
}
cfhostname := strings.ToLower(client.hostname)
client.nickMaskString = fmt.Sprintf("%s!%s@%s", client.nick, client.username, client.hostname)
client.nickMaskCasefolded = fmt.Sprintf("%s!%s@%s", client.nickCasefolded, strings.ToLower(client.username), cfhostname)
}
@ -970,18 +965,14 @@ func (client *Client) AllNickmasks() (masks []string) {
username = strings.ToLower(username)
if len(vhost) > 0 {
cfvhost, err := Casefold(vhost)
if err == nil {
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cfvhost))
}
cfvhost := strings.ToLower(vhost)
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cfvhost))
}
var rawhostmask string
cfrawhost, err := Casefold(rawHostname)
if err == nil {
rawhostmask = fmt.Sprintf("%s!%s@%s", nick, username, cfrawhost)
masks = append(masks, rawhostmask)
}
cfrawhost := strings.ToLower(rawHostname)
rawhostmask = fmt.Sprintf("%s!%s@%s", nick, username, cfrawhost)
masks = append(masks, rawhostmask)
if cloakedHostname != "" {
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cloakedHostname))

View File

@ -783,7 +783,7 @@ func LoadConfig(filename string) (config *Config, err error) {
}
// casefold/validate server name
config.Server.nameCasefolded, err = Casefold(config.Server.Name)
config.Server.nameCasefolded = strings.ToLower(config.Server.Name)
if err != nil {
return nil, fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
}

View File

@ -2675,7 +2675,7 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
} else if mask[0] == '#' {
mask, err = CasefoldChannel(msg.Params[0])
} else {
mask, err = Casefold(mask)
mask, err = CanonicalizeMaskWildcard(mask)
}
if err != nil {