Allow nil network in Get{Nick,Username,Realname}
Will simplify callers.
This commit is contained in:
parent
3d8022d030
commit
f6655fbe11
6
db.go
6
db.go
@ -116,21 +116,21 @@ func (net *Network) URL() (*url.URL, error) {
|
||||
}
|
||||
|
||||
func GetNick(user *User, net *Network) string {
|
||||
if net.Nick != "" {
|
||||
if net != nil && net.Nick != "" {
|
||||
return net.Nick
|
||||
}
|
||||
return user.Username
|
||||
}
|
||||
|
||||
func GetUsername(user *User, net *Network) string {
|
||||
if net.Username != "" {
|
||||
if net != nil && net.Username != "" {
|
||||
return net.Username
|
||||
}
|
||||
return GetNick(user, net)
|
||||
}
|
||||
|
||||
func GetRealname(user *User, net *Network) string {
|
||||
if net.Realname != "" {
|
||||
if net != nil && net.Realname != "" {
|
||||
return net.Realname
|
||||
}
|
||||
if user.Realname != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user