3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

add cap-notify for bouncer

This commit is contained in:
Shivaram Lingamneni 2019-08-31 22:42:51 -04:00
parent ca17e58b3a
commit 8a33d68cf1

View File

@ -676,6 +676,14 @@ func (server *Server) applyConfig(config *Config, initial bool) (err error) {
addedCaps.Add(caps.STS) addedCaps.Add(caps.STS)
} }
if oldConfig != nil && config.Accounts.Bouncer.Enabled != oldConfig.Accounts.Bouncer.Enabled {
if config.Accounts.Bouncer.Enabled {
addedCaps.Add(caps.Bouncer)
} else {
removedCaps.Add(caps.Bouncer)
}
}
// resize history buffers as needed // resize history buffers as needed
if oldConfig != nil && oldConfig.History != config.History { if oldConfig != nil && oldConfig.History != config.History {
for _, channel := range server.channels.Channels() { for _, channel := range server.channels.Channels() {
@ -686,6 +694,9 @@ func (server *Server) applyConfig(config *Config, initial bool) (err error) {
} }
} }
// activate the new config
server.SetConfig(config)
// burst new and removed caps // burst new and removed caps
var capBurstSessions []*Session var capBurstSessions []*Session
added := make(map[caps.Version][]string) added := make(map[caps.Version][]string)
@ -720,9 +731,6 @@ func (server *Server) applyConfig(config *Config, initial bool) (err error) {
} }
} }
// save a pointer to the new config
server.SetConfig(config)
server.logger.Info("server", "Using datastore", config.Datastore.Path) server.logger.Info("server", "Using datastore", config.Datastore.Path)
if initial { if initial {
if err := server.loadDatastore(config); err != nil { if err := server.loadDatastore(config); err != nil {