all repos — honk @ 208e3d2bc72b429eeaf075b2d9aed3871edf8fe7

my fork of honk

consolidate dumpactivity
Ted Unangst tedu@tedunangst.com
Tue, 18 Feb 2020 12:50:19 -0500
commit

208e3d2bc72b429eeaf075b2d9aed3871edf8fe7

parent

9447d067132c6eb078f0d89114999ce8b48c8d0b

2 files changed, 16 insertions(+), 9 deletions(-)

jump to
M activity.goactivity.go

@@ -585,10 +585,7 @@ obj = item

what = "event" default: log.Printf("unknown activity: %s", what) - fd, _ := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) - item.Write(fd) - io.WriteString(fd, "\n") - fd.Close() + dumpactivity(item) return nil }

@@ -902,6 +899,17 @@ return &xonk

} return xonkxonkfn(item, origin) +} + +func dumpactivity(item junk.Junk) { + fd, err := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) + if err != nil { + log.Printf("error opening inbox! %s", err) + return + } + defer fd.Close() + item.Write(fd) + io.WriteString(fd, "\n") } func rubadubdub(user *WhatAbout, req junk.Junk) {
M web.goweb.go

@@ -422,11 +422,7 @@ return

} } log.Printf("unknown Update activity") - fd, _ := os.OpenFile("savedinbox.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) - j.Write(fd) - io.WriteString(fd, "\n") - fd.Close() - + dumpactivity(j) case "Undo": obj, ok := j.GetMap("object") if !ok {

@@ -553,6 +549,9 @@ if err != nil {

log.Printf("error updating honker: %s", err) return } + default: + log.Printf("unhandled server activity: %s", what) + dumpactivity(j) } }