From 0a4adad4300f8044ec81a4286e937d9c38a4756a Mon Sep 17 00:00:00 2001 From: Martin/Geno Date: Sun, 30 Jun 2019 09:46:52 +0200 Subject: [PATCH] use db Notifier for defaults (with regex ...) --- output/xmpp/main.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/output/xmpp/main.go b/output/xmpp/main.go index 0a01999..a5f426f 100644 --- a/output/xmpp/main.go +++ b/output/xmpp/main.go @@ -71,14 +71,20 @@ func Init(configInterface interface{}, db *database.DB, bot *bot.Bot) output.Out logger.WithField("jid", config.JID).Info("startup") for to, muc := range config.Defaults { - def := &database.Notify{ - Protocol: proto, - To: to, - RegexIn: make(map[string]*regexp.Regexp), - MaxPrioIn: log.DebugLevel, - } + var def *database.Notify + pro := proto if muc { - def.Protocol = protoGroup + pro = protoGroup + } + if dbNotify, ok := db.NotifiesByAddress[pro+":"+to]; ok { + def = dbNotify + } else { + def = &database.Notify{ + Protocol: pro, + To: to, + RegexIn: make(map[string]*regexp.Regexp), + MaxPrioIn: log.DebugLevel, + } out.Join(to) } out.defaults = append(out.defaults, def)