Function: gnus-gravatar-insert
gnus-gravatar-insert is a byte-compiled function defined in
gnus-gravatar.el.gz.
Signature
(gnus-gravatar-insert GRAVATAR HEADER ADDRESS CATEGORY)
Documentation
Insert GRAVATAR for ADDRESS in HEADER in current article buffer.
Set image category to CATEGORY. This function is intended as a
callback for gravatar-retrieve.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-gravatar.el.gz
(defun gnus-gravatar-insert (gravatar header address category)
"Insert GRAVATAR for ADDRESS in HEADER in current article buffer.
Set image category to CATEGORY. This function is intended as a
callback for `gravatar-retrieve'."
(unless (eq gravatar 'error)
(gnus-with-article-buffer
;; The buffer can be gone at this time.
(when (buffer-live-p (current-buffer))
(let ((real-name (car address))
(mail-address (cadr address))
(mark (point-marker))
(case-fold-search t))
(save-restriction
(article-narrow-to-head)
(gnus-article-goto-header header)
(mail-header-narrow-to-field)
(when (if real-name
(re-search-forward
(concat (replace-regexp-in-string
"[\t ]+" "[\t\n ]+"
(regexp-quote real-name))
"\\|"
(regexp-quote mail-address))
nil t)
(search-forward mail-address nil t))
(goto-char (1- (match-beginning 0)))
;; If we're on the " quoting the name, go backward.
(when (looking-at-p "[\"<]")
(goto-char (1- (point))))
;; Do not do anything if there's already a gravatar.
;; This can happen 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 (get-text-property (1- (point)) 'gnus-gravatar)
(let ((pos (point)))
(setq gravatar (append gravatar gnus-gravatar-properties))
(gnus-put-image gravatar (buffer-substring pos (1+ pos))
category)
(put-text-property pos (point) 'gnus-gravatar address)
(gnus-add-wash-type category)
(gnus-add-image category gravatar)))))
(goto-char mark))))))