4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 16:39:24 +00:00

Fix IgnoreNicks (global). Closes #115

This commit is contained in:
Wim
2017-01-21 21:00:40 +01:00
parent 9bf10e4b58
commit 991183e514
2 changed files with 20 additions and 21 deletions

View File

@ -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