diff options
author | mousebot <mousebot@riseup.net> | 2021-12-17 14:26:03 +0100 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-12-17 14:26:03 +0100 |
commit | bb9e8ab828cf249ce8fd23a47fe4e75ee9ab61c7 (patch) | |
tree | 76be863aeb318606a195a5fe913fd6c15f825ab7 /lisp/mastodon-inspect.el | |
parent | 2d8337af15b2b0c988df13cea4cb31c944b21aac (diff) | |
parent | c65c6231f29929b6e39ebcc9b866d492519ae19b (diff) |
Merge branch 'develop'
Diffstat (limited to 'lisp/mastodon-inspect.el')
-rw-r--r-- | lisp/mastodon-inspect.el | 39 |
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 |