From 2a6de8f7bcc1e355bfb77debd4fd5ff084fedef9 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 11 Nov 2020 14:44:51 -0500 Subject: [PATCH] make the ping command easier to use --- docs/changelog.txt | 4 ++++ honk.go | 2 +- web.go | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index cd842d6..bb810a9 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,9 @@ changelog +=== next + ++ Easier to use ping command. + === 0.9.3 Notacanthous Nutshell ++ backup command. diff --git a/honk.go b/honk.go index ea2ceac..663725d 100644 --- a/honk.go +++ b/honk.go @@ -340,7 +340,7 @@ func main() { svalbard(name) case "ping": if len(args) < 3 { - fmt.Printf("usage: honk ping from to\n") + fmt.Printf("usage: honk ping (from username) (to username or url)\n") return } name := args[1] diff --git a/web.go b/web.go index 0b1f05a..db905ad 100644 --- a/web.go +++ b/web.go @@ -257,12 +257,23 @@ func crappola(j junk.Junk) bool { } func ping(user *WhatAbout, who string) { + if targ := fullname(who, user.ID); targ != "" { + who = targ + } + if !strings.HasPrefix(who, "https:") { + who = gofish(who) + } + if who == "" { + log.Printf("nobody to ping!") + return + } var box *Box ok := boxofboxes.Get(who, &box) if !ok { log.Printf("no inbox to ping %s", who) return } + log.Printf("sending ping to %s", box.In) j := junk.New() j["@context"] = itiswhatitis j["type"] = "Ping"