Handle quit message relay better on gateways with one channel on the irc bridge #722

This commit is contained in:
Wim 2019-02-21 17:52:28 +01:00
parent 48ba829465
commit 240559581a

View File

@ -188,6 +188,11 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con
// irc quit is for the whole bridge, isn't a per channel quit. // irc quit is for the whole bridge, isn't a per channel quit.
// channel is empty when we quit // channel is empty when we quit
if msg.Event == config.EventJoinLeave && getProtocol(msg) == "irc" && msg.Channel == "" { if msg.Event == config.EventJoinLeave && getProtocol(msg) == "irc" && msg.Channel == "" {
// if we only have one channel on this irc bridge it's got to be the sending one.
// don't send it back
if channel.Account == msg.Account && len(dest.Channels) == 1 && dest.Protocol == "irc" {
return channels
}
for _, channel := range gw.Channels { for _, channel := range gw.Channels {
if channel.Account == dest.Account && strings.Contains(channel.Direction, "out") && if channel.Account == dest.Account && strings.Contains(channel.Direction, "out") &&
gw.validGatewayDest(msg) { gw.validGatewayDest(msg) {