From 528c402bd033d231cac1a8c8b43b3108aaf9cee3 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 17 Feb 2020 15:56:18 +0100 Subject: [PATCH] Forward PRIVMSG coming from downstream --- downstream.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/downstream.go b/downstream.go index 0dd6848..e77c083 100644 --- a/downstream.go +++ b/downstream.go @@ -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)