Forward PRIVMSG coming from downstream

This commit is contained in:
Simon Ser 2020-02-17 15:56:18 +01:00
parent 9a93c56cdf
commit 528c402bd0
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -402,6 +402,24 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
})
}
}
case "PRIVMSG":
var targetsStr, text string
if err := parseMessageParams(msg, &targetsStr, &text); err != nil {
return err
}
for _, name := range strings.Split(targetsStr, ",") {
ch, err := dc.user.getChannel(name)
if err != nil {
return err
}
ch.conn.messages <- &irc.Message{
Prefix: msg.Prefix,
Command: "PRIVMSG",
Params: []string{name, text},
}
}
default:
dc.logger.Printf("unhandled message: %v", msg)
return newUnknownCommandError(msg.Command)