From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/47674 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: double download of attachments? Date: Sat, 16 Nov 2002 14:10:36 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1037452254 18868 80.91.224.249 (16 Nov 2002 13:10:54 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 16 Nov 2002 13:10:54 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18D2iq-0004uA-00 for ; Sat, 16 Nov 2002 14:10:53 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18D2jA-0000vD-00; Sat, 16 Nov 2002 07:11:12 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sat, 16 Nov 2002 07:11:58 -0600 (CST) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id HAA19669 for ; Sat, 16 Nov 2002 07:11:40 -0600 (CST) Original-Received: (qmail 14986 invoked by alias); 16 Nov 2002 13:10:48 -0000 Original-Received: (qmail 14981 invoked from network); 16 Nov 2002 13:10:46 -0000 Original-Received: from 178.230.13.217.in-addr.dgcsystems.net (HELO yxa.extundo.com) (217.13.230.178) by gnus.org with SMTP; 16 Nov 2002 13:10:46 -0000 Original-Received: from latte.josefsson.org (yxa.extundo.com [217.13.230.178]) (authenticated bits=0) by yxa.extundo.com (8.12.6/8.12.6) with ESMTP id gAGDAfFu004455 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sat, 16 Nov 2002 14:10:42 +0100 Original-To: ding@gnus.org Mail-Copies-To: nobody X-Hashcash: 0:021116:ding@gnus.org:7d3d8a647c1ef958 In-Reply-To: (Danny Siu's message of "Sat, 16 Nov 2002 20:34:39 +0800") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:47674 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:47674 Danny Siu writes: > Simon Josefsson writes: > > Simon> Do you use asynchronous prefetching? `gnus-asynchronous'. > > yes. does disabling asynchronous fetching help? Yes. I believe this was a nnimap bug which should be fixed in CVS now. Did anyone ever see this bug in nntp groups too? 2002-11-16 Simon Josefsson * nnimap.el (nnimap-callback-callback-function): (nnimap-callback-buffer): Removed, these cannot be global but must be embedded into the callback. (nnimap-make-callback): New. Embedd article number, callback and buffer in function. (nnimap-callback, nnimap-request-article-part): Update. --- nnimap.el.~6.52~ 2002-10-27 11:47:24.000000000 +0100 +++ nnimap.el 2002-11-16 14:01:48.000000000 +0100 @@ -392,10 +392,6 @@ (defvar nnimap-progress-chars '(?| ?/ ?- ?\\)) (defvar nnimap-progress-how-often 20) (defvar nnimap-counter) -(defvar nnimap-callback-callback-function nil - "Gnus callback the nnimap asynchronous callback should call.") -(defvar nnimap-callback-buffer nil - "Which buffer the asynchronous article prefetch callback should work in.") (defvar nnimap-server-buffer-alist nil) ;; Map server name to buffers. (defvar nnimap-current-server nil) ;; Current server (defvar nnimap-server-buffer nil) ;; Current servers' buffer @@ -784,19 +780,26 @@ 'identity) (or string ""))) -(defun nnimap-callback () - (remove-hook 'imap-fetch-data-hook 'nnimap-callback) - (with-current-buffer nnimap-callback-buffer +(defun nnimap-make-callback (article gnus-callback buffer) + "Return a callback function." + `(lambda () + (nnimap-callback ,article ,gnus-callback ,buffer))) + +(defun nnimap-callback (article gnus-callback buffer) + (when (eq article (imap-current-message)) + (remove-hook 'imap-fetch-data-hook + (nnimap-make-callback article gnus-callback buffer)) + (with-current-buffer buffer (insert (with-current-buffer nnimap-server-buffer (nnimap-demule (if (imap-capability 'IMAP4rev1) ;; xxx don't just use car? alist doesn't contain ;; anything else now, but it might... - (nth 2 (car (imap-message-get (imap-current-message) 'BODYDETAIL))) - (imap-message-get (imap-current-message) 'RFC822))))) + (nth 2 (car (imap-message-get article 'BODYDETAIL))) + (imap-message-get article 'RFC822))))) (nnheader-ms-strip-cr) - (funcall nnimap-callback-callback-function t))) + (funcall gnus-callback t)))) (defun nnimap-request-article-part (article part prop &optional group server to-buffer detail) @@ -828,9 +831,10 @@ gnus-newsgroup-name) (imap-error-text nnimap-server-buffer)) (cons group article))) - (add-hook 'imap-fetch-data-hook 'nnimap-callback) - (setq nnimap-callback-callback-function nnheader-callback-function - nnimap-callback-buffer nntp-server-buffer) + (add-hook 'imap-fetch-data-hook + (nnimap-make-callback article + nnheader-callback-function + nntp-server-buffer)) (imap-fetch-asynch article part nil nnimap-server-buffer) (cons group article))))))