Use image-url instead of gnus-image-url to unify the image url text properties.
[gnus] / lisp / gnus-html.el
index 861ad73..3b61567 100644 (file)
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(eval-when-compile (require 'mm-decode))
 
 (require 'gnus-art)
+(eval-when-compile (require 'mm-decode))
+
 (require 'mm-url)
 (require 'url)
 (require 'url-cache)
@@ -200,7 +201,7 @@ CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
           (let ((alt-text (when (string-match "\\(alt\\|title\\)=\"\\([^\"]+\\)"
                                               parameters)
                             (xml-substitute-special (match-string 2 parameters)))))
-            (gnus-put-text-property start end 'gnus-image-url url)
+            (gnus-put-text-property start end 'image-url url)
             (if (gnus-html-image-url-blocked-p
                  url
                  (if (buffer-live-p gnus-summary-buffer)
@@ -343,15 +344,19 @@ Use ALT-TEXT for the image string."
 (defun gnus-html-browse-image ()
   "Browse the image under point."
   (interactive)
-  (browse-url (get-text-property (point) 'gnus-image-url)))
+  (browse-url (get-text-property (point) 'image-url)))
 
 (defun gnus-html-browse-url ()
   "Browse the image under point."
   (interactive)
   (let ((url (get-text-property (point) 'gnus-string)))
-    (if (not url)
-       (message "No URL at point")
-      (browse-url url))))
+    (cond
+     ((not url)
+      (message "No link under point"))
+     ((string-match "^mailto:" url)
+      (gnus-url-mailto url))
+     (t
+      (browse-url url)))))
 
 (defun gnus-html-schedule-image-fetching (buffer image)
   "Retrieve IMAGE, and place it into BUFFER on arrival."
@@ -410,9 +415,9 @@ Return a string with image data."
   "Put an image with DATA from URL and optional ALT-TEXT."
   (when (gnus-graphic-display-p)
     (let* ((start (text-property-any (point-min) (point-max)
-                                    'gnus-image-url url))
+                                    'image-url url))
            (end (when start
-                  (next-single-property-change start 'gnus-image-url))))
+                  (next-single-property-change start 'image-url))))
       ;; Image found?
       (when start
         (let* ((image
@@ -454,7 +459,7 @@ Return a string with image data."
                                            'gnus-alt-text alt-text)
                     (when url
                       (gnus-put-text-property start (point)
-                                             'gnus-image-url url))
+                                             'image-url url))
                     (gnus-add-image 'external image)
                     t)
                 ;; Bad image, try to show something else
@@ -493,8 +498,9 @@ This only works if the article in question is HTML."
     (let ((blocked-images (with-current-buffer summary
                             (gnus-blocked-images))))
       (save-match-data
-       (while (re-search-forward "<img[^>]+src=[\"']\\([^\"']+\\)" nil t)
-         (let ((url (gnus-html-encode-url (match-string 1))))
+       (while (re-search-forward "<img[^>]+src=[\"']\\(http[^\"']+\\)" nil t)
+         (let ((url (gnus-html-encode-url
+                     (mm-url-decode-entities-string (match-string 1)))))
            (unless (gnus-html-image-url-blocked-p url blocked-images)
               (when (gnus-html-cache-expired url gnus-html-image-cache-ttl)
                 (gnus-html-schedule-image-fetching nil