unravel a bit of the big mess

This commit is contained in:
Ted Unangst 2019-09-28 17:03:05 -04:00
parent ae2b456727
commit 91afec7070
1 changed files with 20 additions and 21 deletions

View File

@ -464,9 +464,8 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
what, _ := item.GetString("type") what, _ := item.GetString("type")
dt, _ := item.GetString("published") dt, _ := item.GetString("published")
var audience []string
var err error var err error
var xid, rid, url, content, precis, convoy, oonker string var xid, rid, url, content, precis, convoy string
var obj junk.Junk var obj junk.Junk
var ok bool var ok bool
isUpdate := false isUpdate := false
@ -542,12 +541,27 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
} }
var xonk Honk var xonk Honk
who, _ := item.GetString("actor") // early init
xonk.Honker, _ = item.GetString("actor")
if obj != nil { if obj != nil {
if who == "" { if xonk.Honker == "" {
who = extractattrto(obj) xonk.Honker = extractattrto(obj)
} }
oonker = extractattrto(obj) xonk.Oonker = extractattrto(obj)
if xonk.Oonker == xonk.Honker {
xonk.Oonker = ""
}
xonk.Audience = newphone(nil, obj)
}
xonk.Audience = append(xonk.Audience, xonk.Honker)
xonk.Audience = oneofakind(xonk.Audience)
for _, a := range xonk.Audience {
if a == user.URL {
xonk.Whofore = 1
}
}
if obj != nil {
ot, _ := obj.GetString("type") ot, _ := obj.GetString("type")
url, _ = obj.GetString("url") url, _ = obj.GetString("url")
dt2, ok := obj.GetString("published") dt2, ok := obj.GetString("published")
@ -557,7 +571,6 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
if ot == "Tombstone" { if ot == "Tombstone" {
xid, _ = obj.GetString("id") xid, _ = obj.GetString("id")
} else { } else {
audience = newphone(audience, obj)
xid, _ = obj.GetString("id") xid, _ = obj.GetString("id")
precis, _ = obj.GetString("summary") precis, _ = obj.GetString("summary")
if precis == "" { if precis == "" {
@ -694,35 +707,21 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
item.Write(os.Stdout) item.Write(os.Stdout)
return nil return nil
} }
audience = append(audience, who)
audience = oneofakind(audience)
if currenttid == "" { if currenttid == "" {
currenttid = convoy currenttid = convoy
} }
if oonker == who {
oonker = ""
}
// init xonk // init xonk
xonk.UserID = user.ID xonk.UserID = user.ID
xonk.What = what xonk.What = what
xonk.Honker = who
xonk.XID = xid xonk.XID = xid
xonk.RID = rid xonk.RID = rid
xonk.Date, _ = time.Parse(time.RFC3339, dt) xonk.Date, _ = time.Parse(time.RFC3339, dt)
xonk.URL = url xonk.URL = url
xonk.Noise = content xonk.Noise = content
xonk.Precis = precis xonk.Precis = precis
xonk.Audience = audience
xonk.Oonker = oonker
xonk.Format = "html" xonk.Format = "html"
for _, a := range audience {
if a == user.URL {
xonk.Whofore = 1
}
}
if isUpdate { if isUpdate {
log.Printf("something has changed! %s", xonk.XID) log.Printf("something has changed! %s", xonk.XID)