all repos — honk @ 87595f390c3672470635ac11537bfd4555cc1a36

my fork of honk

dost thou bite thy thumb at me?
Ted Unangst tedu@tedunangst.com
Fri, 19 Apr 2019 22:35:21 -0400
commit

87595f390c3672470635ac11537bfd4555cc1a36

parent

2554baee873ab0d70f7b141870cf328b27562152

2 files changed, 21 insertions(+), 1 deletions(-)

jump to
M fun.gofun.go

@@ -296,6 +296,21 @@ }

return } +func thoudostbitethythumb(userid int64, who string) bool { + where := "" + m := re_unurl.FindStringSubmatch(who) + if len(m) > 2 { + where = m[1] + } + row := stmtThumbBiter.QueryRow(who, where, userid) + var id int64 + err := row.Scan(&id) + if err != nil { + return false + } + return true +} + func keymatch(keyname string, actor string) bool { return strings.HasPrefix(keyname, actor) }
M honk.gohonk.go

@@ -313,6 +313,10 @@ if !keymatch(keyname, who) {

log.Printf("keyname actor mismatch: %s <> %s", keyname, who) return } + if thoudostbitethythumb(user.ID, who) { + log.Printf("ignoring thumb sucker %s", who) + return + } fd, _ := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) WriteJunk(fd, j) io.WriteString(fd, "\n")

@@ -1047,7 +1051,7 @@ var stmtHonksForUser, stmtDeleteHonk, stmtSaveDub *sql.Stmt

var stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt var stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *sql.Stmt -var stmtZonkIt *sql.Stmt +var stmtThumbBiter, stmtZonkIt *sql.Stmt func preparetodie(db *sql.DB, s string) *sql.Stmt { stmt, err := db.Prepare(s)

@@ -1079,6 +1083,7 @@ stmtGetDoovers = preparetodie(db, "select dooverid, dt from doovers")

stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?") stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?") stmtZonkIt = preparetodie(db, "update honks set what = 'zonk' where userid = ? and xid = ?") + stmtThumbBiter = preparetodie(db, "select zonkerid from zonkers where ((name = ? and wherefore = 'zonker') or (name = ? and wherefore = 'zurl')) and userid = ?") } func ElaborateUnitTests() {