mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
fix #404
This commit is contained in:
parent
eaf0328608
commit
1121e3d320
@ -1108,6 +1108,10 @@ func (am *AccountManager) VHostReject(account string, reason string) (result VHo
|
|||||||
|
|
||||||
func (am *AccountManager) VHostSetEnabled(client *Client, enabled bool) (result VHostInfo, err error) {
|
func (am *AccountManager) VHostSetEnabled(client *Client, enabled bool) (result VHostInfo, err error) {
|
||||||
munger := func(input VHostInfo) (output VHostInfo, err error) {
|
munger := func(input VHostInfo) (output VHostInfo, err error) {
|
||||||
|
if input.ApprovedVHost == "" {
|
||||||
|
err = errNoVhost
|
||||||
|
return
|
||||||
|
}
|
||||||
output = input
|
output = input
|
||||||
output.Enabled = enabled
|
output.Enabled = enabled
|
||||||
return
|
return
|
||||||
|
@ -44,6 +44,7 @@ var (
|
|||||||
errFeatureDisabled = errors.New(`That feature is disabled`)
|
errFeatureDisabled = errors.New(`That feature is disabled`)
|
||||||
errBanned = errors.New("IP or nickmask banned")
|
errBanned = errors.New("IP or nickmask banned")
|
||||||
errInvalidParams = utils.ErrInvalidParams
|
errInvalidParams = utils.ErrInvalidParams
|
||||||
|
errNoVhost = errors.New(`You do not have an approved vhost`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Socket Errors
|
// Socket Errors
|
||||||
|
@ -154,7 +154,9 @@ func hsOnOffHandler(server *Server, client *Client, command string, params []str
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, err := server.accounts.VHostSetEnabled(client, enable)
|
_, err := server.accounts.VHostSetEnabled(client, enable)
|
||||||
if err != nil {
|
if err == errNoVhost {
|
||||||
|
hsNotice(rb, client.t(err.Error()))
|
||||||
|
} else if err != nil {
|
||||||
hsNotice(rb, client.t("An error occurred"))
|
hsNotice(rb, client.t("An error occurred"))
|
||||||
} else if enable {
|
} else if enable {
|
||||||
hsNotice(rb, client.t("Successfully enabled your vhost"))
|
hsNotice(rb, client.t("Successfully enabled your vhost"))
|
||||||
|
Loading…
Reference in New Issue
Block a user