summaryrefslogtreecommitdiffstats
path: root/gateway/samechannel
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-01-21 21:00:40 +0100
committerWim <wim@42.be>2017-01-21 21:00:40 +0100
commit991183e5147f2d9078e8e88979ced1356d9d1796 (patch)
treefc113cdff62e3c61f2d18863426dd60c1b7033a5 /gateway/samechannel
parent9bf10e4b584d175508aef5b30bc04d4f35ece162 (diff)
downloadmatterbridge-msglm-991183e5147f2d9078e8e88979ced1356d9d1796.tar.gz
matterbridge-msglm-991183e5147f2d9078e8e88979ced1356d9d1796.tar.bz2
matterbridge-msglm-991183e5147f2d9078e8e88979ced1356d9d1796.zip
Fix IgnoreNicks (global). Closes #115
Diffstat (limited to 'gateway/samechannel')
-rw-r--r--gateway/samechannel/samechannel.go16
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