diff options
author | Dan Winship <danw@src.gnome.org> | 2000-06-16 06:19:44 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-06-16 06:19:44 +0800 |
commit | cd157eecb933748212bf87b41dcf5fa863e75fd5 (patch) | |
tree | 29dc32794de0449c4a7e5fb544150e57ea4183bb /camel/providers/imap | |
parent | e1de51e60e715983d1063810ac0cbfd80f99cc2c (diff) | |
download | gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.gz gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.zst gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.zip |
Kill. Folders are now always open, and handle "closing" sorts of
* camel-folder.c: (camel_folder_open, camel_folder_is_open,
camel_folder_get_mode): Kill. Folders are now always open, and
handle "closing" sorts of operations at sync or finalize time.
(camel_folder_sync): renamed from camel_folder_close. Syncs state
to the store but doesn't necessarily close/disconnect.
* providers/*/camel-*-folder.c: Merge "open" methods into "init"
methods. Rename close to sync and update appropriately.
* providers/imap/camel-imap-store.c: Remove camel_imap_store_open
and camel_imap_store_close, which should not have been copied from
the POP provider (where the exist to work around limitations of
the POP protocol).
svn path=/trunk/; revision=3581
Diffstat (limited to 'camel/providers/imap')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 56 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 22 |
2 files changed, 17 insertions, 61 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 37e4b06d9c..860a8aed99 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -60,8 +60,7 @@ static void imap_init (CamelFolder *folder, CamelStore *parent_store, gchar *separator, gboolean path_begns_with_sep, CamelException *ex); -static void imap_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex); -static void imap_close (CamelFolder *folder, gboolean expunge, CamelException *ex); +static void imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex); #if 0 static gboolean imap_exists (CamelFolder *folder, CamelException *ex); static gboolean imap_delete (CamelFolder *folder, gboolean recurse, CamelException *ex); @@ -106,8 +105,7 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class) /* virtual method overload */ camel_folder_class->init = imap_init; - camel_folder_class->open = imap_open; - camel_folder_class->close = imap_close; + camel_folder_class->sync = imap_sync; #if 0 camel_folder_class->exists = imap_exists; camel_folder_class->create = imap_create; @@ -158,7 +156,7 @@ camel_imap_folder_get_type (void) sizeof (CamelImapFolder), sizeof (CamelImapFolderClass), (GtkClassInitFunc) camel_imap_folder_class_init, - (GtkObjectInitFunc) NULL, + (GtkObjectInitFunc) camel_imap_folder_init, /* reserved_1 */ NULL, /* reserved_2 */ NULL, (GtkClassInitFunc) NULL, @@ -191,6 +189,8 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo const gchar *name, gchar *separator, gboolean path_begins_with_sep, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + int status; + char *result; /* call parent method */ parent_class->init (folder, parent_store, parent_folder, name, separator, path_begins_with_sep, ex); @@ -218,47 +218,25 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo imap_folder->summary = NULL; imap_folder->search = NULL; -} - -static void -imap_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex) -{ - gchar *result; - gint status; - - camel_imap_store_open (CAMEL_IMAP_STORE (folder->parent_store), ex); - if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_NONE) { - /* do we actually want to do this? probably not */ - parent_class->open (folder, mode, ex); - - /* SELECT the IMAP mail spool */ - status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder, - &result, "SELECT %s", folder->full_name); - - if (status != CAMEL_IMAP_OK) { - CamelService *service = CAMEL_SERVICE (folder->parent_store); - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - "Could not SELECT %s on IMAP server %s: %s.", - folder->full_name, - service->url->host, - status == CAMEL_IMAP_ERR ? result : - "Unknown error"); - g_free (result); - return; - } - g_free(result); + /* SELECT the IMAP mail spool */ + status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder, + &result, "SELECT %s", folder->full_name); + if (status != CAMEL_IMAP_OK) { + CamelService *service = CAMEL_SERVICE (folder->parent_store); + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + "Could not SELECT %s on IMAP server %s: %s.", + folder->full_name, service->url->host, + status == CAMEL_IMAP_ERR ? result : + "Unknown error"); } + g_free(result); } static void -imap_close (CamelFolder *folder, gboolean expunge, CamelException *ex) +imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) { /* TODO: actually code this method */ - camel_imap_store_close (CAMEL_IMAP_STORE (folder->parent_store), expunge, ex); - if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_NONE) - parent_class->close (folder, expunge, ex); - } static void diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 65290336c4..a02ff639d0 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -584,25 +584,3 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** return status; } - -void -camel_imap_store_open (CamelImapStore *store, CamelException *ex) -{ - CamelService *service = CAMEL_SERVICE (store); - - if (!camel_service_is_connected (service)) - imap_connect (service, ex); -} - -void -camel_imap_store_close (CamelImapStore *store, gboolean expunge, CamelException *ex) -{ - /* - if (expunge) - camel_imap_command (store, NULL, "QUIT"); - else - camel_imap_command (store, NULL, "RSET"); - */ - - imap_disconnect (CAMEL_SERVICE (store), ex); -} |