diff --git a/database.go b/database.go index 1ef5cb1..1edbe1a 100644 --- a/database.go +++ b/database.go @@ -1193,6 +1193,6 @@ func prepareStatements(db *sql.DB) { stmtSaveChonk = preparetodie(db, "insert into chonks (userid, xid, who, target, dt, noise, format) values (?, ?, ?, ?, ?, ?, ?)") stmtLoadChonks = preparetodie(db, "select chonkid, userid, xid, who, target, dt, noise, format from chonks where userid = ? and dt > ? order by chonkid asc") stmtGetChatters = preparetodie(db, "select distinct(target) from chonks where userid = ?") - stmtDeliquentCheck = preparetodie(db, "select dooverid, msg from doovers where rcpt = ?") - stmtDeliquentUpdate = preparetodie(db, "update doovers set data = ? where dooverid = ?") + stmtDeliquentCheck = preparetodie(db, "select dooverid, msg from doovers where userid = ? and rcpt = ?") + stmtDeliquentUpdate = preparetodie(db, "update doovers set msg = ? where dooverid = ?") } diff --git a/deliverator.go b/deliverator.go index 67ec737..b3491c5 100644 --- a/deliverator.go +++ b/deliverator.go @@ -68,10 +68,10 @@ func sayitagain(doover Doover) { var dqmtx sync.Mutex -func delinquent(rcpt string, msg []byte) bool { +func delinquent(userid int64, rcpt string, msg []byte) bool { dqmtx.Lock() defer dqmtx.Unlock() - row := stmtDeliquentCheck.QueryRow(rcpt) + row := stmtDeliquentCheck.QueryRow(userid, rcpt) var dooverid int64 var data []byte err := row.Scan(&dooverid, data) @@ -93,7 +93,7 @@ func delinquent(rcpt string, msg []byte) bool { } func deliverate(userid int64, rcpt string, msg []byte) { - if delinquent(rcpt, msg) { + if delinquent(userid, rcpt, msg) { return } var d Doover