diff --git a/activity.go b/activity.go index ea15da6..87d79c1 100644 --- a/activity.go +++ b/activity.go @@ -1195,16 +1195,16 @@ func honkworldwide(user *WhatAbout, honk *Honk) { } } if honk.Public { - for _, f := range getdubs(user.ID) { - if f.XID == user.URL { + for _, h := range getdubs(user.ID) { + if h.XID == user.URL { continue } var box *Box - ok := boxofboxes.Get(f.XID, &box) + ok := boxofboxes.Get(h.XID, &box) if ok && box.Shared != "" { rcpts["%"+box.Shared] = true } else { - rcpts[f.XID] = true + rcpts[h.XID] = true } } } diff --git a/database.go b/database.go index a114e91..a88d744 100644 --- a/database.go +++ b/database.go @@ -63,15 +63,15 @@ func gethonkers(userid int64) []*Honker { defer rows.Close() var honkers []*Honker for rows.Next() { - var f Honker + h := new(Honker) var combos string - err = rows.Scan(&f.ID, &f.UserID, &f.Name, &f.XID, &f.Flavor, &combos) - f.Combos = strings.Split(strings.TrimSpace(combos), " ") + err = rows.Scan(&h.ID, &h.UserID, &h.Name, &h.XID, &h.Flavor, &combos) + h.Combos = strings.Split(strings.TrimSpace(combos), " ") if err != nil { log.Printf("error scanning honker: %s", err) return nil } - honkers = append(honkers, &f) + honkers = append(honkers, h) } return honkers } @@ -85,13 +85,13 @@ func getdubs(userid int64) []*Honker { defer rows.Close() var honkers []*Honker for rows.Next() { - var f Honker - err = rows.Scan(&f.ID, &f.UserID, &f.Name, &f.XID, &f.Flavor) + h := new(Honker) + err = rows.Scan(&h.ID, &h.UserID, &h.Name, &h.XID, &h.Flavor) if err != nil { log.Printf("error scanning honker: %s", err) return nil } - honkers = append(honkers, &f) + honkers = append(honkers, h) } return honkers } @@ -298,14 +298,14 @@ func donksforhonks(honks []*Honk) { defer rows.Close() for rows.Next() { var hid int64 - var d Donk + d := new(Donk) err = rows.Scan(&hid, &d.FileID, &d.XID, &d.Name, &d.Desc, &d.URL, &d.Media, &d.Local) if err != nil { log.Printf("error scanning donk: %s", err) continue } h := hmap[hid] - h.Donks = append(h.Donks, &d) + h.Donks = append(h.Donks, d) } rows.Close() diff --git a/fun.go b/fun.go index 97c1929..6bbad78 100644 --- a/fun.go +++ b/fun.go @@ -329,14 +329,15 @@ func memetize(honk *Honk) { log.Printf("error saving meme: %s", err) return x } - var d Donk - d.FileID = fileid - d.XID = "" - d.Name = name - d.Media = ct - d.URL = url - d.Local = false - honk.Donks = append(honk.Donks, &d) + d := &Donk{ + FileID: fileid, + XID: "", + Name: name, + Media: ct, + URL: url, + Local: false, + } + honk.Donks = append(honk.Donks, d) return "" } honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl) diff --git a/web.go b/web.go index d40b506..79adeaf 100644 --- a/web.go +++ b/web.go @@ -1160,13 +1160,14 @@ func submithonk(w http.ResponseWriter, r *http.Request) { log.Printf("unable to save image: %s", err) return } - var d Donk - d.FileID = fileid - d.XID = xid - d.Desc = desc - d.URL = url - d.Local = true - honk.Donks = append(honk.Donks, &d) + d := &Donk{ + FileID: fileid, + XID: xid, + Desc: desc, + URL: url, + Local: true, + } + honk.Donks = append(honk.Donks, d) donkxid = xid } } else {