Fix echo PRIVMSG messages

This commit is contained in:
Simon Ser 2020-03-17 16:15:54 +01:00
parent 651e936913
commit dc26908466
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -252,6 +252,7 @@ func (dc *downstreamConn) writeMessages() error {
if ours {
// The message comes from our connection, don't echo it
// back
consumer.Consume()
continue
}
@ -903,11 +904,19 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
Params: []string{upstreamName, text},
})
echoMsg := &irc.Message{
Prefix: &irc.Prefix{
Name: uc.nick,
User: uc.username,
},
Command: "PRIMSG",
Params: []string{upstreamName, text},
}
dc.lock.Lock()
dc.ourMessages[msg] = struct{}{}
dc.ourMessages[echoMsg] = struct{}{}
dc.lock.Unlock()
uc.ring.Produce(msg)
uc.ring.Produce(echoMsg)
}
default:
dc.logger.Printf("unhandled message: %v", msg)