From fe09d1e6a6f00ee603d678a10673e2c50986e14e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 17 Jan 2004 15:26:52 +0000 Subject: Limit the flags we set (or unset) to the folder's permanent flags. 2004-01-17 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_sync_online): Limit the flags we set (or unset) to the folder's permanent flags. svn path=/trunk/; revision=24289 --- camel/ChangeLog | 5 +++++ camel/providers/imap/camel-imap-folder.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index a7e46a90bb..fc8ccb678b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2004-01-17 Jeffrey Stedfast + + * providers/imap/camel-imap-folder.c (imap_sync_online): Limit the + flags we set (or unset) to the folder's permanent flags. + 2004-01-16 Jeffrey Stedfast * camel-mime-message.c (camel_mime_message_build_mbox_from): Same. diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 8bd6375d39..0347f2a53a 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -769,9 +769,9 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) */ max = camel_folder_summary_count (folder->summary); for (i = 0; i < max; i++) { - info = camel_folder_summary_index (folder->summary, i); - if (!info) + if (!(info = camel_folder_summary_index (folder->summary, i))) continue; + if (!(info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) { camel_folder_summary_info_free (folder->summary, info); continue; @@ -780,23 +780,23 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) /* Note: Cyrus is broken and will not accept an empty-set of flags so... if this is true then we want to unset the previously set flags.*/ - unset = !(info->flags & CAMEL_IMAP_SERVER_FLAGS); - + unset = !(info->flags & folder->permanent_flags); + /* Note: get_matching() uses UID_SET_LIMIT to limit the size of the uid-set string. We don't have to loop here to flush all the matching uids because they will be scooped up later by our parent loop (I think?). -- Jeff */ - matches = get_matching (folder, info->flags & (CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED), - CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED, &set); + matches = get_matching (folder, info->flags & (folder->permanent_flags | CAMEL_MESSAGE_FOLDER_FLAGGED), + folder->permanent_flags | CAMEL_MESSAGE_FOLDER_FLAGGED, &set); camel_folder_summary_info_free (folder->summary, info); if (matches == NULL) continue; /* FIXME: since we don't know the previously set flags, if unset is TRUE then just unset all the flags? */ - flaglist = imap_create_flag_list (unset ? CAMEL_IMAP_SERVER_FLAGS : info->flags); - + flaglist = imap_create_flag_list (unset ? folder->permanent_flags : info->flags & folder->permanent_flags); + /* Note: to `unset' flags, use -FLAGS.SILENT () */ response = camel_imap_command (store, folder, &local_ex, "UID STORE %s %sFLAGS.SILENT %s", @@ -811,7 +811,7 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) for (j = 0; j < matches->len; j++) { info = matches->pdata[j]; info->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED; - ((CamelImapMessageInfo*)info)->server_flags = + ((CamelImapMessageInfo *) info)->server_flags = info->flags & CAMEL_IMAP_SERVER_FLAGS; } camel_folder_summary_touch (folder->summary); -- cgit v1.2.3