Fix two bugs associated with expunging of messages. This now seems to
authorChris Hanson <org/chris-hanson/cph>
Wed, 17 May 2000 13:33:04 +0000 (13:33 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 17 May 2000 13:33:04 +0000 (13:33 +0000)
work right.

v7/src/imail/imail-imap.scm

index 67b59bab55eab4d88d4d817c3c980255dbdb8884..3168f98b670dd1d5aa84ea9161c1912ba43512ff 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-imap.scm,v 1.47 2000/05/16 22:07:38 cph Exp $
+;;; $Id: imail-imap.scm,v 1.48 2000/05/17 13:33:04 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
                                (vector-grow v new-length #f))))
                         (set-imap-folder-n-messages! folder count)
                         (fill-messages-vector! folder n)
+                        (set-imap-folder-messages-synchronized?! folder #t)
                         (folder-modified! folder)
                         n)
                        ((< count n)
                         (error "EXISTS response decreased folder length:"
                                folder))
-                       (else #f)))))))
+                       (else
+                        (if (not (imap-folder-messages-synchronized? folder))
+                            (begin
+                              (set-imap-folder-messages-synchronized?!
+                               folder #t)
+                              (folder-modified! folder)))
+                        #f)))))))
        (if n
            (read-message-headers! folder n)))
       (let ((v.n
                           (attach-message! m folder i*)
                           (vector-set! v* i* m)
                           (loop (fix:+ i 1) (fix:+ i* 1)))
-                        (loop (fix:+ i 1) i*))))))
+                        (begin
+                          (if (> (imap-message-uid m) (imap-message-uid m*))
+                              (error "Message inserted into folder:" m*))
+                          (loop (fix:+ i 1) i*)))))))
           (folder-modified! folder))))))
 \f
 ;;;; Message datatype
         #f)
        ((imap:response:expunge? response)
         (let ((folder (imap-connection-folder connection)))
-          (remove-imap-folder-message folder
-                                      (imap:response:expunge-index response))
+          (remove-imap-folder-message
+           folder
+           (- (imap:response:expunge-index response) 1))
           (folder-modified! folder))
         #f)
        ((imap:response:flags? response)