diff options
author | Teodor Zlatanov <tzz@lifelogs.com> | 2010-09-02 00:17:40 +0000 |
---|---|---|
committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2010-09-02 00:17:40 +0000 |
commit | d743e0d118ef6a5d0312226e1da5b87173c752a3 (patch) | |
tree | 0496798faec113f7250545ad8b0482f133877907 /lisp | |
parent | e5e2587e9eb197028c11bd2f4f55c2b52692c580 (diff) | |
download | emacs-d743e0d118ef6a5d0312226e1da5b87173c752a3.tar.gz emacs-d743e0d118ef6a5d0312226e1da5b87173c752a3.tar.bz2 emacs-d743e0d118ef6a5d0312226e1da5b87173c752a3.zip |
gnus-html.el: add and use gnus-html-image-url-blocked-p
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/gnus/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/gnus/gnus-html.el | 24 |
2 files changed, 20 insertions, 9 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 09e7407a6c1..1ca717a01eb 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2010-09-01 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus-html.el (gnus-html-image-url-blocked-p): New function. + (gnus-html-prefetch-images, gnus-html-wash-tags): Use it. + 2010-09-01 Lars Magne Ingebrigtsen <larsi@gnus.org> * gnus-html.el (gnus-html-put-image): Use the deleted text as the image diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index 49e0ea62949..9acbfa3915d 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el @@ -136,8 +136,7 @@ fit these criteria." (delete-region start end) (gnus-put-image image (gnus-string-or string "*"))))) ;; Normal, external URL. - (when (or (null gnus-blocked-images) - (not (string-match gnus-blocked-images url))) + (unless (gnus-html-image-url-blocked-p url) (let ((file (gnus-html-image-id url))) (if (file-exists-p file) ;; It's already cached, so just insert it. @@ -284,6 +283,15 @@ fit these criteria." (decf total-size (cadr file)) (delete-file (nth 2 file))))))) + +(defun gnus-html-image-url-blocked-p (url) +"Find out if URL is blocked by `gnus-blocked-images'." + (let ((ret (and gnus-blocked-images + (string-match gnus-blocked-images url)))) + (when ret + (gnus-message 8 "Image URL %s is blocked by gnus-blocked-images regex %s" url gnus-blocked-images)) + ret)) + ;;;###autoload (defun gnus-html-prefetch-images (summary) (let (blocked-images urls) @@ -293,13 +301,11 @@ fit these criteria." (save-match-data (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t) (let ((url (match-string 1))) - (if (or (null blocked-images) - (not (string-match blocked-images url))) - (unless (file-exists-p (gnus-html-image-id url)) - (push url urls) - (push (gnus-html-image-id url) urls) - (push "-o" urls)) - (gnus-message 8 "Image URL %s is blocked" url)))) + (unless (gnus-html-image-url-blocked-p url) + (unless (file-exists-p (gnus-html-image-id url)) + (push url urls) + (push (gnus-html-image-id url) urls) + (push "-o" urls))))) (let ((process (apply 'start-process "images" nil "curl" |