Strip network name from nickname when auto-saving network

This commit is contained in:
Simon Ser 2020-07-06 18:13:40 +02:00
parent 85fad93a71
commit 1685ba23b3
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -753,11 +753,16 @@ func (dc *downstreamConn) loadNetwork() error {
}} }}
} }
// Some clients only allow specifying the nickname (and use the
// nickname as a username too). Strip the network name from the
// nickname when auto-saving networks.
nick, _, _ := unmarshalUsername(dc.nick)
dc.logger.Printf("auto-saving network %q", dc.networkName) dc.logger.Printf("auto-saving network %q", dc.networkName)
var err error var err error
network, err = dc.user.createNetwork(&Network{ network, err = dc.user.createNetwork(&Network{
Addr: dc.networkName, Addr: dc.networkName,
Nick: dc.nick, Nick: nick,
}) })
if err != nil { if err != nil {
return err return err