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/providers/imap/camel-imap-folder.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'camel/providers/imap/camel-imap-folder.c') 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; -- cgit v1.2.3