-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):
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 ();
CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
/* gather a list of changes to sync to the server */
- 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);
- }
- }
-
- 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);
+ 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;
- if (retval == -1)
- goto done;
+ /* 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 {
- g_ptr_array_free (sync, TRUE);
+ camel_message_info_free(info);
}
}
- if (expunge && !((CamelIMAP4Folder *) folder)->read_only) {
+ 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) {
ic = camel_imap4_engine_queue (engine, folder, "EXPUNGE\r\n");
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
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);
return;