nicer upgrade for zonkers

This commit is contained in:
Ted Unangst 2019-10-08 01:31:37 -04:00
parent d38fe950fe
commit 0010d62d63
1 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import (
"os" "os"
"regexp" "regexp"
"strings" "strings"
"time"
) )
func doordie(db *sql.DB, s string, args ...interface{}) { func doordie(db *sql.DB, s string, args ...interface{}) {
@ -208,6 +209,7 @@ func upgradedb() {
log.Fatalf("can't query zonkers: %s", err) log.Fatalf("can't query zonkers: %s", err)
} }
filtmap := make(map[int64][]*Filter) filtmap := make(map[int64][]*Filter)
now := time.Now().UTC()
for rows.Next() { for rows.Next() {
var userid int64 var userid int64
var name, wherefore string var name, wherefore string
@ -216,21 +218,27 @@ func upgradedb() {
log.Fatalf("error scanning zonker: %s", err) log.Fatalf("error scanning zonker: %s", err)
} }
f := new(Filter) f := new(Filter)
f.Date = now
switch wherefore { switch wherefore {
case "zord": case "zord":
f.Name = "hide " + name
f.Text = name f.Text = name
f.Hide = true f.Hide = true
case "zilence": case "zilence":
f.Name = "silence " + name
f.Text = name f.Text = name
f.Collapse = true f.Collapse = true
case "zoggle": case "zoggle":
f.Name = "skip " + name
f.Actor = name f.Actor = name
f.SkipMedia = true f.SkipMedia = true
case "zonker": case "zonker":
f.Name = "reject " + name
f.Actor = name f.Actor = name
f.IncludeAudience = true f.IncludeAudience = true
f.Reject = true f.Reject = true
case "zomain": case "zomain":
f.Name = "reject " + name
f.Actor = name f.Actor = name
f.IncludeAudience = true f.IncludeAudience = true
f.Reject = true f.Reject = true