From e7ce8c5281f6b333ba41019c9de68ac46477db08 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 17 May 2020 21:26:59 -0400 Subject: [PATCH] some debug code for chatter --- activity.go | 9 +++++++-- honk.go | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/activity.go b/activity.go index b84288f..973c0e5 100644 --- a/activity.go +++ b/activity.go @@ -1294,7 +1294,7 @@ func boxuprcpts(user *WhatAbout, addresses []string, useshared bool) map[string] return rcpts } -func sendchonk(user *WhatAbout, ch *Chonk) { +func chonkifymsg(user *WhatAbout, ch *Chonk) []byte { dt := ch.Date.Format(time.RFC3339) aud := []string{ch.Target} @@ -1319,7 +1319,12 @@ func sendchonk(user *WhatAbout, ch *Chonk) { j["to"] = aud j["object"] = jo - msg := j.ToBytes() + return j.ToBytes() +} + +func sendchonk(user *WhatAbout, ch *Chonk) { + msg := chonkifymsg(user, ch) + rcpts := make(map[string]bool) rcpts[ch.Target] = true for a := range rcpts { diff --git a/honk.go b/honk.go index b7bc067..a8b05d4 100644 --- a/honk.go +++ b/honk.go @@ -337,6 +337,18 @@ func main() { case "backend": backendServer() case "test": + xid := args[1] + chatter := loadchatter(1) + for _, chonks := range chatter { + for _, ch := range chonks { + if ch.XID == xid { + var user *WhatAbout + somenumberedusers.Get(ch.UserID, &user) + msg := chonkifymsg(user, ch) + fmt.Println(string(msg)) + } + } + } ElaborateUnitTests() default: log.Fatal("unknown command")