downstream: send RPL_ENDOFWHO on unmarshalEntity error

Also remove a couple of outdated comments.
This commit is contained in:
Simon Ser 2022-03-23 19:15:52 +01:00
parent 44efe37292
commit 0ec3e63ace

View File

@ -2203,13 +2203,8 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
}) })
} }
} }
// For WHOX docs, see:
// - http://faerion.sourceforge.net/doc/irc/whox.var
// - https://github.com/quakenet/snircd/blob/master/doc/readme.who
// Note, many features aren't widely implemented, such as flags and mask2
case "WHO": case "WHO":
if len(msg.Params) == 0 { if len(msg.Params) == 0 {
// TODO: support WHO without parameters
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_ENDOFWHO, Command: irc.RPL_ENDOFWHO,
@ -2296,7 +2291,14 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
// TODO: properly support WHO masks // TODO: properly support WHO masks
uc, upstreamMask, err := dc.unmarshalEntity(mask) uc, upstreamMask, err := dc.unmarshalEntity(mask)
if err != nil { if err != nil {
return err // Ignore the error here, because clients don't know how to deal
// with anything other than RPL_ENDOFWHO
dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(),
Command: irc.RPL_ENDOFWHO,
Params: []string{dc.nick, endOfWhoToken, "End of /WHO list"},
})
return nil
} }
params := []string{upstreamMask} params := []string{upstreamMask}