Browse Source

Merge pull request #510 from slingamn/issue404.4

fix #404
tags/v1.1.0-rc1
Daniel Oaks 5 years ago
parent
commit
c34c257b7f
No account linked to committer's email address
3 changed files with 8 additions and 1 deletions
  1. 4
    0
      irc/accounts.go
  2. 1
    0
      irc/errors.go
  3. 3
    1
      irc/hostserv.go

+ 4
- 0
irc/accounts.go View File

1108
 
1108
 
1109
 func (am *AccountManager) VHostSetEnabled(client *Client, enabled bool) (result VHostInfo, err error) {
1109
 func (am *AccountManager) VHostSetEnabled(client *Client, enabled bool) (result VHostInfo, err error) {
1110
 	munger := func(input VHostInfo) (output VHostInfo, err error) {
1110
 	munger := func(input VHostInfo) (output VHostInfo, err error) {
1111
+		if input.ApprovedVHost == "" {
1112
+			err = errNoVhost
1113
+			return
1114
+		}
1111
 		output = input
1115
 		output = input
1112
 		output.Enabled = enabled
1116
 		output.Enabled = enabled
1113
 		return
1117
 		return

+ 1
- 0
irc/errors.go View File

44
 	errFeatureDisabled                = errors.New(`That feature is disabled`)
44
 	errFeatureDisabled                = errors.New(`That feature is disabled`)
45
 	errBanned                         = errors.New("IP or nickmask banned")
45
 	errBanned                         = errors.New("IP or nickmask banned")
46
 	errInvalidParams                  = utils.ErrInvalidParams
46
 	errInvalidParams                  = utils.ErrInvalidParams
47
+	errNoVhost                        = errors.New(`You do not have an approved vhost`)
47
 )
48
 )
48
 
49
 
49
 // Socket Errors
50
 // Socket Errors

+ 3
- 1
irc/hostserv.go View File

154
 	}
154
 	}
155
 
155
 
156
 	_, err := server.accounts.VHostSetEnabled(client, enable)
156
 	_, err := server.accounts.VHostSetEnabled(client, enable)
157
-	if err != nil {
157
+	if err == errNoVhost {
158
+		hsNotice(rb, client.t(err.Error()))
159
+	} else if err != nil {
158
 		hsNotice(rb, client.t("An error occurred"))
160
 		hsNotice(rb, client.t("An error occurred"))
159
 	} else if enable {
161
 	} else if enable {
160
 		hsNotice(rb, client.t("Successfully enabled your vhost"))
162
 		hsNotice(rb, client.t("Successfully enabled your vhost"))

Loading…
Cancel
Save