]> git.eshelyaron.com Git - emacs.git/commitdiff
gnus-html.el: Introduce a new variable, gnus-blocked-images, and use that instead...
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 31 Aug 2010 23:38:57 +0000 (23:38 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 31 Aug 2010 23:38:57 +0000 (23:38 +0000)
doc/misc/ChangeLog
doc/misc/gnus.texi
lisp/gnus/ChangeLog
lisp/gnus/gnus-html.el

index eb2adf7fd203eada74a65611a09711f7c16d5f11..e142af49ad1aaffc134dbd02888632372c524470 100644 (file)
@@ -1,5 +1,7 @@
 2010-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus.texi (HTML): Document gnus-blocked-images.
+
        * message.texi (Wide Reply): Document message-prune-recipient-rules.
 
 2010-08-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
index f09490d9a9a2ed348940a29b3f7b77bc105e9588..8e2caf5a145791f0f8f7a2533e7f80beaf9c3c7c 100644 (file)
@@ -12501,10 +12501,22 @@ section only describes the default method.
 If set to @code{gnus-article-html}, Gnus will use the built-in method,
 that's based on @code{curl} and @code{w3m}.
 
+@item gnus-blocked-images
+@vindex gnus-blocked-images
+Images that have @acronym{URL}s that match this regexp won't be
+fetched and displayed.  For instance, do block all @acronym{URL}s that
+have the string ``ads'' in them, do the following:
+
+@lisp
+(setq gnus-blocked-images "ads")
+@end lisp
+
+The default is to block all external images.
+
 @item gnus-html-cache-directory
 @vindex gnus-html-cache-directory
 Gnus will download and cache images according to how
-@code{mm-w3m-safe-url-regexp} is set.  These images will be stored in
+@code{gnus-blocked-images} is set.  These images will be stored in
 this directory.
 
 @item gnus-html-cache-size
index cb96149e538423666c1e56709277aafe9779278c..ecfdcc1ee4e940dc6b498e563f61969beeb8b75d 100644 (file)
@@ -1,5 +1,7 @@
 2010-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-html.el (gnus-blocked-images): New variable.
+
        * message.el (message-prune-recipients): New function.
        (message-prune-recipient-rules): New variable.
 
index c64b9f5f0d1f682bbc8b251de3f7326522e5e628..f568d67334547c86ec76932962f287e0c830d083 100644 (file)
   :group 'gnus-art
   :type 'integer)
 
+(defcustom gnus-blocked-images "."
+  "Images that have URLs matching this regexp will be blocked."
+  :group 'gnus-art
+  :type 'regexp)
+
 ;;;###autoload
 (defun gnus-article-html (handle)
   (let ((article-buffer (current-buffer)))
        ((equal tag "img_alt")
        (when (string-match "src=\"\\([^\"]+\\)" parameters)
          (setq url (match-string 1 parameters))
-         (when (or (null mm-w3m-safe-url-regexp)
-                   (string-match mm-w3m-safe-url-regexp url))
-           (if (string-match "^cid:\\(.*\\)" url)
-               ;; URLs with cid: have their content stashed in other
-               ;; parts of the MIME structure, so just insert them
-               ;; immediately.
-               (let ((handle (mm-get-content-id
-                              (setq url (match-string 1 url))))
-                     image)
-                 (when handle
-                   (mm-with-part handle
-                     (setq image (gnus-create-image (buffer-string)
-                                                    nil t))))
-                 (when image
-                   (delete-region start end)
-                   (gnus-put-image image)))
-             ;; Normal, external URL.
+         (if (string-match "^cid:\\(.*\\)" url)
+             ;; URLs with cid: have their content stashed in other
+             ;; parts of the MIME structure, so just insert them
+             ;; immediately.
+             (let ((handle (mm-get-content-id
+                            (setq url (match-string 1 url))))
+                   image)
+               (when handle
+                 (mm-with-part handle
+                   (setq image (gnus-create-image (buffer-string)
+                                                  nil t))))
+               (when image
+                 (delete-region start end)
+                 (gnus-put-image image)))
+           ;; Normal, external URL.
+           (when (or (null gnus-blocked-images)
+                     (not (string-match gnus-blocked-images url)))
              (let ((file (gnus-html-image-id url)))
                (if (file-exists-p file)
                    ;; It's already cached, so just insert it.
 
 ;;;###autoload
 (defun gnus-html-prefetch-images (summary)
-  (let (safe-url-regexp urls)
+  (let (blocked-images urls)
     (when (buffer-live-p summary)
       (with-current-buffer summary
-       (setq safe-url-regexp mm-w3m-safe-url-regexp))
+       (setq blocked-images gnus-blocked-images))
       (save-match-data
        (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)
          (let ((url (match-string 1)))
-           (when (or (null safe-url-regexp)
-                     (string-match safe-url-regexp url))
+           (when (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)