commit 5075a24cf228521983cde22154b445660621a8de
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sun Dec 29 12:34:36 2019 +0100

    set sync record's flags only after propagating new message
    
    this is semantically cleaner, and fixes storing the flags in the rare
    case that flags are not being synced and the target is not being
    expunged, as in this case flags are queried only during the actual
    propagation.

 src/sync.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 5aca960..7a8ae69 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1619,11 +1619,6 @@ box_loaded( int sts, message_t *msgs, int total_msgs, 
int recent_msgs, void *aux
                                                debug( "  -> pair(%u,%u) 
created\n", srec->uid[M], srec->uid[S] );
                                        }
                                        if ((tmsg->flags & F_FLAGGED) || 
tmsg->size <= svars->chan->stores[t]->max_size) {
-                                               if (tmsg->flags != srec->flags) 
{
-                                                       srec->flags = 
tmsg->flags;
-                                                       jFprintf( svars, "* %u 
%u %u\n", srec->uid[M], srec->uid[S], srec->flags );
-                                                       debug( "  -> updated 
flags to %u\n", tmsg->flags );
-                                               }
                                                if (srec->status != S_PENDING) {
                                                        debug( "  -> not too 
big any more\n" );
                                                        srec->status = 
S_PENDING;
@@ -1849,6 +1844,11 @@ msg_copied( int sts, uint uid, copy_vars_t *vars )
        sync_rec_t *srec = vars->srec;
        switch (sts) {
        case SYNC_OK:
+               if (vars->msg->flags != srec->flags) {
+                       srec->flags = vars->msg->flags;
+                       debug( "  -> updated flags to %u\n", srec->flags );
+                       jFprintf( svars, "* %u %u %u\n", srec->uid[M], 
srec->uid[S], srec->flags );
+               }
                if (!uid) {  // Stored to a non-UIDPLUS mailbox
                        svars->state[t] |= ST_FIND_NEW;
                } else {


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to