aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-inspect.el
diff options
context:
space:
mode:
authorAlexander Griffith <griffitaj@gmail.com>2017-05-01 20:08:44 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-05-05 10:53:12 -0400
commit54f04edafb24ef45206031c0cecf62f235eecc07 (patch)
treed165291bbf144fa5a1fbdf82bb1d63d4b54f1e7a /lisp/mastodon-inspect.el
parent3977a0b09e08dcffca249a6bcd188989f7b224ef (diff)
Added tooling for downloading individual toots
Diffstat (limited to 'lisp/mastodon-inspect.el')
-rw-r--r--lisp/mastodon-inspect.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el
index ad4e8fa..989269e 100644
--- a/lisp/mastodon-inspect.el
+++ b/lisp/mastodon-inspect.el
@@ -55,5 +55,29 @@
"*")
(mastodon-tl--property 'toot-json)))
+(defun mastodon-inspect--download-single-toot (toot-id)
+ "Download the toot/status represented by TOOT-ID."
+ (mastodon-http--get-json
+ (mastodon-http--api (concat "statuses/" toot-id))))
+
+(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 "*"))))
+ (with-current-buffer buffer
+ (let ((toot (mastodon-inspect--download-single-toot toot-id )))
+ (mastodon-tl--toot toot)
+ (replace-regexp "\n\n\n | " "\n | " nil (point-min) (point-max))
+ (mastodon-media--inline-images)))
+ (switch-to-buffer-other-window buffer)
+ (mastodon-mode)))
+
+(defun mastodon-inspect--view-single-toot-source (toot-id)
+ "View the ess source of a toot/status represented by TOOT-ID."
+ (interactive "s Toot ID: ")
+ (mastodon-inspect--dump-json-in-buffer
+ (concat "*mastodon-status-raw-" toot-id "*")
+ (mastodon-inspect--download-single-toot toot-id)))
+
(provide 'mastodon-inspect)
;;; mastodon-inspect.el ends here