Fix sending messages from detached channels
Currently, a downstream receives MODE, RPL_CHANNELMODEIS and RPL_CREATIONTIME messages from soju for detached channels. It should not be sent any of these messages. This adds a detach check to the handling of these messages to avoid receiving these messages.
This commit is contained in:
parent
ccf9cff351
commit
2232b3128b
@ -858,6 +858,8 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uc.appendLog(ch.Name, msg)
|
uc.appendLog(ch.Name, msg)
|
||||||
|
|
||||||
|
if ch, ok := uc.network.channels[name]; !ok || !ch.Detached {
|
||||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||||
params := make([]string, len(msg.Params))
|
params := make([]string, len(msg.Params))
|
||||||
params[0] = dc.marshalEntity(uc.network, name)
|
params[0] = dc.marshalEntity(uc.network, name)
|
||||||
@ -877,6 +879,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case irc.RPL_UMODEIS:
|
case irc.RPL_UMODEIS:
|
||||||
if err := parseMessageParams(msg, nil); err != nil {
|
if err := parseMessageParams(msg, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -912,6 +915,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if firstMode {
|
if firstMode {
|
||||||
|
if c, ok := uc.network.channels[channel]; !ok || !c.Detached {
|
||||||
modeStr, modeParams := ch.modes.Format()
|
modeStr, modeParams := ch.modes.Format()
|
||||||
|
|
||||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||||
@ -925,6 +929,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case rpl_creationtime:
|
case rpl_creationtime:
|
||||||
var channel, creationTime string
|
var channel, creationTime string
|
||||||
if err := parseMessageParams(msg, nil, &channel, &creationTime); err != nil {
|
if err := parseMessageParams(msg, nil, &channel, &creationTime); err != nil {
|
||||||
@ -1048,9 +1053,11 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
}
|
}
|
||||||
ch.complete = true
|
ch.complete = true
|
||||||
|
|
||||||
|
if c, ok := uc.network.channels[name]; !ok || !c.Detached {
|
||||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||||
forwardChannel(dc, ch)
|
forwardChannel(dc, ch)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
case irc.RPL_WHOREPLY:
|
case irc.RPL_WHOREPLY:
|
||||||
var channel, username, host, server, nick, mode, trailing string
|
var channel, username, host, server, nick, mode, trailing string
|
||||||
if err := parseMessageParams(msg, nil, &channel, &username, &host, &server, &nick, &mode, &trailing); err != nil {
|
if err := parseMessageParams(msg, nil, &channel, &username, &host, &server, &nick, &mode, &trailing); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user