From a45f9c3274f0cba26873fbe4d17c4007c7553a00 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 30 Mar 2022 15:11:25 +0200 Subject: [PATCH] Use SETNAME when updating user-wide realname --- user.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/user.go b/user.go index bf1909f..29bbe85 100644 --- a/user.go +++ b/user.go @@ -1018,9 +1018,21 @@ func (u *user) updateUser(ctx context.Context, record *User) error { // Re-connect to networks which use the default realname var needUpdate []Network for _, net := range u.networks { - if net.Realname == "" { - needUpdate = append(needUpdate, net.Network) + if net.Realname != "" { + continue } + + // We only need to call updateNetwork for upstreams that don't + // support setname + if uc := net.conn; uc != nil && uc.caps.IsEnabled("setname") { + uc.SendMessage(ctx, &irc.Message{ + Command: "SETNAME", + Params: []string{GetRealname(&u.User, &net.Network)}, + }) + continue + } + + needUpdate = append(needUpdate, net.Network) } var netErr error