mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
track channel registrations per account
* limit the total number of registrations per account * when an account is unregistered, unregister all its channels
This commit is contained in:
parent
8eefe869d0
commit
ff7bbc4a9c
7 changed files with 120 additions and 3 deletions
|
|
@ -224,6 +224,13 @@ func csRegisterHandler(server *Server, client *Client, command string, params []
|
|||
return
|
||||
}
|
||||
|
||||
account := client.Account()
|
||||
channelsAlreadyRegistered := server.accounts.ChannelsForAccount(account)
|
||||
if server.Config().Channels.Registration.MaxChannelsPerAccount <= len(channelsAlreadyRegistered) {
|
||||
csNotice(rb, client.t("You have already registered the maximum number of channels; try dropping some with /CS UNREGISTER"))
|
||||
return
|
||||
}
|
||||
|
||||
// this provides the synchronization that allows exactly one registration of the channel:
|
||||
err = channelInfo.SetRegistered(client.Account())
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue