mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
remove unnecessary uses of Casefold
This commit is contained in:
parent
9d56677691
commit
ab444a3980
@ -948,12 +948,7 @@ func (client *Client) updateNickMaskNoMutex() {
|
|||||||
return // pre-registration, don't bother generating the hostname
|
return // pre-registration, don't bother generating the hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
cfhostname, err := Casefold(client.hostname)
|
cfhostname := strings.ToLower(client.hostname)
|
||||||
if err != nil {
|
|
||||||
client.server.logger.Error("internal", "hostname couldn't be casefolded", client.hostname, err.Error())
|
|
||||||
cfhostname = client.hostname // YOLO
|
|
||||||
}
|
|
||||||
|
|
||||||
client.nickMaskString = fmt.Sprintf("%s!%s@%s", client.nick, client.username, 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)
|
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)
|
username = strings.ToLower(username)
|
||||||
|
|
||||||
if len(vhost) > 0 {
|
if len(vhost) > 0 {
|
||||||
cfvhost, err := Casefold(vhost)
|
cfvhost := strings.ToLower(vhost)
|
||||||
if err == nil {
|
|
||||||
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cfvhost))
|
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cfvhost))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var rawhostmask string
|
var rawhostmask string
|
||||||
cfrawhost, err := Casefold(rawHostname)
|
cfrawhost := strings.ToLower(rawHostname)
|
||||||
if err == nil {
|
|
||||||
rawhostmask = fmt.Sprintf("%s!%s@%s", nick, username, cfrawhost)
|
rawhostmask = fmt.Sprintf("%s!%s@%s", nick, username, cfrawhost)
|
||||||
masks = append(masks, rawhostmask)
|
masks = append(masks, rawhostmask)
|
||||||
}
|
|
||||||
|
|
||||||
if cloakedHostname != "" {
|
if cloakedHostname != "" {
|
||||||
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cloakedHostname))
|
masks = append(masks, fmt.Sprintf("%s!%s@%s", nick, username, cloakedHostname))
|
||||||
|
@ -783,7 +783,7 @@ func LoadConfig(filename string) (config *Config, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// casefold/validate server name
|
// casefold/validate server name
|
||||||
config.Server.nameCasefolded, err = Casefold(config.Server.Name)
|
config.Server.nameCasefolded = strings.ToLower(config.Server.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
|
return nil, fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -2675,7 +2675,7 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
|||||||
} else if mask[0] == '#' {
|
} else if mask[0] == '#' {
|
||||||
mask, err = CasefoldChannel(msg.Params[0])
|
mask, err = CasefoldChannel(msg.Params[0])
|
||||||
} else {
|
} else {
|
||||||
mask, err = Casefold(mask)
|
mask, err = CanonicalizeMaskWildcard(mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user