use db Notifier for defaults (with regex ...)
This commit is contained in:
parent
d2ca796145
commit
0a4adad430
|
@ -71,14 +71,20 @@ func Init(configInterface interface{}, db *database.DB, bot *bot.Bot) output.Out
|
||||||
logger.WithField("jid", config.JID).Info("startup")
|
logger.WithField("jid", config.JID).Info("startup")
|
||||||
|
|
||||||
for to, muc := range config.Defaults {
|
for to, muc := range config.Defaults {
|
||||||
def := &database.Notify{
|
var def *database.Notify
|
||||||
Protocol: proto,
|
pro := proto
|
||||||
|
if muc {
|
||||||
|
pro = protoGroup
|
||||||
|
}
|
||||||
|
if dbNotify, ok := db.NotifiesByAddress[pro+":"+to]; ok {
|
||||||
|
def = dbNotify
|
||||||
|
} else {
|
||||||
|
def = &database.Notify{
|
||||||
|
Protocol: pro,
|
||||||
To: to,
|
To: to,
|
||||||
RegexIn: make(map[string]*regexp.Regexp),
|
RegexIn: make(map[string]*regexp.Regexp),
|
||||||
MaxPrioIn: log.DebugLevel,
|
MaxPrioIn: log.DebugLevel,
|
||||||
}
|
}
|
||||||
if muc {
|
|
||||||
def.Protocol = protoGroup
|
|
||||||
out.Join(to)
|
out.Join(to)
|
||||||
}
|
}
|
||||||
out.defaults = append(out.defaults, def)
|
out.defaults = append(out.defaults, def)
|
||||||
|
|
Loading…
Reference in New Issue