|
@@ -7,6 +7,8 @@ import (
|
7
|
7
|
"errors"
|
8
|
8
|
"fmt"
|
9
|
9
|
"regexp"
|
|
10
|
+
|
|
11
|
+ "github.com/oragono/oragono/irc/sno"
|
10
|
12
|
)
|
11
|
13
|
|
12
|
14
|
const hostservHelp = `HostServ lets you manage your vhost (i.e., the string displayed
|
|
@@ -225,7 +227,7 @@ func hsRequestHandler(server *Server, client *Client, command string, params []s
|
225
|
227
|
hsNotice(rb, client.t("Your vhost request will be reviewed by an administrator"))
|
226
|
228
|
chanMsg := fmt.Sprintf("Account %s requests vhost %s", accountName, vhost)
|
227
|
229
|
hsNotifyChannel(server, chanMsg)
|
228
|
|
- // TODO send admins a snomask of some kind
|
|
230
|
+ server.snomasks.Send(sno.LocalVhosts, chanMsg)
|
229
|
231
|
}
|
230
|
232
|
}
|
231
|
233
|
|
|
@@ -328,6 +330,7 @@ func hsApproveHandler(server *Server, client *Client, command string, params []s
|
328
|
330
|
hsNotice(rb, fmt.Sprintf(client.t("Successfully approved vhost request for %s"), user))
|
329
|
331
|
chanMsg := fmt.Sprintf("Oper %[1]s approved vhost %[2]s for account %[3]s", client.Nick(), vhostInfo.ApprovedVHost, user)
|
330
|
332
|
hsNotifyChannel(server, chanMsg)
|
|
333
|
+ server.snomasks.Send(sno.LocalVhosts, chanMsg)
|
331
|
334
|
for _, client := range server.accounts.AccountToClients(user) {
|
332
|
335
|
client.Notice(client.t("Your vhost request was approved by an administrator"))
|
333
|
336
|
}
|
|
@@ -348,6 +351,7 @@ func hsRejectHandler(server *Server, client *Client, command string, params []st
|
348
|
351
|
hsNotice(rb, fmt.Sprintf(client.t("Successfully rejected vhost request for %s"), user))
|
349
|
352
|
chanMsg := fmt.Sprintf("Oper %s rejected vhost %s for account %s, with the reason: %v", client.Nick(), vhostInfo.RejectedVHost, user, reason)
|
350
|
353
|
hsNotifyChannel(server, chanMsg)
|
|
354
|
+ server.snomasks.Send(sno.LocalVhosts, chanMsg)
|
351
|
355
|
for _, client := range server.accounts.AccountToClients(user) {
|
352
|
356
|
if reason == "" {
|
353
|
357
|
client.Notice("Your vhost request was rejected by an administrator")
|
|
@@ -406,7 +410,8 @@ func hsTakeHandler(server *Server, client *Client, command string, params []stri
|
406
|
410
|
return
|
407
|
411
|
}
|
408
|
412
|
|
409
|
|
- _, err := server.accounts.VHostTake(client.Account(), vhost, config.Accounts.VHosts.UserRequests.Cooldown)
|
|
413
|
+ account := client.Account()
|
|
414
|
+ _, err := server.accounts.VHostTake(account, vhost, config.Accounts.VHosts.UserRequests.Cooldown)
|
410
|
415
|
if err != nil {
|
411
|
416
|
if throttled, ok := err.(*vhostThrottleExceeded); ok {
|
412
|
417
|
hsNotice(rb, fmt.Sprintf(client.t("You must wait an additional %v before taking a vhost"), throttled.timeRemaining))
|
|
@@ -415,9 +420,8 @@ func hsTakeHandler(server *Server, client *Client, command string, params []stri
|
415
|
420
|
} else {
|
416
|
421
|
hsNotice(rb, client.t("An error occurred"))
|
417
|
422
|
}
|
418
|
|
- } else if vhost != "" {
|
419
|
|
- hsNotice(rb, client.t("Successfully set vhost"))
|
420
|
423
|
} else {
|
421
|
|
- hsNotice(rb, client.t("Successfully cleared vhost"))
|
|
424
|
+ hsNotice(rb, client.t("Successfully set vhost"))
|
|
425
|
+ server.snomasks.Send(sno.LocalVhosts, fmt.Sprintf("Client %s (account %s) took vhost %s", client.Nick(), account, vhost))
|
422
|
426
|
}
|
423
|
427
|
}
|