forked from External/ergo
initial implementation of bouncer functionality
This commit is contained in:
parent
a8f04ecc4d
commit
c2faeed4b5
19 changed files with 733 additions and 441 deletions
|
|
@ -221,8 +221,6 @@ func (am *AccountManager) EnforcementStatus(cfnick, skeleton string) (account st
|
|||
nickMethod := finalEnforcementMethod(nickAccount)
|
||||
skelMethod := finalEnforcementMethod(skelAccount)
|
||||
switch {
|
||||
case nickMethod == NickReservationNone && skelMethod == NickReservationNone:
|
||||
return nickAccount, NickReservationNone
|
||||
case skelMethod == NickReservationNone:
|
||||
return nickAccount, nickMethod
|
||||
case nickMethod == NickReservationNone:
|
||||
|
|
@ -234,6 +232,15 @@ func (am *AccountManager) EnforcementStatus(cfnick, skeleton string) (account st
|
|||
}
|
||||
}
|
||||
|
||||
func (am *AccountManager) BouncerAllowed(account string, session *Session) bool {
|
||||
// TODO stub
|
||||
config := am.server.Config()
|
||||
if !config.Accounts.Bouncer.Enabled {
|
||||
return false
|
||||
}
|
||||
return config.Accounts.Bouncer.AllowedByDefault || session.capabilities.Has(caps.Bouncer)
|
||||
}
|
||||
|
||||
// Looks up the enforcement method stored in the database for an account
|
||||
// (typically you want EnforcementStatus instead, which respects the config)
|
||||
func (am *AccountManager) getStoredEnforcementStatus(account string) string {
|
||||
|
|
@ -928,9 +935,9 @@ func (am *AccountManager) Unregister(account string) error {
|
|||
}
|
||||
for _, client := range clients {
|
||||
if config.Accounts.RequireSasl.Enabled {
|
||||
client.Quit(client.t("You are no longer authorized to be on this server"))
|
||||
client.Quit(client.t("You are no longer authorized to be on this server"), nil)
|
||||
// destroy acquires a semaphore so we can't call it while holding a lock
|
||||
go client.destroy(false)
|
||||
go client.destroy(false, nil)
|
||||
} else {
|
||||
am.logoutOfAccount(client)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue