Send service NOTICE on highlight in detached channel

This commit is contained in:
Simon Ser 2020-05-01 19:05:20 +02:00
parent 70f26a1a5a
commit bd8ab7230d
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -304,6 +304,13 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
target = msg.Prefix.Name
}
uc.produce(target, msg, nil)
highlight := strings.Contains(text, uc.nick) && msg.Prefix.Name != uc.nick
if ch, ok := uc.network.channels[target]; ok && ch.Detached && highlight {
uc.forEachDownstream(func(dc *downstreamConn) {
sendServiceNOTICE(dc, fmt.Sprintf("highlight in %v: <%v> %v", dc.marshalEntity(uc.network, ch.Name), msg.Prefix.Name, text))
})
}
}
case "CAP":
var subCmd string