emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101276: gnus-html.el: add and use gn


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101276: gnus-html.el: add and use gnus-html-image-url-blocked-p
Date: Thu, 02 Sep 2010 00:17:40 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101276
author: Teodor Zlatanov <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Thu 2010-09-02 00:17:40 +0000
message:
  gnus-html.el: add and use gnus-html-image-url-blocked-p
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/gnus-html.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-09-02 00:08:22 +0000
+++ b/lisp/gnus/ChangeLog       2010-09-02 00:17:40 +0000
@@ -1,3 +1,8 @@
+2010-09-01  Teodor Zlatanov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * gnus-html.el (gnus-html-put-image): Use the deleted text as the image

=== modified file 'lisp/gnus/gnus-html.el'
--- a/lisp/gnus/gnus-html.el    2010-09-02 00:13:51 +0000
+++ b/lisp/gnus/gnus-html.el    2010-09-02 00:17:40 +0000
@@ -136,8 +136,7 @@
                    (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 @@
          (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 @@
       (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"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]