Fix not properly marshaling self in single-server mode

In single-server mode, we don't need to add a /network suffix when
marshaling, but we still need to replace our nick with the downstream
nick.
This commit is contained in:
delthas 2020-05-01 19:03:34 +02:00 committed by Simon Ser
parent 1363a5c27e
commit 40ee5e8405
1 changed files with 3 additions and 3 deletions

View File

@ -155,15 +155,15 @@ func isOurNick(net *network, nick string) bool {
// This involves adding a "/<network>" suffix if the entity isn't the current // This involves adding a "/<network>" suffix if the entity isn't the current
// user. // user.
func (dc *downstreamConn) marshalEntity(net *network, name string) string { func (dc *downstreamConn) marshalEntity(net *network, name string) string {
if isOurNick(net, name) {
return dc.nick
}
if dc.network != nil { if dc.network != nil {
if dc.network != net { if dc.network != net {
panic("soju: tried to marshal an entity for another network") panic("soju: tried to marshal an entity for another network")
} }
return name return name
} }
if isOurNick(net, name) {
return dc.nick
}
return name + "/" + net.GetName() return name + "/" + net.GetName()
} }