ref: 4ac887f80318dd1be078aa887a12699ad3364f5c
parent: 418acd5137edd628648ccbfc79a8f9e7e2e10faa
author: penny <penny@limitedideas.org>
date: Mon Sep 22 16:48:59 EDT 2025
Look up accounts by name, add incoming status stat
--- a/main.go
+++ b/main.go
@@ -81,10 +81,13 @@
index, content, _ := strings.Cut(arguments, " ")
postItem, postOK := homeMap[index]
- debugItem, debugOK := debugMap[index]
+ debugItem, _ := debugMap[index]
+ //Wether we got a post index or not
+ var foundindex bool
//If there's no index selected load the last post we operated on
if postOK {+ foundindex = true
lastindex = index
} else {postItem, postOK = homeMap[lastindex]
@@ -160,10 +163,6 @@
return
}
- if !postOK && !debugOK {- fmt.Printf("\"%v\" not a valid index\n", index)- return
- }
//Commands that accept debug indexes
switch command {case "examine":
@@ -175,11 +174,6 @@
return
}
- //if a user passes a debug index to a status command
- if !postOK {- fmt.Printf("\"%v\" not a valid post index\n", index)- return
- }
//Commands require status indexes
switch command {case "like":
@@ -319,8 +313,22 @@
}
return
case "account":
- account := postItem.Account
- fmt.Printf(hc.formatAccount(&account))
+ if foundindex {+ account := postItem.Account
+ fmt.Printf(hc.formatAccount(&account))
+ return
+ }
+ accounts, err := hc.client.AccountsSearchResolve(context.Background(), index, 1, true)
+ if err != nil {+ fmt.Printf("Error resolving account %s: %v\n", index, err)+ return
+ }
+ if len(accounts) < 1 {+ fmt.Printf("No account matched %s\n", index)+ return
+ }
+ account := accounts[0]
+ fmt.Printf(hc.formatAccount(account))
return
case "fpost":
_, err := hc.filterStatus(postItem)
--- a/mastodon.go
+++ b/mastodon.go
@@ -243,7 +243,7 @@
}
}
- return sb.String()
+ return hyphenate(sb.String())
}
// Spaces before prefixes (no space if you're not passing a prefix)
@@ -385,6 +385,10 @@
return
case *mastodon.UpdateEditEvent:
+ //Count the statuses
+ hc.stats.slock.Lock()
+ hc.stats.IncomingStatuses++
+ hc.stats.slock.Unlock()
if hc.isPaused {currentPostRef := hc.homeref.ref
capturedPost := post
--
⑨