reverted previous commit since it broke string freeze
authorJeffrey Stedfast <fejj@src.gnome.org>
Thu, 31 Mar 2005 19:57:43 +0000 (19:57 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Thu, 31 Mar 2005 19:57:43 +0000 (19:57 +0000)
camel/providers/imap4/ChangeLog
camel/providers/imap4/camel-imap4-engine.c
camel/providers/imap4/camel-imap4-folder.c
camel/providers/imap4/camel-imap4-folder.h

index 2bfcf97..9981f8d 100644 (file)
@@ -1,18 +1,3 @@
-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 0c16013..9599b3c 100644 (file)
@@ -401,10 +401,10 @@ camel_imap4_engine_select_folder (CamelIMAP4Engine *engine, CamelFolder *folder,
                                folder->permanent_flags = resp->v.flags;
                                break;
                        case CAMEL_IMAP4_RESP_CODE_READONLY:
-                               ((CamelIMAP4Folder *) folder)->read_only = TRUE;
+                               /*folder->mode = CAMEL_FOLDER_MODE_READ_ONLY;*/
                                break;
                        case CAMEL_IMAP4_RESP_CODE_READWRITE:
-                               ((CamelIMAP4Folder *) folder)->read_only = FALSE;
+                               /*folder->mode = CAMEL_FOLDER_MODE_READ_WRITE;*/
                                break;
                        case CAMEL_IMAP4_RESP_CODE_UIDNEXT:
                                camel_imap4_summary_set_uidnext (folder->summary, resp->v.uidnext);
index b6a3ee8..9155980 100644 (file)
@@ -485,6 +485,9 @@ imap4_sync_changes (CamelFolder *folder, GPtrArray *sync, CamelException *ex)
        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 ();
        
@@ -554,41 +557,39 @@ imap4_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
        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)
                        ;
@@ -908,13 +909,6 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message,
        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;
index ac0da34..0edbd8d 100644 (file)
@@ -64,7 +64,6 @@ struct _CamelIMAP4Folder {
        char *cachedir;
        char *utf7_name;
        
-       unsigned int read_only:1;
        unsigned int enable_mlist:1;
 };