]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Delete IMAP messages in reverse order, to ensure reordering after each expunge does...
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 20 Jul 2010 22:23:13 +0000 (22:23 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 20 Jul 2010 22:23:13 +0000 (22:23 +0000)
(closes issue #16350)
 Reported by: noahisaac
 Patches:
       20100623__issue16350.diff.txt uploaded by tilghman (license 14)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@278261 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 4fd805fc7e8829a88c82ffa05f96e0efc9bea0e9..a02ac78bf4ea0bc48437b870c7181651b66fe687 100644 (file)
@@ -5955,12 +5955,15 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
                        DELETE(vms->curdir, x, vms->fn, vmu);
        }
        ast_unlock_path(vms->curdir);
-#else
+#else /* defined(IMAP_STORAGE) */
        if (vms->deleted) {
-               for (x=0;x < vmu->maxmsg;x++) { 
-                       if (vms->deleted[x]) { 
-                               if (option_debug > 2)
-                                       ast_log(LOG_DEBUG,"IMAP delete of %d\n",x);
+               /* Since we now expunge after each delete, deleting in reverse order
+                * ensures that no reordering occurs between each step. */
+               for (x = vmu->maxmsg - 1; x >= 0; x--) {
+                       if (vms->deleted[x]) {
+                               if (option_debug > 2) {
+                                       ast_log(LOG_DEBUG, "IMAP delete of %d\n", x);
+                               }
                                DELETE(vms->curdir, x, vms->fn, vmu);
                        }
                }