aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/misc/ChangeLog2
-rw-r--r--doc/misc/gnus.texi14
-rw-r--r--lisp/gnus/ChangeLog2
-rw-r--r--lisp/gnus/gnus-html.el47
4 files changed, 43 insertions, 22 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index eb2adf7fd20..e142af49ad1 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,5 +1,7 @@
12010-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org> 12010-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 2
3 * gnus.texi (HTML): Document gnus-blocked-images.
4
3 * message.texi (Wide Reply): Document message-prune-recipient-rules. 5 * message.texi (Wide Reply): Document message-prune-recipient-rules.
4 6
52010-08-30 Lars Magne Ingebrigtsen <larsi@gnus.org> 72010-08-30 Lars Magne Ingebrigtsen <larsi@gnus.org>
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index f09490d9a9a..8e2caf5a145 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -12501,10 +12501,22 @@ section only describes the default method.
12501If set to @code{gnus-article-html}, Gnus will use the built-in method, 12501If set to @code{gnus-article-html}, Gnus will use the built-in method,
12502that's based on @code{curl} and @code{w3m}. 12502that's based on @code{curl} and @code{w3m}.
12503 12503
12504@item gnus-blocked-images
12505@vindex gnus-blocked-images
12506Images that have @acronym{URL}s that match this regexp won't be
12507fetched and displayed. For instance, do block all @acronym{URL}s that
12508have the string ``ads'' in them, do the following:
12509
12510@lisp
12511(setq gnus-blocked-images "ads")
12512@end lisp
12513
12514The default is to block all external images.
12515
12504@item gnus-html-cache-directory 12516@item gnus-html-cache-directory
12505@vindex gnus-html-cache-directory 12517@vindex gnus-html-cache-directory
12506Gnus will download and cache images according to how 12518Gnus will download and cache images according to how
12507@code{mm-w3m-safe-url-regexp} is set. These images will be stored in 12519@code{gnus-blocked-images} is set. These images will be stored in
12508this directory. 12520this directory.
12509 12521
12510@item gnus-html-cache-size 12522@item gnus-html-cache-size
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index cb96149e538..ecfdcc1ee4e 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,5 +1,7 @@
12010-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org> 12010-08-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 2
3 * gnus-html.el (gnus-blocked-images): New variable.
4
3 * message.el (message-prune-recipients): New function. 5 * message.el (message-prune-recipients): New function.
4 (message-prune-recipient-rules): New variable. 6 (message-prune-recipient-rules): New variable.
5 7
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index c64b9f5f0d1..f568d673345 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -47,6 +47,11 @@
47 :group 'gnus-art 47 :group 'gnus-art
48 :type 'integer) 48 :type 'integer)
49 49
50(defcustom gnus-blocked-images "."
51 "Images that have URLs matching this regexp will be blocked."
52 :group 'gnus-art
53 :type 'regexp)
54
50;;;###autoload 55;;;###autoload
51(defun gnus-article-html (handle) 56(defun gnus-article-html (handle)
52 (let ((article-buffer (current-buffer))) 57 (let ((article-buffer (current-buffer)))
@@ -94,23 +99,23 @@
94 ((equal tag "img_alt") 99 ((equal tag "img_alt")
95 (when (string-match "src=\"\\([^\"]+\\)" parameters) 100 (when (string-match "src=\"\\([^\"]+\\)" parameters)
96 (setq url (match-string 1 parameters)) 101 (setq url (match-string 1 parameters))
97 (when (or (null mm-w3m-safe-url-regexp) 102 (if (string-match "^cid:\\(.*\\)" url)
98 (string-match mm-w3m-safe-url-regexp url)) 103 ;; URLs with cid: have their content stashed in other
99 (if (string-match "^cid:\\(.*\\)" url) 104 ;; parts of the MIME structure, so just insert them
100 ;; URLs with cid: have their content stashed in other 105 ;; immediately.
101 ;; parts of the MIME structure, so just insert them 106 (let ((handle (mm-get-content-id
102 ;; immediately. 107 (setq url (match-string 1 url))))
103 (let ((handle (mm-get-content-id 108 image)
104 (setq url (match-string 1 url)))) 109 (when handle
105 image) 110 (mm-with-part handle
106 (when handle 111 (setq image (gnus-create-image (buffer-string)
107 (mm-with-part handle 112 nil t))))
108 (setq image (gnus-create-image (buffer-string) 113 (when image
109 nil t)))) 114 (delete-region start end)
110 (when image 115 (gnus-put-image image)))
111 (delete-region start end) 116 ;; Normal, external URL.
112 (gnus-put-image image))) 117 (when (or (null gnus-blocked-images)
113 ;; Normal, external URL. 118 (not (string-match gnus-blocked-images url)))
114 (let ((file (gnus-html-image-id url))) 119 (let ((file (gnus-html-image-id url)))
115 (if (file-exists-p file) 120 (if (file-exists-p file)
116 ;; It's already cached, so just insert it. 121 ;; It's already cached, so just insert it.
@@ -224,15 +229,15 @@
224 229
225;;;###autoload 230;;;###autoload
226(defun gnus-html-prefetch-images (summary) 231(defun gnus-html-prefetch-images (summary)
227 (let (safe-url-regexp urls) 232 (let (blocked-images urls)
228 (when (buffer-live-p summary) 233 (when (buffer-live-p summary)
229 (with-current-buffer summary 234 (with-current-buffer summary
230 (setq safe-url-regexp mm-w3m-safe-url-regexp)) 235 (setq blocked-images gnus-blocked-images))
231 (save-match-data 236 (save-match-data
232 (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t) 237 (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)
233 (let ((url (match-string 1))) 238 (let ((url (match-string 1)))
234 (when (or (null safe-url-regexp) 239 (when (or (null blocked-images)
235 (string-match safe-url-regexp url)) 240 (not (string-match blocked-images url)))
236 (unless (file-exists-p (gnus-html-image-id url)) 241 (unless (file-exists-p (gnus-html-image-id url))
237 (push url urls) 242 (push url urls)
238 (push (gnus-html-image-id url) urls) 243 (push (gnus-html-image-id url) urls)