Commit f3b146e9 authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen Committed by Katsumi Yamaoka

Merge changes made in Gnus trunk.

gnus-html.el (gnus-html-schedule-image-fetching): Use url-queue-retrieve, if it exists.
shr.el (shr-tag-img): Ditto.
gnus.el: Autoload more gnus-agent functions.
gnus-art.el (gnus-request-article-this-buffer): Store articles in the agent if we haven't already (bug#8502).
gnus-async.el (gnus-async-article-callback): Put prefetched articles into the Agent, too.
gnus-agent.el (gnus-agent-store-article): New function.
parent 11aedcec
2011-05-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus-html.el (gnus-html-schedule-image-fetching): Use
url-queue-retrieve, if it exists.
* shr.el (shr-tag-img): Ditto.
* gnus.el: Autoload more gnus-agent functions.
* gnus-art.el (gnus-request-article-this-buffer): Store articles in the
agent if we haven't already (bug#8502).
* gnus-async.el (gnus-async-article-callback): Put prefetched articles
into the Agent, too.
* gnus-agent.el (gnus-agent-store-article): New function.
* nnheader.el (nnheader-insert-buffer-substring): Renamed from nntp-
and moved from that file for reuse.
......
......@@ -3876,6 +3876,15 @@ has been fetched."
(insert-file-contents file))
t))))
(defun gnus-agent-store-article (article group)
(let* ((gnus-command-method (gnus-find-method-for-group group))
(file (gnus-agent-article-name (number-to-string article) group))
(file-name-coding-system nnmail-pathname-coding-system)
(coding-system-for-write gnus-cache-coding-system))
(when (not (file-exists-p file))
(gnus-make-directory (file-name-directory file))
(write-region (point-min) (point-max) file nil 'silent))))
(defun gnus-agent-regenerate-group (group &optional reread)
"Regenerate GROUP.
If REREAD is t, all articles in the .overview are marked as unread.
......
......@@ -6841,7 +6841,10 @@ If given a prefix, show the hidden text instead."
gnus-summary-buffer)
(when gnus-keep-backlog
(gnus-backlog-enter-article
group article (current-buffer))))
group article (current-buffer)))
(when (and gnus-agent
(gnus-agent-group-covered-p group))
(gnus-agent-store-article article group)))
(setq result 'article))
(methods
(setq gnus-override-method (pop methods)))
......
......@@ -237,6 +237,12 @@ that was fetched."
(save-excursion
(save-restriction
(narrow-to-region mark (point-max))
;; Put the articles into the agent, if they aren't already.
(when (and gnus-agent
(gnus-agent-group-covered-p group))
(save-restriction
(narrow-to-region mark (point-max))
(gnus-agent-store-article article group)))
;; Prefetch images for the groups that want that.
(when (fboundp 'gnus-html-prefetch-images)
(gnus-html-prefetch-images summary))
......
......@@ -386,16 +386,14 @@ Use ALT-TEXT for the image string."
"Retrieve IMAGE, and place it into BUFFER on arrival."
(gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, image %s"
buffer image)
(let ((args (list (car image)
'gnus-html-image-fetched
(list buffer image))))
(when (> (length (if (featurep 'xemacs)
(cdr (split-string (function-arglist 'url-retrieve)))
(help-function-arglist 'url-retrieve)))
4)
(setq args (nconc args (list t))))
(if (fboundp 'url-queue-retrieve)
(url-queue-retrieve (car image)
'gnus-html-image-fetched
(list buffer image) t)
(ignore-errors
(push (apply #'url-retrieve args) gnus-buffers))))
(url-retrieve (car image)
'gnus-html-image-fetched
(list buffer image)))))
(defun gnus-html-image-fetched (status buffer image)
"Callback function called when image has been fetched."
......
......@@ -2910,7 +2910,8 @@ gnus-registry.el will populate this if it's loaded.")
gnus-agent-save-active gnus-agent-method-p
gnus-agent-get-undownloaded-list gnus-agent-fetch-session
gnus-summary-set-agent-mark gnus-agent-save-group-info
gnus-agent-request-article gnus-agent-retrieve-headers)
gnus-agent-request-article gnus-agent-retrieve-headers
gnus-agent-store-article gnus-agent-group-covered-p)
("gnus-agent" :interactive t
gnus-unplugged gnus-agentize gnus-agent-batch)
("gnus-vm" :interactive t gnus-summary-save-in-vm
......
......@@ -871,10 +871,13 @@ ones, in case fg and bg are nil."
(shr-put-image (shr-get-image-data url) alt))
(t
(insert alt)
(ignore-errors
(url-retrieve (shr-encode-url url) 'shr-image-fetched
(list (current-buffer) start (point-marker))
t))))
(funcall
(if (fboundp 'url-queue-retrieve)
'url-queue-retrieve
'url-retrieve)
(shr-encode-url url) 'shr-image-fetched
(list (current-buffer) start (point-marker))
t)))
(put-text-property start (point) 'keymap shr-map)
(put-text-property start (point) 'shr-alt alt)
(put-text-property start (point) 'image-url url)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment