aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/gnus/ChangeLog2
-rw-r--r--lisp/gnus/gnus-html.el47
2 files changed, 28 insertions, 21 deletions
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)