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")
|
||||
|
||||
for to, muc := range config.Defaults {
|
||||
def := &database.Notify{
|
||||
Protocol: proto,
|
||||
var def *database.Notify
|
||||
pro := proto
|
||||
if muc {
|
||||
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,
|
||||
}
|
||||
if muc {
|
||||
def.Protocol = protoGroup
|
||||
out.Join(to)
|
||||
}
|
||||
out.defaults = append(out.defaults, def)
|
||||
|
|
Loading…
Reference in New Issue