doh, lets try this again On Tue, 2005-03-29 at 10:22 +0800, Not Zed wrote: > > its still only in your repository by the looks! > > On Wed, 2005-03-23 at 16:19 -0500, Jeffrey Stedfast wrote: > > patch has been sitting in my repository for a bit looks like, but I > > never seemed to have sent the patch out, so here it is. > > > > I think it mostly just optimises the READ-ONLY/empty-perm-flags cases, > > so can probably be a HEAD-only change if we want. > > > > Jeff > > -- Jeffrey Stedfast Evolution Hacker - Novell, Inc. fejj ximian com - www.novell.com
? imap4-XGWMOVE.patch ? imap4.patch ? read-only.patch Index: ChangeLog =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap4/ChangeLog,v retrieving revision 1.12 diff -u -r1.12 ChangeLog --- ChangeLog 16 Feb 2005 19:45:50 -0000 1.12 +++ ChangeLog 23 Mar 2005 21:19:28 -0000 @@ -1,3 +1,18 @@ +2005-03-11 Jeffrey Stedfast <fejj novell com> + + * camel-imap4-folder.c (imap4_sync): Don't try to EXPUNGE in + READ-ONLY mode. + (imap4_sync_changes): Don't check permanent_flags here. + (imap4_sync): Check permanent_flags here instead and don't bother + wasting cycles if permanent_flags is empty. + (imap4_sync): Don't attempt to EXPUNGE if the folder is READ-ONLY. + (imap4_append_message): Set an exception if the folder is + read-only and don't bother trying to append. + + * camel-imap4-engine.c (camel_imap4_engine_select_folder): Set the + READ-ONLY bit on the folder if the server says we've opened it in + READ-ONLY mode. + 2005-02-03 Jeffrey Stedfast <fejj novell com> * camel-imap4-engine.c (camel_imap4_engine_handle_untagged_1): Index: camel-imap4-engine.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap4/camel-imap4-engine.c,v retrieving revision 1.22 diff -u -r1.22 camel-imap4-engine.c --- camel-imap4-engine.c 16 Feb 2005 19:45:50 -0000 1.22 +++ camel-imap4-engine.c 23 Mar 2005 21:19:29 -0000 @@ -401,10 +401,10 @@ folder->permanent_flags = resp->v.flags; break; case CAMEL_IMAP4_RESP_CODE_READONLY: - /*folder->mode = CAMEL_FOLDER_MODE_READ_ONLY;*/ + ((CamelIMAP4Folder *) folder)->read_only = TRUE; break; case CAMEL_IMAP4_RESP_CODE_READWRITE: - /*folder->mode = CAMEL_FOLDER_MODE_READ_WRITE;*/ + ((CamelIMAP4Folder *) folder)->read_only = FALSE; break; case CAMEL_IMAP4_RESP_CODE_UIDNEXT: camel_imap4_summary_set_uidnext (folder->summary, resp->v.uidnext); Index: camel-imap4-folder.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap4/camel-imap4-folder.c,v retrieving revision 1.40 diff -u -r1.40 camel-imap4-folder.c --- camel-imap4-folder.c 16 Feb 2005 19:45:50 -0000 1.40 +++ camel-imap4-folder.c 23 Mar 2005 21:19:29 -0000 @@ -485,9 +485,6 @@ int retval = 0; int i, j; - if (folder->permanent_flags == 0) - return 0; - on_set = g_ptr_array_new (); off_set = g_ptr_array_new (); @@ -557,39 +554,41 @@ CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock); /* gather a list of changes to sync to the server */ - sync = g_ptr_array_new (); - max = camel_folder_summary_count (folder->summary); - for (i = 0; i < max; i++) { - iinfo = (CamelIMAP4MessageInfo *) (info = camel_folder_summary_index (folder->summary, i)); - if (iinfo->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) { - camel_imap4_flags_diff (&diff, iinfo->server_flags, iinfo->info.flags); - diff.changed &= folder->permanent_flags; - - /* weed out flag changes that we can't sync to the server */ - if (!diff.changed) + if (folder->permanent_flags) { + sync = g_ptr_array_new (); + max = camel_folder_summary_count (folder->summary); + for (i = 0; i < max; i++) { + iinfo = (CamelIMAP4MessageInfo *) (info = camel_folder_summary_index (folder->summary, i)); + if (iinfo->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) { + camel_imap4_flags_diff (&diff, iinfo->server_flags, iinfo->info.flags); + diff.changed &= folder->permanent_flags; + + /* weed out flag changes that we can't sync to the server */ + if (!diff.changed) + camel_message_info_free(info); + else + g_ptr_array_add (sync, info); + } else { camel_message_info_free(info); - else - g_ptr_array_add (sync, info); - } else { - camel_message_info_free(info); + } } - } - - if (sync->len > 0) { - retval = imap4_sync_changes (folder, sync, ex); - - for (i = 0; i < sync->len; i++) - camel_message_info_free(sync->pdata[i]); - - g_ptr_array_free (sync, TRUE); - if (retval == -1) - goto done; - } else { - g_ptr_array_free (sync, TRUE); + if (sync->len > 0) { + retval = imap4_sync_changes (folder, sync, ex); + + for (i = 0; i < sync->len; i++) + camel_message_info_free(sync->pdata[i]); + + g_ptr_array_free (sync, TRUE); + + if (retval == -1) + goto done; + } else { + g_ptr_array_free (sync, TRUE); + } } - if (expunge) { + if (expunge && !((CamelIMAP4Folder *) folder)->read_only) { ic = camel_imap4_engine_queue (engine, folder, "EXPUNGE\r\n"); while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1) ; @@ -908,6 +907,13 @@ if (appended_uid) *appended_uid = NULL; + + if (((CamelIMAP4Folder *) folder)->read_only) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot append message to folder `%s': Folder is read-only"), + folder->full_name); + return; + } if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { camel_imap4_journal_append ((CamelIMAP4Journal *) imap4_folder->journal, message, info, appended_uid, ex); Index: camel-imap4-folder.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap4/camel-imap4-folder.h,v retrieving revision 1.8 diff -u -r1.8 camel-imap4-folder.h --- camel-imap4-folder.h 23 Jan 2005 17:14:21 -0000 1.8 +++ camel-imap4-folder.h 23 Mar 2005 21:19:29 -0000 @@ -64,6 +64,7 @@ char *cachedir; char *utf7_name; + unsigned int read_only:1; unsigned int enable_mlist:1; };
Attachment:
smime.p7s
Description: S/MIME cryptographic signature