(shr-insert-table): Also insert empty TDs.
[gnus] / lisp / gnus-gravatar.el
index 2af975b..e974e9a 100644 (file)
   :version "24.1"
   :group 'gnus-gravatar)
 
+(defcustom gnus-gravatar-too-ugly (if (boundp 'gnus-article-x-face-too-ugly)
+                                     gnus-article-x-face-too-ugly)
+  "Regexp matching posters whose avatar shouldn't be shown automatically."
+  :type '(choice regexp (const nil))
+  :version "24.1"
+  :group 'gnus-gravatar)
+
 (defun gnus-gravatar-transform-address (header category)
   (gnus-with-article-headers
     (let ((addresses
              (mail-fetch-field header)))))
       (let ((gravatar-size gnus-gravatar-size))
         (dolist (address addresses)
-          (gravatar-retrieve
-           (car address)
-           'gnus-gravatar-insert
-           (list header address category)))))))
+         (unless (and gnus-gravatar-too-ugly
+                      (or (string-match gnus-gravatar-too-ugly
+                                        (car address))
+                          (and (cdr address)
+                               (string-match gnus-gravatar-too-ugly
+                                             (cdr address)))))
+           (gravatar-retrieve
+            (car address)
+            'gnus-gravatar-insert
+            (list header address category))))))))
 
 (defun gnus-gravatar-insert (gravatar header address category)
   "Insert GRAVATAR for ADDRESS in HEADER in current article buffer.
@@ -76,7 +89,7 @@ Set image category to CATEGORY."
                      (search-backward mail-address nil t)))
           (goto-char (1- (point)))
           ;; If we're on the " quoting the name, go backward
-          (when (looking-at "\"")
+          (when (looking-at "[\"<]")
             (goto-char (1- (point))))
           ;; Do not do anything if there's already a gravatar. This can
           ;; happens if the buffer has been regenerated in the mean time, for
@@ -84,10 +97,9 @@ Set image category to CATEGORY."
           ;; another mail with the same someaddress.
           (unless (memq 'gnus-gravatar (text-properties-at (point)))
             (let ((inhibit-read-only t)
-                  (point (point))
-                  (gravatar (append
-                             gravatar
-                             gnus-gravatar-properties)))
+                  (point (point)))
+             (unless (featurep 'xemacs)
+               (setq gravatar (append gravatar gnus-gravatar-properties)))
               (gnus-put-image gravatar nil category)
               (put-text-property point (point) 'gnus-gravatar address)
               (gnus-add-wash-type category)