+2010-09-28 Julien Danjou <julien@danjou.info>
+
+ * gnus-gravatar.el (gnus-gravatar-insert): Fix search in case
+ mail-address contains the same string as real-name.
+
+ * gnus-ems.el (gnus-put-image): Revert Lars, change and insert
+ non-blank in header, otherwise it'll get stripped.
+
+ * gnus-gravatar.el (gnus-gravatar-insert): Search backward for
+ real-name, and then for mail address rather than doing : or , search.
+
2010-09-28 Katsumi Yamaoka <yamaoka@jpl.org>
* nnimap.el (auth-source-forget-user-or-password)
(gravatar-retrieve
(car address)
'gnus-gravatar-insert
- (list header (car address) category)))))))
+ (list header address category)))))))
(defun gnus-gravatar-insert (gravatar header address category)
"Insert GRAVATAR for ADDRESS in HEADER in current article buffer.
(gnus-with-article-headers
(gnus-article-goto-header header)
(mail-header-narrow-to-field)
- (when (and (search-forward address nil t)
- (or (search-backward ", " nil t)
- (search-backward ": " nil t)))
- (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
- ;; example we were fetching someaddress, and then we change to
- ;; another mail with the same someaddress.
- (unless (memq 'gnus-gravatar (text-properties-at (point)))
- (let ((inhibit-read-only t)
- (point (point))
- (gravatar (append
- gravatar
- `(:ascent center :relief ,gnus-gravatar-relief))))
- (gnus-put-image gravatar nil category)
- (put-text-property point (point) 'gnus-gravatar address)
- (gnus-add-wash-type category)
- (gnus-add-image category gravatar)))))))
+ (let ((real-name (cdr address))
+ (mail-address (car address)))
+ (when (if real-name ; have a realname, go for it!
+ (and (search-forward real-name nil t)
+ (search-backward real-name nil t))
+ (and (search-forward mail-address nil t)
+ (search-backward mail-address nil t)))
+ (goto-char (1- (point)))
+ ;; If we're on the " quoting the name, go backward
+ (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
+ ;; example we were fetching someaddress, and then we change to
+ ;; another mail with the same someaddress.
+ (unless (memq 'gnus-gravatar (text-properties-at (point)))
+ (let ((inhibit-read-only t)
+ (point (point))
+ (gravatar (append
+ gravatar
+ `(:ascent center :relief ,gnus-gravatar-relief))))
+ (gnus-put-image gravatar nil category)
+ (put-text-property point (point) 'gnus-gravatar address)
+ (gnus-add-wash-type category)
+ (gnus-add-image category gravatar))))))))
;;;###autoload
(defun gnus-treat-from-gravatar ()