Gnus development mailing list
 help / color / mirror / Atom feed
From: Simon Josefsson <jas@extundo.com>
Subject: Re: double download of attachments?
Date: Sat, 16 Nov 2002 14:10:36 +0100	[thread overview]
Message-ID: <iluwundd5ir.fsf@latte.josefsson.org> (raw)
In-Reply-To: <u7kfdhew0.fsf@adobe.com> (Danny Siu's message of "Sat, 16 Nov 2002 20:34:39 +0800")

Danny Siu <dsiu@adobe.com> 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  <jas@extundo.com>

	* 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))))))
 




  reply	other threads:[~2002-11-16 13:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-12 14:42 Wes Hardaker
2002-11-13  9:15 ` Simon Josefsson
2002-11-13 17:41   ` Wes Hardaker
2002-11-14  7:24     ` Simon Josefsson
2002-11-14  8:05       ` Niklas Morberg
2002-11-14 10:54         ` Simon Josefsson
2002-11-14 15:01       ` Wes Hardaker
2002-11-15 15:30         ` Simon Josefsson
2002-11-15 16:42           ` dme
2002-11-16 12:23             ` Simon Josefsson
2002-11-16  9:57           ` Danny Siu
2002-11-16 11:52             ` Simon Josefsson
2002-11-16 12:34               ` Danny Siu
2002-11-16 13:10                 ` Simon Josefsson [this message]
2002-12-28 21:25       ` Lars Magne Ingebrigtsen
2003-01-06 15:55         ` Wes Hardaker
2003-01-06 16:19           ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iluwundd5ir.fsf@latte.josefsson.org \
    --to=jas@extundo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).