Fix upstream USER command when both username and nick are empty

This commit is contained in:
Simon Ser 2021-11-07 18:33:59 +01:00
parent 7fbaaefc9c
commit 659083c781
2 changed files with 8 additions and 8 deletions

14
db.go
View File

@ -105,13 +105,6 @@ func (net *Network) URL() (*url.URL, error) {
return u, nil return u, nil
} }
func (net *Network) GetUsername() string {
if net.Username != "" {
return net.Username
}
return net.Nick
}
func GetNick(user *User, net *Network) string { func GetNick(user *User, net *Network) string {
if net.Nick != "" { if net.Nick != "" {
return net.Nick return net.Nick
@ -119,6 +112,13 @@ func GetNick(user *User, net *Network) string {
return user.Username return user.Username
} }
func GetUsername(user *User, net *Network) string {
if net.Username != "" {
return net.Username
}
return GetNick(user, net)
}
func GetRealname(user *User, net *Network) string { func GetRealname(user *User, net *Network) string {
if net.Realname != "" { if net.Realname != "" {
return net.Realname return net.Realname

View File

@ -1673,7 +1673,7 @@ func splitSpace(s string) []string {
func (uc *upstreamConn) register() { func (uc *upstreamConn) register() {
uc.nick = GetNick(&uc.user.User, &uc.network.Network) uc.nick = GetNick(&uc.user.User, &uc.network.Network)
uc.nickCM = uc.network.casemap(uc.nick) uc.nickCM = uc.network.casemap(uc.nick)
uc.username = uc.network.GetUsername() uc.username = GetUsername(&uc.user.User, &uc.network.Network)
uc.realname = GetRealname(&uc.user.User, &uc.network.Network) uc.realname = GetRealname(&uc.user.User, &uc.network.Network)
uc.SendMessage(&irc.Message{ uc.SendMessage(&irc.Message{