aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-08-08 14:05:10 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-08-08 14:14:09 +0200
commit499c03aa783628ff5937b77cb48d3aeaa83f0ae3 (patch)
tree2c006ea4d27ca129c340f8ba00c62fea7b9faa54 /lisp/mastodon-tl.el
parentb68a82b47206e6bb9b61e2326f6e0de299c57e96 (diff)
refactor process-image-or-cached
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el16
1 files changed, 4 insertions, 12 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index be71b4d..375f7e4 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1222,18 +1222,10 @@ SENSITIVE is a flag from the item's JSON data."
(let* ((url (mastodon-tl--property 'image-url)))
(if (not mastodon-tl--load-full-sized-images-in-emacs)
(shr-browse-image)
- (if (and mastodon-media--enable-image-caching
- (url-is-cached url))
- ;; if image url is cached, decompress and use it
- (with-current-buffer (url-fetch-from-cache url)
- (set-buffer-multibyte nil)
- (goto-char (point-min))
- (zlib-decompress-region
- (goto-char (search-forward "\n\n")) (point-max))
- (mastodon-media--process-full-sized-image-response nil url))
- ;; else fetch and load:
- (url-retrieve url #'mastodon-media--process-full-sized-image-response
- `(,url)))))))
+ (mastodon-media--image-or-cached
+ url
+ #'mastodon-media--process-full-sized-image-response
+ `(nil ,url))))))
(defvar mastodon-media--sensitive-image-data)