From 7fdc703916b8d40398f16d205e953867015d2bac Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 14 Jan 2004 04:35:58 +0000 Subject: ** Patch from Timo Sirainen to honour read-only status for 2004-01-14 Not Zed ** Patch from Timo Sirainen to honour read-only status for imap folders. * providers/imap/camel-imap-folder.c (camel_imap_folder_selected): check for read-only status response. (imap_sync_online): only call sync_offline if we're read-only. (imap_expunge_uids_resyncing): NOOP for read-only. svn path=/trunk/; revision=24212 --- camel/ChangeLog | 10 ++++++++++ camel/providers/imap/camel-imap-folder.c | 14 +++++++++++++- camel/providers/imap/camel-imap-folder.h | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 6eaa791db5..e442a0afbe 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,13 @@ +2004-01-14 Not Zed + + ** Patch from Timo Sirainen to honour read-only + status for imap folders. + + * providers/imap/camel-imap-folder.c (camel_imap_folder_selected): + check for read-only status response. + (imap_sync_online): only call sync_offline if we're read-only. + (imap_expunge_uids_resyncing): NOOP for read-only. + 2004-01-14 Not Zed * providers/local/camel-local-folder.c (local_getv): remove debug diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 465e9949f4..8bd6375d39 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -307,7 +307,10 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response, } } } - + + if (camel_strstrcase (response->status, "OK [READ-ONLY]")) + imap_folder->read_only = TRUE; + if (camel_disco_store_status (CAMEL_DISCO_STORE (folder->parent_store)) == CAMEL_DISCO_STORE_RESYNCING) { if (validity != imap_summary->validity) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_SUMMARY_INVALID, @@ -752,6 +755,11 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) gboolean unset; int i, j, max; + if (((CamelImapFolder *)folder)->read_only) { + imap_sync_offline (folder, ex); + return; + } + camel_exception_init (&local_ex); CAMEL_SERVICE_LOCK (store, connect_lock); @@ -925,11 +933,15 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException * static void imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelException *ex) { + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); GPtrArray *keep_uids, *mark_uids; CamelImapResponse *response; char *result; + if (imap_folder->read_only) + return; + if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) { imap_expunge_uids_online (folder, uids, ex); return; diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h index 4cadebc65b..a2ab1dfd2c 100644 --- a/camel/providers/imap/camel-imap-folder.h +++ b/camel/providers/imap/camel-imap-folder.h @@ -52,6 +52,7 @@ struct _CamelImapFolder { unsigned int need_rescan:1; unsigned int need_refresh:1; + unsigned int read_only:1; }; typedef struct { -- cgit v1.2.3