some cleanups
This commit is contained in:
parent
f7a6578ecb
commit
bae6e430d6
|
@ -1335,16 +1335,13 @@ func investigate(name string) (*Honker, error) {
|
|||
if name == "" {
|
||||
return nil, fmt.Errorf("no name")
|
||||
}
|
||||
log.Printf("digging up some info on %s", name)
|
||||
obj, err := GetJunkFast(name)
|
||||
if err != nil {
|
||||
log.Printf("error investigating honker: %s", err)
|
||||
return nil, err
|
||||
}
|
||||
t, _ := obj.GetString("type")
|
||||
if !isactor(t) {
|
||||
log.Printf("it's not a person! %s", name)
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("not a person")
|
||||
}
|
||||
xid, _ := obj.GetString("id")
|
||||
handle, _ := obj.GetString("preferredUsername")
|
||||
|
|
7
honk.go
7
honk.go
|
@ -97,7 +97,6 @@ type Donk struct {
|
|||
URL string
|
||||
Media string
|
||||
Local bool
|
||||
Content []byte
|
||||
}
|
||||
|
||||
type Place struct {
|
||||
|
@ -136,12 +135,6 @@ type Honker struct {
|
|||
Combos []string
|
||||
}
|
||||
|
||||
type Zonker struct {
|
||||
ID int64
|
||||
Name string
|
||||
Wherefore string
|
||||
}
|
||||
|
||||
var serverName string
|
||||
var iconName = "icon.png"
|
||||
var serverMsg = "Things happen."
|
||||
|
|
14
web.go
14
web.go
|
@ -99,6 +99,7 @@ func homepage(w http.ResponseWriter, r *http.Request) {
|
|||
userid = u.UserID
|
||||
switch r.URL.Path {
|
||||
case "/atme":
|
||||
templinfo["PageName"] = "at me!"
|
||||
templinfo["PageName"] = "atme"
|
||||
honks = gethonksforme(userid)
|
||||
case "/events":
|
||||
|
@ -820,7 +821,7 @@ func submitbonk(w http.ResponseWriter, r *http.Request) {
|
|||
oonker = xonk.Honker
|
||||
}
|
||||
dt := time.Now().UTC()
|
||||
bonk := Honk{
|
||||
bonk := &Honk{
|
||||
UserID: userinfo.UserID,
|
||||
Username: userinfo.Username,
|
||||
What: "bonk",
|
||||
|
@ -837,17 +838,16 @@ func submitbonk(w http.ResponseWriter, r *http.Request) {
|
|||
Convoy: xonk.Convoy,
|
||||
Audience: []string{thewholeworld, oonker},
|
||||
Public: true,
|
||||
Format: "html",
|
||||
}
|
||||
|
||||
bonk.Format = "html"
|
||||
|
||||
err = savehonk(&bonk)
|
||||
err = savehonk(bonk)
|
||||
if err != nil {
|
||||
log.Printf("uh oh")
|
||||
return
|
||||
}
|
||||
|
||||
go honkworldwide(user, &bonk)
|
||||
go honkworldwide(user, bonk)
|
||||
|
||||
if r.FormValue("js") != "1" {
|
||||
templinfo := getInfo(r)
|
||||
|
@ -860,7 +860,7 @@ func submitbonk(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) {
|
||||
zonk := Honk{
|
||||
zonk := &Honk{
|
||||
What: what,
|
||||
XID: xonk.XID,
|
||||
Date: time.Now().UTC(),
|
||||
|
@ -869,7 +869,7 @@ func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) {
|
|||
zonk.Public = !keepitquiet(zonk.Audience)
|
||||
|
||||
log.Printf("announcing %sed honk: %s", what, xonk.XID)
|
||||
go honkworldwide(user, &zonk)
|
||||
go honkworldwide(user, zonk)
|
||||
}
|
||||
|
||||
func zonkit(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in New Issue