tombstones for zonks
This commit is contained in:
parent
42d9306893
commit
22401dfbdb
18
activity.go
18
activity.go
|
@ -191,6 +191,19 @@ saveit:
|
||||||
return &donk
|
return &donk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func iszonked(userid int64, xid string) bool {
|
||||||
|
row := stmtFindZonk.QueryRow(userid, xid)
|
||||||
|
var id int64
|
||||||
|
err := row.Scan(&id)
|
||||||
|
if err == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if err != sql.ErrNoRows {
|
||||||
|
log.Printf("err querying zonk: %s", err)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func needxonk(user *WhatAbout, x *Honk) bool {
|
func needxonk(user *WhatAbout, x *Honk) bool {
|
||||||
if x.What == "eradicate" {
|
if x.What == "eradicate" {
|
||||||
return true
|
return true
|
||||||
|
@ -205,6 +218,10 @@ func needxonkid(user *WhatAbout, xid string) bool {
|
||||||
if strings.HasPrefix(xid, user.URL+"/h/") {
|
if strings.HasPrefix(xid, user.URL+"/h/") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if iszonked(user.ID, xid) {
|
||||||
|
log.Printf("already zonked: %s", xid)
|
||||||
|
return false
|
||||||
|
}
|
||||||
row := stmtFindXonk.QueryRow(user.ID, xid)
|
row := stmtFindXonk.QueryRow(user.ID, xid)
|
||||||
var id int64
|
var id int64
|
||||||
err := row.Scan(&id)
|
err := row.Scan(&id)
|
||||||
|
@ -228,6 +245,7 @@ func savexonk(user *WhatAbout, x *Honk) {
|
||||||
log.Printf("error eradicating: %s", err)
|
log.Printf("error eradicating: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stmtSaveZonker.Exec(user.ID, x.XID, "zonk")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Printf("saving xonk: %s", x.XID)
|
log.Printf("saving xonk: %s", x.XID)
|
||||||
|
|
5
honk.go
5
honk.go
|
@ -1424,7 +1424,7 @@ var stmtHonkers, stmtDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateCombos
|
||||||
var stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt
|
var stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt
|
||||||
var stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt
|
var stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt
|
||||||
var stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt
|
var stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt
|
||||||
var stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt
|
var stmtFindZonk, stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt
|
||||||
var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *sql.Stmt
|
var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *sql.Stmt
|
||||||
var stmtHasHonker, stmtThumbBiters, stmtZonkIt, stmtZonkDonks, stmtSaveZonker *sql.Stmt
|
var stmtHasHonker, stmtThumbBiters, stmtZonkIt, stmtZonkDonks, stmtSaveZonker *sql.Stmt
|
||||||
var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker *sql.Stmt
|
var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker *sql.Stmt
|
||||||
|
@ -1473,7 +1473,8 @@ func prepareStatements(db *sql.DB) {
|
||||||
stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?")
|
stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?")
|
||||||
stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?")
|
stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?")
|
||||||
stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zurl' or wherefore = 'zword')")
|
stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zurl' or wherefore = 'zword')")
|
||||||
stmtGetZonkers = preparetodie(db, "select zonkerid, name, wherefore from zonkers where userid = ?")
|
stmtFindZonk = preparetodie(db, "select zonkerid from zonkers where userid = ? and name = ? and wherefore = 'zonk'")
|
||||||
|
stmtGetZonkers = preparetodie(db, "select zonkerid, name, wherefore from zonkers where userid = ? and wherefore <> 'zonk'")
|
||||||
stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)")
|
stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)")
|
||||||
stmtGetXonker = preparetodie(db, "select info from xonkers where name = ? and flavor = ?")
|
stmtGetXonker = preparetodie(db, "select info from xonkers where name = ? and flavor = ?")
|
||||||
stmtSaveXonker = preparetodie(db, "insert into xonkers (name, info, flavor) values (?, ?, ?)")
|
stmtSaveXonker = preparetodie(db, "insert into xonkers (name, info, flavor) values (?, ?, ?)")
|
||||||
|
|
Loading…
Reference in New Issue