some debug code for chatter

This commit is contained in:
Ted Unangst 2020-05-17 21:26:59 -04:00
parent 0b0d4eaedf
commit e7ce8c5281
2 changed files with 19 additions and 2 deletions

View File

@ -1294,7 +1294,7 @@ func boxuprcpts(user *WhatAbout, addresses []string, useshared bool) map[string]
return rcpts return rcpts
} }
func sendchonk(user *WhatAbout, ch *Chonk) { func chonkifymsg(user *WhatAbout, ch *Chonk) []byte {
dt := ch.Date.Format(time.RFC3339) dt := ch.Date.Format(time.RFC3339)
aud := []string{ch.Target} aud := []string{ch.Target}
@ -1319,7 +1319,12 @@ func sendchonk(user *WhatAbout, ch *Chonk) {
j["to"] = aud j["to"] = aud
j["object"] = jo 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 := make(map[string]bool)
rcpts[ch.Target] = true rcpts[ch.Target] = true
for a := range rcpts { for a := range rcpts {

12
honk.go
View File

@ -337,6 +337,18 @@ func main() {
case "backend": case "backend":
backendServer() backendServer()
case "test": 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() ElaborateUnitTests()
default: default:
log.Fatal("unknown command") log.Fatal("unknown command")