rework links and cc and such to be less ridiculous
@@ -1381,14 +1381,6 @@ }
if !h.Public { jo["directMessage"] = true } - h.Noise = re_link.ReplaceAllStringFunc(h.Noise, func(x string) string { - link := x[5:] - if link[0] == ' ' { - link = link[1:] - } - h.Link = link - return "" - }) translate(h) redoimages(h) if h.Precis != "" {@@ -1484,7 +1476,12 @@ }
if len(atts) > 0 { jo["attachment"] = atts } - jo["summary"] = h.Precis + if h.LegalName != "" { + jo["name"] = h.LegalName + } + if h.Precis != "" { + jo["summary"] = h.Precis + } jo["content"] = h.Noise j["object"] = jo case "bonk":
@@ -478,6 +478,7 @@ elog.Printf("error scanning honkmeta: %s", err)
continue } h := hmap[hid] + dlog.Printf("meta load %s %s", genus, j) switch genus { case "place": p := new(Place)@@ -507,6 +508,14 @@ if err != nil {
elog.Printf("error parsing badonks: %s", err) continue } + case "seealso": + h.SeeAlso = j + case "onties": + h.Onties = j + case "link": + h.Link = j + case "legalname": + h.LegalName = j case "oldrev": default: elog.Printf("unknown meta genus: %s", genus)@@ -962,6 +971,34 @@ _, err = tx.Stmt(stmtSaveMeta).Exec(h.ID, "mentions", j)
} if err != nil { elog.Printf("error saving mentions: %s", err) + return err + } + } + if onties := h.Onties; onties != "" { + _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "onties", onties) + if err != nil { + elog.Printf("error saving onties: %s", err) + return err + } + } + if legalname := h.LegalName; legalname != "" { + _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "legalname", legalname) + if err != nil { + elog.Printf("error saving legalname: %s", err) + return err + } + } + if seealso := h.SeeAlso; seealso != "" { + _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "seealso", seealso) + if err != nil { + elog.Printf("error saving seealso: %s", err) + return err + } + } + if link := h.Link; link != "" { + _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "link", link) + if err != nil { + elog.Printf("error saving link: %s", err) return err } }
@@ -81,9 +81,7 @@ if h.Whofore == 2 || h.Whofore == 3 {
local = true } if local && h.What != "bonked" { - h.Noise = re_retag.ReplaceAllString(h.Noise, "") h.Noise = re_memes.ReplaceAllString(h.Noise, "") - h.Noise = re_cc.ReplaceAllString(h.Noise, "") } h.Username, h.Handle = handles(h.Honker) if !local {@@ -347,8 +345,16 @@ marker.AllowImages = true
noise = strings.TrimSpace(noise) noise = marker.Mark(noise) honk.Noise = noise - honk.Onts = oneofakind(append(honk.Onts, marker.HashTags...)) + honk.Onts = append(honk.Onts, marker.HashTags...) honk.Mentions = bunchofgrapes(marker.Mentions) + for _, t := range oneofakind(strings.Split(honk.Onties, " ")) { + if t[0] != '#' { + t = "#" + t + } + honk.Onts = append(honk.Onts, t) + } + honk.Onts = oneofakind(honk.Onts) + honk.Mentions = append(honk.Mentions, bunchofgrapes(strings.Split(honk.SeeAlso, " "))...) } func redoimages(honk *Honk) {@@ -372,8 +378,6 @@ }
honk.Donks = honk.Donks[:j] honk.Noise = re_memes.ReplaceAllString(honk.Noise, "") - honk.Noise = re_retag.ReplaceAllString(honk.Noise, "") - honk.Noise = re_cc.ReplaceAllString(honk.Noise, "") honk.Noise = strings.Replace(honk.Noise, "<a href=", "<a class=\"mention u-url\" href=", -1) }@@ -465,9 +469,6 @@ var re_memes = regexp.MustCompile("meme: ?([^\n]+)")
var re_avatar = regexp.MustCompile("avatar: ?([^\n]+)") var re_banner = regexp.MustCompile("banner: ?([^\n]+)") var re_convoy = regexp.MustCompile("convoy: ?([^\n]+)") -var re_retag = regexp.MustCompile("tags: ?([^\n]+)") -var re_cc = regexp.MustCompile("cc: ?([^\n]+)") -var re_link = regexp.MustCompile("link: ?([^\n]+)") var re_convalidate = regexp.MustCompile("^(https?|tag|data):") func memetize(honk *Honk) {@@ -503,24 +504,6 @@ honk.Donks = append(honk.Donks, d)
return "" } honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl) -} - -func recategorize(honk *Honk) { - repl := func(x string) string { - x = x[5:] - for _, t := range strings.Split(x, " ") { - if t == "" { - continue - } - if t[0] != '#' { - t = "#" + t - } - dlog.Printf("hashtag: %s", t) - honk.Onts = append(honk.Onts, t) - } - return "" - } - honk.Noise = re_retag.ReplaceAllStringFunc(honk.Noise, repl) } var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]_]+([ \n:;.,']|$)")
@@ -63,39 +63,42 @@ const serverUID int64 = -2
const readyLuserOne int64 = 1 type Honk struct { - ID int64 - UserID int64 - Username string - What string - Honker string - Handle string - Handles string - Oonker string - Oondle string - XID string - RID string - Date time.Time - URL string - Noise string - Precis string - Format string - Convoy string - Audience []string - Public bool - Whofore int64 - Replies []*Honk - Flags int64 - HTPrecis template.HTML - HTML template.HTML - Style string - Open string - Donks []*Donk - Onts []string - Place *Place - Time *Time - Link string - Mentions []Mention - Badonks []Badonk + ID int64 + UserID int64 + Username string + What string + Honker string + Handle string + Handles string + Oonker string + Oondle string + XID string + RID string + Date time.Time + URL string + Noise string + Precis string + Format string + Convoy string + Audience []string + Public bool + Whofore int64 + Replies []*Honk + Flags int64 + HTPrecis template.HTML + HTML template.HTML + Style string + Open string + Donks []*Donk + Onts []string + Place *Place + Time *Time + Link string + Mentions []Mention + Badonks []Badonk + SeeAlso string + Onties string + LegalName string } type Badonk struct {
@@ -55,6 +55,9 @@ <details class="noise" {{ with .Open }}{{.}}{{end}}>
<summary class="noise">{{ .HTPrecis }}<p></summary> <p>{{ .HTPrecis }} <p class="content">{{ .HTML }} +{{ if .Link }} +<p><a href="{{ .Link }}">{{ or .LegalName .Link }}</a> +{{ end }} {{ with .Time }} <p>Time: {{ .StartTime.Local.Format "03:04PM MST Mon Jan 02"}} {{ if .Duration }}<br>Duration: {{ .Duration }}{{ end }}</p>
@@ -45,6 +45,17 @@ </svg>
<div id="emupicker"> </div> </details> +<details> +<summary>advanced</summary> +<p><label for=seealso>cc:</label><br> +<input type="text" name="seealso" value="{{ .SeeAlso }}"> +<p><label for=legalname>name:</label><br> +<input type="text" name="legalname" value="{{ .LegalName }}"> +<p><label for=link>link:</label><br> +<input type="text" name="link" value="{{ .Link }}"> +<p><label for=onties>tags:</label><br> +<input type="text" name="onties" value="{{ .Onties }}"> +</details> <p> <textarea name="noise" id="honknoise">{{ .Noise }}</textarea> <p class="buttonarray">
@@ -1633,6 +1633,10 @@ if tm.Duration != 0 {
templinfo["Duration"] = tm.Duration } } + templinfo["Onties"] = honk.Onties + templinfo["SeeAlso"] = honk.SeeAlso + templinfo["Link"] = honk.Link + templinfo["LegalName"] = honk.LegalName templinfo["ServerMessage"] = "honk edit" templinfo["IsPreview"] = true templinfo["UpdateXID"] = honk.XID@@ -1831,6 +1835,10 @@ Date: dt,
Format: format, } } + honk.SeeAlso = strings.TrimSpace(r.FormValue("seealso")) + honk.Onties = strings.TrimSpace(r.FormValue("onties")) + honk.Link = strings.TrimSpace(r.FormValue("link")) + honk.LegalName = strings.TrimSpace(r.FormValue("legalname")) var convoy string noise = strings.Replace(noise, "\r", "", -1)@@ -1848,7 +1856,6 @@ noise = quickrename(noise, userinfo.UserID)
honk.Noise = noise precipitate(honk) noise = honk.Noise - recategorize(honk) translate(honk) if rid != "" {@@ -1882,9 +1889,10 @@ honk.Audience = append(grapevine(honk.Mentions), honk.Audience...)
} else { honk.Audience = append(honk.Audience, grapevine(honk.Mentions)...) } + honk.Convoy = convoy - if convoy == "" { - convoy = "data:,electrichonkytonk-" + xfiltrate() + if honk.Convoy == "" { + honk.Convoy = "data:,electrichonkytonk-" + xfiltrate() } butnottooloud(honk.Audience) honk.Audience = oneofakind(honk.Audience)@@ -1894,7 +1902,6 @@ http.Error(w, "honk to nowhere...", http.StatusNotFound)
return nil } honk.Public = loudandproud(honk.Audience) - honk.Convoy = convoy donkxid := strings.Join(r.Form["donkxid"], ",") if donkxid == "" {