aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-inspect.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-16 15:19:49 +0100
committermousebot <mousebot@riseup.net>2021-12-16 15:19:49 +0100
commitd451912722766482371ed491de415f1647cf8b9d (patch)
tree9e4752f2cbd48a216f46a5efb536cbdc55b2fcae /lisp/mastodon-inspect.el
parentaf72d4943ad942712ec74a387e79fb1d53e6bee8 (diff)
parenta3dd830e4e7b5eddfc21975506fe5461a36c2a89 (diff)
Merge branch 'develop' into notify-when-post
Diffstat (limited to 'lisp/mastodon-inspect.el')
-rw-r--r--lisp/mastodon-inspect.el39
1 files changed, 37 insertions, 2 deletions
diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el
index 9559b21..57240f3 100644
--- a/lisp/mastodon-inspect.el
+++ b/lisp/mastodon-inspect.el
@@ -30,12 +30,15 @@
;;; Code:
(autoload 'mastodon-http--api "mastodon-http")
(autoload 'mastodon-http--get-json "mastodon-http")
+(autoload 'mastodon-http--get-search-json "mastodon-http")
(autoload 'mastodon-media--inline-images "mastodon-media")
(autoload 'mastodon-mode "mastodon")
(autoload 'mastodon-tl--as-string "mastodon-tl")
(autoload 'mastodon-tl--property "mastodon-tl")
(autoload 'mastodon-tl--toot "mastodon-tl")
+(defvar mastodon-instance-url)
+
(defgroup mastodon-inspect nil
"Tools to help inspect toots."
:prefix "mastodon-inspect-"
@@ -59,7 +62,7 @@
(concat "*mastodon-inspect-toot-"
(mastodon-tl--as-string (mastodon-tl--property 'toot-id))
"*")
- (mastodon-tl--property 'toot-json)))
+ (mastodon-tl--property 'toot-json)))
(defun mastodon-inspect--download-single-toot (toot-id)
"Download the toot/status represented by TOOT-ID."
@@ -69,7 +72,7 @@
(defun mastodon-inspect--view-single-toot (toot-id)
"View the toot/status represented by TOOT-ID."
(interactive "s Toot ID: ")
- (let ((buffer (get-buffer-create(concat "*mastodon-status-" toot-id "*"))))
+ (let ((buffer (get-buffer-create (concat "*mastodon-status-" toot-id "*"))))
(with-current-buffer buffer
(let ((toot (mastodon-inspect--download-single-toot toot-id )))
(mastodon-tl--toot toot)
@@ -87,5 +90,37 @@
(concat "*mastodon-status-raw-" toot-id "*")
(mastodon-inspect--download-single-toot toot-id)))
+
+(defvar mastodon-inspect--search-query-accounts-result)
+(defvar mastodon-inspect--single-account-json)
+
+(defvar mastodon-inspect--search-query-full-result)
+(defvar mastodon-inspect--search-result-tags)
+
+(defun mastodon-inspect--get-search-result (query)
+ (interactive)
+ (setq mastodon-inspect--search-query-full-result
+ (append ; convert vector to list
+ (mastodon-http--get-search-json
+ (format "%s/api/v2/search" mastodon-instance-url)
+ query)
+ nil))
+ (setq mastodon-inspect--search-result-tags
+ (append (cdr
+ (caddr mastodon-inspect--search-query-full-result))
+ nil)))
+
+(defun mastodon-inspect--get-search-account (query)
+ (interactive)
+ (setq mastodon-inspect--search-query-accounts-result
+ (append ; convert vector to list
+ (mastodon-http--get-search-json
+ (format "%s/api/v1/accounts/search" mastodon-instance-url)
+ query)
+ nil))
+ (setq mastodon-inspect--single-account-json
+ (car mastodon-inspect--search-query-accounts-result)))
+
+
(provide 'mastodon-inspect)
;;; mastodon-inspect.el ends here