initial UBAN implementation

This commit is contained in:
Shivaram Lingamneni 2021-01-19 08:49:45 -05:00
parent 64bc363cf1
commit bb5276553d
14 changed files with 598 additions and 44 deletions

View file

@ -1361,11 +1361,16 @@ func (a ByCreationTime) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByCreationTime) Less(i, j int) bool { return a[i].TimeCreated.After(a[j].TimeCreated) }
func nsSuspendListHandler(service *ircService, server *Server, client *Client, command string, params []string, rb *ResponseBuffer) {
suspensions := server.accounts.ListSuspended()
listAccountSuspensions(client, rb, service.prefix)
}
func listAccountSuspensions(client *Client, rb *ResponseBuffer, source string) {
suspensions := client.server.accounts.ListSuspended()
sort.Sort(ByCreationTime(suspensions))
service.Notice(rb, fmt.Sprintf(client.t("There are %d active suspensions."), len(suspensions)))
nick := client.Nick()
rb.Add(nil, source, "NOTICE", nick, fmt.Sprintf(client.t("There are %d active account suspensions."), len(suspensions)))
for _, suspension := range suspensions {
service.Notice(rb, suspensionToString(client, suspension))
rb.Add(nil, source, "NOTICE", nick, suspensionToString(client, suspension))
}
}