From a0393146d3424d8e0f249d3947c54a9faf19e509 Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 22 Oct 2021 12:00:54 +0200 Subject: bookmark/unbookmark toot funs --- lisp/mastodon-toot.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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)) -- cgit v1.2.3