aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-10-22 12:00:54 +0200
committermousebot <mousebot@riseup.net>2021-10-22 12:00:54 +0200
commita0393146d3424d8e0f249d3947c54a9faf19e509 (patch)
tree5869adadd7e8111414eec1896f2b6c72fabc6b87 /lisp/mastodon-toot.el
parentc9bae35413ab9570252c44cdd212f1ab291af83f (diff)
bookmark/unbookmark toot funs
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 824f0c6..80c63f6 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -318,6 +318,30 @@ Remove MARKER if REMOVE is non-nil, otherwise add it."
(setq mastodon-toot--content-warning-from-reply-or-redraft toot-cw))
(mastodon-toot--update-status-fields))))))))))
+(defun mastodon-toot--bookmark-toot ()
+ "Bookmark toot at point synchronously."
+ (interactive)
+ (let* ((toot (mastodon-tl--property 'toot-json))
+ (id (mastodon-tl--as-string (mastodon-tl--toot-id toot)))
+ (url (mastodon-http--api (format "statuses/%s/bookmark" id))))
+ (if (y-or-n-p (format "Bookmark this toot? "))
+ (let ((response (mastodon-http--post url nil nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (message "Toot bookmarked!")))))))
+
+(defun mastodon-toot--unbookmark-toot ()
+ "Bookmark toot at point synchronously."
+ (interactive)
+ (let* ((toot (mastodon-tl--property 'toot-json))
+ (id (mastodon-tl--as-string (mastodon-tl--toot-id toot)))
+ (url (mastodon-http--api (format "statuses/%s/unbookmark" id))))
+ (if (y-or-n-p (format "Remove this toot from your bookmarks? "))
+ (let ((response (mastodon-http--post url nil nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (message "Toot unbookmarked!")))))))
+
(defun mastodon-toot--kill ()
"Kill `mastodon-toot-mode' buffer and window."
(kill-buffer-and-window))