emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r101254: gnus-html.el: Introduce a ne


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101254: gnus-html.el: Introduce a new variable, gnus-blocked-images, and use that instead of the w3m variable; by Lars Magne Ingebrigtsen <address@hidden>.
Date: Tue, 31 Aug 2010 23:38:57 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101254
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2010-08-31 23:38:57 +0000
message:
  gnus-html.el: Introduce a new variable, gnus-blocked-images, and use that 
instead of the w3m variable; by Lars Magne Ingebrigtsen <address@hidden>.
modified:
  doc/misc/ChangeLog
  doc/misc/gnus.texi
  lisp/gnus/ChangeLog
  lisp/gnus/gnus-html.el
=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog        2010-08-31 23:26:23 +0000
+++ b/doc/misc/ChangeLog        2010-08-31 23:38:57 +0000
@@ -1,5 +1,7 @@
 2010-08-31  Lars Magne Ingebrigtsen  <address@hidden>
 
+       * gnus.texi (HTML): Document gnus-blocked-images.
+
        * message.texi (Wide Reply): Document message-prune-recipient-rules.
 
 2010-08-30  Lars Magne Ingebrigtsen  <address@hidden>

=== modified file 'doc/misc/gnus.texi'
--- a/doc/misc/gnus.texi        2010-08-31 00:42:27 +0000
+++ b/doc/misc/gnus.texi        2010-08-31 23:38:57 +0000
@@ -12501,10 +12501,22 @@
 If set to @code{gnus-article-html}, Gnus will use the built-in method,
 that's based on @code{curl} and @code{w3m}.
 
address@hidden gnus-blocked-images
address@hidden 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:
+
address@hidden
+(setq gnus-blocked-images "ads")
address@hidden 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
address@hidden is set.  These images will be stored in
address@hidden is set.  These images will be stored in
 this directory.
 
 @item gnus-html-cache-size

=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-08-31 23:26:23 +0000
+++ b/lisp/gnus/ChangeLog       2010-08-31 23:38:57 +0000
@@ -1,5 +1,7 @@
 2010-08-31  Lars Magne Ingebrigtsen  <address@hidden>
 
+       * gnus-html.el (gnus-blocked-images): New variable.
+
        * message.el (message-prune-recipients): New function.
        (message-prune-recipient-rules): New variable.
 

=== modified file 'lisp/gnus/gnus-html.el'
--- a/lisp/gnus/gnus-html.el    2010-08-31 23:26:23 +0000
+++ b/lisp/gnus/gnus-html.el    2010-08-31 23:38:57 +0000
@@ -47,6 +47,11 @@
   :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)))
@@ -94,23 +99,23 @@
        ((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.
@@ -224,15 +229,15 @@
 
 ;;;###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)


reply via email to

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