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
1 changed files with 11 additions and 2 deletions

View File

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