From 765e7194f1459f226b91ffc027024553e2d1a64b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 18 Apr 2001 17:59:56 +0000 Subject: Free base_url and storage_path. * providers/imap/camel-imap-store.c (camel_imap_store_finalize): Free base_url and storage_path. * providers/pop3/camel-pop3-store.c (finalize): Free the implementation string. (camel_pop3_command): Clarify documentation to mention that @ex isn't set (and *@ret is) on CAMEL_POP3_ERR. (connect_to_server): Set @ex properly on CAMEL_POP3_ERR. * providers/pop3/camel-pop3-folder.c (pop3_refresh_info, pop3_get_message): Set @ex properly on CAMEL_POP3_ERR. svn path=/trunk/; revision=9450 --- camel/providers/imap/camel-imap-store.c | 4 ++++ camel/providers/pop3/camel-pop3-folder.c | 19 ++++++++++++++++--- camel/providers/pop3/camel-pop3-store.c | 15 +++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index d7aec42f2c..37eb99623c 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -143,6 +143,10 @@ camel_imap_store_finalize (CamelObject *object) } if (imap_store->namespace) g_free (imap_store->namespace); + if (imap_store->base_url) + g_free (imap_store->base_url); + if (imap_store->storage_path) + g_free (imap_store->storage_path); if (imap_store->current_folder) camel_object_unref (CAMEL_OBJECT (imap_store->current_folder)); #ifdef ENABLE_THREADS diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index 96b5471828..4d5c066491 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -149,7 +149,14 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex) camel_operation_start(NULL, _("Retrieving POP summary")); status = camel_pop3_command (pop3_store, &data, ex, "STAT"); - if (status != CAMEL_POP3_OK) { + switch (status) { + case CAMEL_POP3_ERR: + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + _("Could not check POP server for new messages: %s"), + data); + g_free (data); + /* fall through */ + case CAMEL_POP3_FAIL: camel_operation_end(NULL); return; } @@ -290,12 +297,18 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex) status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store), &result, ex, "RETR %d", num); - if (status != CAMEL_POP3_OK) { + switch (status) { + case CAMEL_POP3_ERR: + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + _("Could not fetch message: %s"), result); + g_free (result); + /* fall through */ + case CAMEL_POP3_FAIL: camel_operation_end(NULL); return NULL; } - /* this should be "nnn octets" ? */ + /* this should be "nnn octets" ? No. RTFRFC. FIXME. */ if (result && sscanf (result, "%d", &total) != 1) total = 0; diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index c1cb5e1060..c163e844c9 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -143,6 +143,8 @@ finalize (CamelObject *object) if (pop3_store->apop_timestamp) g_free (pop3_store->apop_timestamp); + if (pop3_store->implementation) + g_free (pop3_store->implementation); } static gboolean @@ -217,8 +219,16 @@ connect_to_server (CamelService *service, CamelException *ex) /* Read the greeting, check status */ status = pop3_get_response (store, &buf, ex); - if (status != CAMEL_POP3_OK) + switch (status) { + case CAMEL_POP3_ERR: + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + _("Could not connect to server: %s"), + buf); + g_free (buf); + /* fall through */ + case CAMEL_POP3_FAIL: return FALSE; + } if (buf) { apoptime = strchr (buf, '<'); @@ -519,7 +529,8 @@ get_trash (CamelStore *store, CamelException *ex) * Return value: one of CAMEL_POP3_OK (command executed successfully), * CAMEL_POP3_ERR (command encounted an error), or CAMEL_POP3_FAIL * (a protocol-level error occurred, and Camel is uncertain of the - * result of the command.) + * result of the command.) @ex will be set if the return value is + * CAMEL_POP3_FAIL, but *NOT* if it is CAMEL_POP3_ERR. **/ int camel_pop3_command (CamelPop3Store *store, char **ret, CamelException *ex, char *fmt, ...) -- cgit v1.2.3