some debug code for chatter
Ted Unangst tedu@tedunangst.com
Sun, 17 May 2020 21:26:59 -0400
2 files changed,
19 insertions(+),
2 deletions(-)
M
activity.go
→
activity.go
@@ -1294,7 +1294,7 @@ }
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 @@ j["published"] = dt
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 {
M
honk.go
→
honk.go
@@ -337,6 +337,18 @@ serve()
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")