gnus-html.el: Add extra logging.
[gnus] / lisp / gnus-html.el
index 0c3ad4b..5ad90a8 100644 (file)
          (let* ((coding-system-for-read 'utf-8)
                 (coding-system-for-write 'utf-8)
                 (default-process-coding-system
-                  (cons coding-system-for-read coding-system-for-write)))
+                  (cons coding-system-for-read coding-system-for-write))
+                (charset (mail-content-type-get (mm-handle-type handle)
+                                                'charset)))
+           (when (and charset
+                      (setq charset (mm-charset-to-coding-system charset))
+                      (not (eq charset 'ascii)))
+             (mm-decode-coding-region (point-min) (point-max) charset))
            (call-process-region (point-min) (point-max)
                                 "w3m" 
                                 nil article-buffer nil
       (cond
        ;; Fetch and insert a picture.
        ((equal tag "img_alt")
-       (when (string-match "src=\"\\([^\"]+\\)" parameters)
+        (when (string-match "src=\"\\([^\"]+\\)" parameters)
          (setq url (match-string 1 parameters))
+          (gnus-message 8 "Fetching image URL %s" url)
          (if (string-match "^cid:\\(.*\\)" url)
              ;; URLs with cid: have their content stashed in other
              ;; parts of the MIME structure, so just insert them
        ((equal tag "a")
        (when (string-match "href=\"\\([^\"]+\\)" parameters)
          (setq url (match-string 1 parameters))
+          (gnus-message 8 "Fetching link URL %s" url)
          (gnus-article-add-button start end
                                   'browse-url url
                                   url)
       (gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))))
 
 (defun gnus-html-schedule-image-fetching (buffer images)
+  (gnus-message 8 "Scheduling image fetching in buffer %s, images %s" buffer images)
   (let* ((url (caar images))
         (process (start-process
                   "images" nil "curl"
       (save-match-data
        (while (re-search-forward "<img.*src=[\"']\\([^\"']+\\)" nil t)
          (let ((url (match-string 1)))
-           (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)
-               (push "-o" urls)))))
+           (if (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)
+                  (push "-o" urls))
+              (gnus-message 8 "Image URL %s is blocked" url))))
        (let ((process
               (apply 'start-process 
                      "images" nil "curl"