use db Notifier for defaults (with regex ...)

This commit is contained in:
Martin/Geno 2019-06-30 09:46:52 +02:00
parent d2ca796145
commit 0a4adad430
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
1 changed files with 13 additions and 7 deletions

View File

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