Disallow marshalling for anotehr network

This commit is contained in:
Simon Ser 2020-04-16 16:54:13 +02:00
parent e508f2ca81
commit 96be0b5945
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -128,6 +128,9 @@ func (dc *downstreamConn) upstream() *upstreamConn {
// user.
func (dc *downstreamConn) marshalEntity(uc *upstreamConn, name string) string {
if dc.network != nil {
if dc.network != uc.network {
panic("soju: tried to marshal an entity for another network")
}
return name
}
if name == uc.nick {
@ -149,6 +152,9 @@ func (dc *downstreamConn) marshalUserPrefix(uc *upstreamConn, prefix *irc.Prefix
return dc.prefix()
}
if dc.network != nil {
if dc.network != uc.network {
panic("soju: tried to marshal a user prefix for another network")
}
return prefix
}
return &irc.Prefix{