Handle downstream JOIN/PART with multiple channel names

Closes: https://todo.sr.ht/~emersion/soju/19
This commit is contained in:
Simon Ser 2020-03-25 11:32:44 +01:00
parent 21241c2009
commit 146906ef6b
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -833,11 +833,12 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
uc.SendMessage(msg) uc.SendMessage(msg)
}) })
case "JOIN", "PART": case "JOIN", "PART":
var name string var names string
if err := parseMessageParams(msg, &name); err != nil { if err := parseMessageParams(msg, &names); err != nil {
return err return err
} }
for _, name := range strings.Split(names, ",") {
uc, upstreamName, err := dc.unmarshalEntity(name) uc, upstreamName, err := dc.unmarshalEntity(name)
if err != nil { if err != nil {
return ircError{&irc.Message{ return ircError{&irc.Message{
@ -864,6 +865,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
dc.logger.Printf("failed to delete channel %q in DB: %v", upstreamName, err) dc.logger.Printf("failed to delete channel %q in DB: %v", upstreamName, err)
} }
} }
}
case "MODE": case "MODE":
var name string var name string
if err := parseMessageParams(msg, &name); err != nil { if err := parseMessageParams(msg, &name); err != nil {