<<< Date Index >>>     <<< Thread Index >>>

[PATCH] sync-mailbox: Syncing an empty mailbox is no error



Hello,
the question popped up: Why the following macro[1] fails on an empty
mailbox.

[1] macro to access the folder browser:
        macro index i "<sync-mailbox><change-folder>?<toggle-mailboxes>"

The problem here is that sync-mailbox fails on empty mailboxes and abort
the macro.

You want that sync before the folder browser in - because syncing is
only done, if you enter a *new* folder and so closing the the current
implicit.  But when you browse that folder list you have outdated data
in the folder list until you synced it before.

Attached is a little patch to fix the issue - as usual against current
CVS head.

        Thomas
diff -Nru a/curs_main.c b/curs_main.c
--- a/curs_main.c       2004-07-24 12:27:19 +02:00
+++ b/curs_main.c       2004-12-02 23:03:02 +01:00
@@ -984,6 +984,10 @@
       
       case OP_MAIN_SYNC_FOLDER:
 
+       /* syncing an non empty mailbox isn't error */
+       if (Context && !Context->msgcount)
+         break;
+
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
        CHECK_READONLY;