Mercurial > emacs
diff lisp/gnus/gravatar.el @ 111994:c92e0a5c96e9
Merge changes made in Gnus trunk.
nnir.el (nnir-get-active): Ignore nnir-ignored-newsgroups if null.
gnus-sum.el (gnus-summary-refer-thread): Simplify code. Restore gnus-use-agent.
(gnus-get-newsgroup-headers): Avoid unwanted spaces at eol.
gravatar.el (gravatar-retrieve-synchronously): New function.
(gravatar-get-data): Make more robust.
gnus-util.el (gnus-rescale-image): Allow to resize images even if they are from file. Can also scale up.
nnimap.el (nnimap-retrieve-headers): Remove CRLF from the headers.
nnir.el (nnir-mode): Make sure 'gnus-registry-install is bound.
gnus-sum.el (gnus-get-newsgroup-headers): Revert the last change here, since it's up to the backends to do CRLF removal if their protocol has it.
gnus-group.el (gnus-group-delete-articles): New command.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Fri, 17 Dec 2010 22:45:16 +0000 |
parents | 0fe64d68a522 |
children | b1eac6d41a93 |
line wrap: on
line diff
--- a/lisp/gnus/gravatar.el Fri Dec 17 10:14:57 2010 -0500 +++ b/lisp/gnus/gravatar.el Fri Dec 17 22:45:16 2010 +0000 @@ -78,10 +78,11 @@ (defun gravatar-get-data () "Get data from current buffer." - (when (string-match "^HTTP/.+ 200 OK$" - (buffer-substring (point-min) (line-end-position))) - (when (search-forward "\n\n" nil t) - (buffer-substring (point) (point-max))))) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^HTTP/.+ 200 OK$" nil (line-end-position)) + (when (search-forward "\n\n" nil t) + (buffer-substring (point) (point-max)))))) (eval-and-compile (cond ((featurep 'xemacs) @@ -98,7 +99,7 @@ If no image available, return 'error." (let ((data (gravatar-get-data))) (if data - (gravatar-create-image data nil t) + (gravatar-create-image data nil t) 'error))) ;;;###autoload @@ -117,6 +118,23 @@ (gravatar-data->image)) cbargs)))) +;;;###autoload +(defun gravatar-retrieve-synchronously (mail-address) + "Retrieve MAIL-ADDRESS gravatar and returns it." + (let ((url (gravatar-build-url mail-address))) + (if (gravatar-cache-expired url) + (with-current-buffer (url-retrieve-synchronously url) + (when gravatar-automatic-caching + (url-store-in-cache (current-buffer))) + (let ((data (gravatar-data->image))) + (kill-buffer (current-buffer)) + data)) + (with-temp-buffer + (mm-disable-multibyte) + (url-cache-extract (url-cache-create-filename url)) + (gravatar-data->image))))) + + (defun gravatar-retrieved (status cb &optional cbargs) "Callback function used by `gravatar-retrieve'." ;; Store gravatar?