a convoy is a whole fleet of honks, coming at ya

master
Ted Unangst 5 years ago
parent f5cbf4cadc
commit 7219332e0a

@ -312,7 +312,7 @@ func getboxes(ident string) (*Box, error) {
}
func peeppeep() {
user, _ := butwhatabout("")
user, _ := butwhatabout("htest")
honkers := gethonkers(user.ID)
for _, f := range honkers {
if f.Flavor != "peep" {
@ -354,13 +354,14 @@ func peeppeep() {
}
}
func whosthere(xid string) []string {
func whosthere(xid string) ([]string, string) {
obj, err := GetJunk(xid)
if err != nil {
log.Printf("error getting remote xonk: %s", err)
return nil
return nil, ""
}
return newphone(nil, obj)
convoy, _ := jsongetstring(obj, "conversation")
return newphone(nil, obj), convoy
}
func newphone(a []string, obj map[string]interface{}) []string {
@ -387,7 +388,7 @@ func xonkxonk(item interface{}) *Honk {
var audience []string
var err error
var xid, rid, url, content string
var xid, rid, url, content, convoy string
var obj map[string]interface{}
switch what {
case "Announce":
@ -424,6 +425,7 @@ func xonkxonk(item interface{}) *Honk {
content = "<p>summary: " + summary + content
}
rid, _ = jsongetstring(obj, "inReplyTo")
convoy, _ = jsongetstring(obj, "conversation")
if what == "honk" && rid != "" {
what = "tonk"
}
@ -476,6 +478,7 @@ func xonkxonk(item interface{}) *Honk {
xonk.URL = url
xonk.Noise = content
xonk.Audience = audience
xonk.Convoy = convoy
return &xonk
}
@ -567,6 +570,9 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte
if h.RID != "" {
jo["inReplyTo"] = h.RID
}
if h.Convoy != "" {
jo["conversation"] = h.Convoy
}
jo["to"] = h.Audience[0]
if len(h.Audience) > 1 {
jo["cc"] = h.Audience[1:]

@ -663,7 +663,7 @@ func savebonk(w http.ResponseWriter, r *http.Request) {
if xonk.Honker == "" {
xonk.XID = fmt.Sprintf("https://%s/u/%s/h/%s", serverName, xonk.Username, xonk.XID)
}
convoy := ""
convoy := xonk.Convoy
userinfo := GetUserInfo(r)
@ -676,7 +676,7 @@ func savebonk(w http.ResponseWriter, r *http.Request) {
XID: xonk.XID,
Date: dt,
Noise: xonk.Noise,
Convoy: convoy,
Convoy: convoy,
Donks: xonk.Donks,
Audience: oneofakind(prepend(thewholeworld, xonk.Audience)),
}
@ -723,7 +723,6 @@ func savehonk(w http.ResponseWriter, r *http.Request) {
if rid != "" {
what = "tonk"
}
convoy := ""
honk := Honk{
UserID: userinfo.UserID,
Username: userinfo.Username,
@ -731,25 +730,31 @@ func savehonk(w http.ResponseWriter, r *http.Request) {
XID: xid,
RID: rid,
Date: dt,
Convoy: convoy,
}
if noise[0] == '@' {
honk.Audience = append(grapevine(noise), thewholeworld)
} else {
honk.Audience = prepend(thewholeworld, grapevine(noise))
}
var convoy string
if rid != "" {
xonk := getxonk("", rid)
if xonk != nil {
honk.Audience = append(honk.Audience, xonk.Audience...)
convoy = xonk.Convoy
} else {
xonkaud := whosthere(rid)
xonkaud, c := whosthere(rid)
honk.Audience = append(honk.Audience, xonkaud...)
convoy = c
}
}
if convoy == "" {
convoy = "data:,electrichonkytonk-" + xfiltrate()
}
honk.Audience = oneofakind(honk.Audience)
noise = obfusbreak(noise)
honk.Noise = noise
honk.Convoy = convoy
file, filehdr, err := r.FormFile("donk")
if err == nil {

@ -9,6 +9,10 @@
in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
</span>
{{ end }}
<br>
<span style="margin-left: 4em;" class="clip">
convoy: {{ .Convoy }}
</span>
</div>
<div class="noise">
<p>{{ .HTML }}

Loading…
Cancel
Save