Fix bug: expunging of IMAP messages wasn't renumbering the remaining
authorChris Hanson <org/chris-hanson/cph>
Wed, 17 May 2000 16:23:29 +0000 (16:23 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 17 May 2000 16:23:29 +0000 (16:23 +0000)
messages.

v7/src/imail/imail-imap.scm

index d133cb7e3e025586680fcdacede4dc95407f4c5f..c28c9cbe902cc15fb8477e98fcf7d4013a78e2a9 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-imap.scm,v 1.49 2000/05/17 16:15:34 cph Exp $
+;;; $Id: imail-imap.scm,v 1.50 2000/05/17 16:23:29 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
   (without-interrupts
    (lambda ()
      (let ((v (imap-folder-messages folder))
-          (n (imap-folder-n-messages folder)))
+          (n (fix:- (imap-folder-n-messages folder) 1)))
        (detach-message! (vector-ref v index))
-       (subvector-move-left! v (fix:+ index 1) n v index)
-       (let ((n (fix:- n 1)))
-        (vector-set! v n #f)
-        (set-imap-folder-n-messages! folder n)
-        (let ((new-length (compute-messages-length v n)))
-          (if new-length
-              (set-imap-folder-messages! folder
-                                         (vector-head v new-length))))))))
+       (do ((i index (fix:+ i 1)))
+          ((fix:= i n))
+        (let ((m (vector-ref v (fix:+ i 1))))
+          (set-message-index! m i)
+          (vector-set! v i m)))
+       (vector-set! v n #f)
+       (set-imap-folder-n-messages! folder n)
+       (let ((new-length (compute-messages-length v n)))
+        (if new-length
+            (set-imap-folder-messages! folder
+                                       (vector-head v new-length)))))))
   (folder-modified! folder))
 
 (define (initial-messages)