Browse Source

fix #805

tags/v2.1.0-rc1
Shivaram Lingamneni 4 years ago
parent
commit
ece444d04b
1 changed files with 9 additions and 6 deletions
  1. 9
    6
      irc/hostserv.go

+ 9
- 6
irc/hostserv.go View File

@@ -12,8 +12,11 @@ import (
12 12
 	"github.com/oragono/oragono/irc/sno"
13 13
 )
14 14
 
15
-const hostservHelp = `HostServ lets you manage your vhost (i.e., the string displayed
15
+const (
16
+	hostservHelp = `HostServ lets you manage your vhost (i.e., the string displayed
16 17
 in place of your client's hostname/IP).`
18
+	hsNickMask = "HostServ!HostServ@localhost"
19
+)
17 20
 
18 21
 var (
19 22
 	errVHostBadCharacters = errors.New("Vhost contains prohibited characters")
@@ -173,7 +176,7 @@ the offered vhosts, use /HOSTSERV OFFERLIST.`,
173 176
 
174 177
 // hsNotice sends the client a notice from HostServ
175 178
 func hsNotice(rb *ResponseBuffer, text string) {
176
-	rb.Add(nil, "HostServ!HostServ@localhost", "NOTICE", rb.target.Nick(), text)
179
+	rb.Add(nil, hsNickMask, "NOTICE", rb.target.Nick(), text)
177 180
 }
178 181
 
179 182
 // hsNotifyChannel notifies the designated channel of new vhost activity
@@ -185,7 +188,7 @@ func hsNotifyChannel(server *Server, message string) {
185 188
 	}
186 189
 	chname = channel.Name()
187 190
 	for _, client := range channel.Members() {
188
-		client.Send(nil, "HostServ", "PRIVMSG", chname, message)
191
+		client.Send(nil, hsNickMask, "PRIVMSG", chname, message)
189 192
 	}
190 193
 }
191 194
 
@@ -333,7 +336,7 @@ func hsApproveHandler(server *Server, client *Client, command string, params []s
333 336
 		hsNotifyChannel(server, chanMsg)
334 337
 		server.snomasks.Send(sno.LocalVhosts, chanMsg)
335 338
 		for _, client := range server.accounts.AccountToClients(user) {
336
-			client.Notice(client.t("Your vhost request was approved by an administrator"))
339
+			client.Send(nil, hsNickMask, "NOTICE", client.Nick(), client.t("Your vhost request was approved by an administrator"))
337 340
 		}
338 341
 	}
339 342
 }
@@ -355,9 +358,9 @@ func hsRejectHandler(server *Server, client *Client, command string, params []st
355 358
 		server.snomasks.Send(sno.LocalVhosts, chanMsg)
356 359
 		for _, client := range server.accounts.AccountToClients(user) {
357 360
 			if reason == "" {
358
-				client.Notice("Your vhost request was rejected by an administrator")
361
+				client.Send(nil, hsNickMask, "NOTICE", client.Nick(), client.t("Your vhost request was rejected by an administrator"))
359 362
 			} else {
360
-				client.Notice(fmt.Sprintf(client.t("Your vhost request was rejected by an administrator. The reason given was: %s"), reason))
363
+				client.Send(nil, hsNickMask, "NOTICE", client.Nick(), fmt.Sprintf(client.t("Your vhost request was rejected by an administrator. The reason given was: %s"), reason))
361 364
 			}
362 365
 		}
363 366
 	}

Loading…
Cancel
Save