diff --git a/Makefile b/Makefile index f1b5cfa..8b87efd 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: honk honk: .preflightcheck schema.sql *.go go.mod - go build -mod=`ls -d vendor 2> /dev/null` -o honk + env CGO_ENABLED=1 go build -mod=`ls -d vendor 2> /dev/null` -o honk .preflightcheck: preflight.sh @sh ./preflight.sh diff --git a/activity.go b/activity.go index e3e4598..0b49557 100644 --- a/activity.go +++ b/activity.go @@ -850,9 +850,6 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { targ, _ := obj.GetString("target") content += string(templates.Sprintf(`
Moved to %s`, targ, targ)) } - if what == "honk" && rid != "" { - what = "tonk" - } if len(content) > 90001 { ilog.Printf("content too long. truncating") content = content[:90001] @@ -1239,8 +1236,6 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { switch h.What { case "update": fallthrough - case "tonk": - fallthrough case "event": fallthrough case "honk": diff --git a/database.go b/database.go index fc04cfe..28e42f2 100644 --- a/database.go +++ b/database.go @@ -504,8 +504,6 @@ func donksforhonks(honks []*Honk) { elog.Printf("error parsing badonks: %s", err) continue } - case "wonkles": - case "guesses": case "oldrev": default: elog.Printf("unknown meta genus: %s", genus) @@ -1151,14 +1149,14 @@ func prepareStatements(db *sql.DB) { smalllimit := " order by honks.honkid desc limit ?" butnotthose := " and convoy not in (select name from zonkers where userid = ? and wherefore = 'zonvoy' order by zonkerid desc limit 100)" stmtOneXonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ?") - stmtAnyXonk = preparetodie(db, selecthonks+"where xid = ? order by honks.honkid asc") + stmtAnyXonk = preparetodie(db, selecthonks+"where xid = ? and what <> 'bonk' order by honks.honkid asc") stmtOneBonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ? and what = 'bonk' and whofore = 2") stmtPublicHonks = preparetodie(db, selecthonks+"where whofore = 2 and dt > ?"+smalllimit) stmtEventHonks = preparetodie(db, selecthonks+"where (whofore = 2 or honks.userid = ?) and what = 'event'"+smalllimit) stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+smalllimit) myhonkers := " and honker in (select xid from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'presub') and combos not like '% - %')" stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit) - stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (what <> 'tonk')"+myhonkers+butnotthose+limit) + stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (rid = '' or what = 'bonk')"+myhonkers+butnotthose+limit) stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit) stmtHonksFromLongAgo = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and dt < ? and whofore = 2"+butnotthose+limit) stmtHonksISaved = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and flags & 4 order by honks.honkid desc") diff --git a/fun.go b/fun.go index 0af56b0..3caa320 100644 --- a/fun.go +++ b/fun.go @@ -66,7 +66,7 @@ func reverbolate(userid int64, honks []*Honk) { somenumberedusers.Get(userid, &user) for _, h := range honks { h.What += "ed" - if h.What == "tonked" { + if h.What == "honked" && h.RID != "" { h.What = "honked back" h.Style += " subtle" } @@ -694,13 +694,9 @@ func savingthrow(keyname string) { } func keymatch(keyname string, actor string) string { - hash := strings.IndexByte(keyname, '#') - if hash == -1 { - hash = len(keyname) - } - owner := keyname[0:hash] - if owner == actor { - return originate(actor) + origin := originate(actor) + if origin == originate(keyname) { + return origin } return "" } diff --git a/honk.go b/honk.go index d0461a3..1f6d09e 100644 --- a/honk.go +++ b/honk.go @@ -155,7 +155,6 @@ const ( flagIsSaved = 4 flagIsUntagged = 8 flagIsReacted = 16 - flagIsWonked = 32 ) func (honk *Honk) IsAcked() bool { diff --git a/import.go b/import.go index 17f131d..8ac5c34 100644 --- a/import.go +++ b/import.go @@ -148,9 +148,6 @@ func importMastotoots(user *WhatAbout, source string) { Format: "html", Precis: toot.Object.Summary, } - if honk.RID != "" { - honk.What = "tonk" - } if !loudandproud(honk.Audience) { honk.Whofore = 3 } @@ -387,13 +384,11 @@ func importTwitter(username, source string) { noise := "" if parent := tweetmap[t.Tweet.InReplyToStatusID]; parent != nil { t.convoy = parent.convoy - what = "tonk" } else { t.convoy = "data:,acoustichonkytonk-" + t.Tweet.IdStr if t.Tweet.InReplyToScreenName != "" { noise = fmt.Sprintf("re: https://twitter.com/%s/status/%s\n\n", t.Tweet.InReplyToScreenName, t.Tweet.InReplyToStatusID) - what = "tonk" } } audience := []string{thewholeworld} diff --git a/unveil.go b/unveil.go index 0cb8986..cbce333 100644 --- a/unveil.go +++ b/unveil.go @@ -25,11 +25,10 @@ package main import "C" import ( - "fmt" "unsafe" ) -func Unveil(path string, perms string) error { +func Unveil(path string, perms string) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) cperms := C.CString(perms) @@ -37,20 +36,18 @@ func Unveil(path string, perms string) error { rv, err := C.unveil(cpath, cperms) if rv != 0 { - return fmt.Errorf("unveil(%s, %s) failure (%d)", path, perms, err) + elog.Fatalf("unveil(%s, %s) failure (%d)", path, perms, err) } - return nil } -func Pledge(promises string) error { +func Pledge(promises string) { cpromises := C.CString(promises) defer C.free(unsafe.Pointer(cpromises)) rv, err := C.pledge(cpromises, nil) if rv != 0 { - return fmt.Errorf("pledge(%s) failure (%d)", promises, err) + elog.Fatalf("pledge(%s) failure (%d)", promises, err) } - return nil } func init() { diff --git a/upgradedb.go b/upgradedb.go index c7d4004..b4bf806 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -18,11 +18,9 @@ package main import ( "database/sql" "os" - "strings" - "time" ) -var myVersion = 42 +var myVersion = 43 type dbexecer interface { Exec(query string, args ...interface{}) (sql.Result, error) @@ -41,164 +39,10 @@ func upgradedb() { getconfig("dbversion", &dbversion) getconfig("servername", &serverName) - if dbversion < 13 { + if dbversion < 40 { elog.Fatal("database is too old to upgrade") } switch dbversion { - case 25: - doordie(db, "delete from auth") - doordie(db, "alter table auth add column expiry text") - doordie(db, "update config set value = 26 where key = 'dbversion'") - fallthrough - case 26: - s := "" - getconfig("servermsg", &s) - if s == "" { - setconfig("servermsg", "
Honk is amazing!") - } - s = "" - getconfig("loginmsg", &s) - if s == "" { - setconfig("loginmsg", "