make the ping command easier to use
This commit is contained in:
parent
8a2d3348fa
commit
2a6de8f7bc
|
@ -1,5 +1,9 @@
|
||||||
changelog
|
changelog
|
||||||
|
|
||||||
|
=== next
|
||||||
|
|
||||||
|
+ Easier to use ping command.
|
||||||
|
|
||||||
=== 0.9.3 Notacanthous Nutshell
|
=== 0.9.3 Notacanthous Nutshell
|
||||||
|
|
||||||
++ backup command.
|
++ backup command.
|
||||||
|
|
2
honk.go
2
honk.go
|
@ -340,7 +340,7 @@ func main() {
|
||||||
svalbard(name)
|
svalbard(name)
|
||||||
case "ping":
|
case "ping":
|
||||||
if len(args) < 3 {
|
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
|
return
|
||||||
}
|
}
|
||||||
name := args[1]
|
name := args[1]
|
||||||
|
|
11
web.go
11
web.go
|
@ -257,12 +257,23 @@ func crappola(j junk.Junk) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ping(user *WhatAbout, who string) {
|
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
|
var box *Box
|
||||||
ok := boxofboxes.Get(who, &box)
|
ok := boxofboxes.Get(who, &box)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Printf("no inbox to ping %s", who)
|
log.Printf("no inbox to ping %s", who)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.Printf("sending ping to %s", box.In)
|
||||||
j := junk.New()
|
j := junk.New()
|
||||||
j["@context"] = itiswhatitis
|
j["@context"] = itiswhatitis
|
||||||
j["type"] = "Ping"
|
j["type"] = "Ping"
|
||||||
|
|
Loading…
Reference in New Issue