diff options
Diffstat (limited to 'gateway/samechannel')
-rw-r--r-- | gateway/samechannel/samechannel.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gateway/samechannel/samechannel.go b/gateway/samechannel/samechannel.go index 5ea58b84..bd8e3607 100644 --- a/gateway/samechannel/samechannel.go +++ b/gateway/samechannel/samechannel.go @@ -47,8 +47,10 @@ func (gw *SameChannelGateway) handleReceive(c chan config.Message) { for { select { case msg := <-c: - for _, br := range gw.Bridges { - gw.handleMessage(msg, br) + if !gw.ignoreMessage(&msg) { + for _, br := range gw.Bridges { + gw.handleMessage(msg, br) + } } } } @@ -71,6 +73,16 @@ func (gw *SameChannelGateway) handleMessage(msg config.Message, dest *bridge.Bri } } +func (gw *SameChannelGateway) ignoreMessage(msg *config.Message) bool { + for _, entry := range strings.Fields(gw.Bridges[msg.Account].Config.IgnoreNicks) { + if msg.Username == entry { + log.Debugf("ignoring %s from %s", msg.Username, msg.Account) + return true + } + } + return false +} + func (gw *SameChannelGateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) { br := gw.Bridges[msg.Account] nick := gw.Config.General.RemoteNickFormat |