From 49f8a687a41e635cd83807d33c74afe8e55fb3df Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 8 Feb 2001 01:42:53 +0000 Subject: Changed to push the operation into a status stack. 2001-02-07 Not Zed * camel-operation.c (camel_operation_start): Changed to push the operation into a status stack. (camel_operation_progress): Changed to only accept % complete. (camel_operation_reset): Free status stack as well. * providers/pop3/camel-pop3-folder.c (pop3_get_message): Get the octect count from the return line, and pass it to get_additional_data(). (pop3_refresh_info): Added status stuff. * providers/pop3/camel-pop3-store.c (camel_pop3_command_get_additional_data): Added a total bytes expected argument for progress reporting & fixed callers. (camel_pop3_command_get_additional_data): Added progress reporting. * providers/local/camel-mbox-summary.c (mbox_summary_sync_full): (mbox_summary_sync_quick): (summary_rebuild): Added progress reporting stuff. svn path=/trunk/; revision=8095 --- camel/providers/pop3/camel-pop3-folder.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'camel/providers/pop3/camel-pop3-folder.c') diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index cf55a95661..810faed846 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -29,6 +29,7 @@ #include "camel-stream-mem.h" #include "camel-stream-filter.h" #include "camel-mime-message.h" +#include "camel-operation.h" #include #include @@ -141,9 +142,13 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex) CamelPop3Folder *pop3_folder = (CamelPop3Folder *) folder; CamelPop3Store *pop3_store = CAMEL_POP3_STORE (folder->parent_store); + camel_operation_start(NULL, _("Retrieving POP summary")); + status = camel_pop3_command (pop3_store, &data, ex, "STAT"); - if (status != CAMEL_POP3_OK) + if (status != CAMEL_POP3_OK) { + camel_operation_end(NULL); return; + } count = atoi (data); g_free (data); @@ -155,6 +160,7 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex) pop3_store->supports_uidl = FALSE; break; case CAMEL_POP3_FAIL: + camel_operation_end(NULL); return; } } @@ -167,8 +173,10 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex) for (i = 0; i < count; i++) uids->pdata[i] = g_strdup_printf ("%d", i + 1); + camel_operation_end(NULL); } else { - data = camel_pop3_command_get_additional_data (pop3_store, ex); + data = camel_pop3_command_get_additional_data (pop3_store, 0, ex); + camel_operation_end(NULL); if (camel_exception_is_set (ex)) return; @@ -263,7 +271,7 @@ uid_to_number (CamelPop3Folder *pop3_folder, const char *uid) static CamelMimeMessage * pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex) { - int status, num; + int status, num, total; char *result, *body; CamelStream *msgstream; CamelMimeMessage *msg; @@ -275,19 +283,28 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex) return NULL; } + camel_operation_start(NULL, _("Retrieving POP message %d"), num); + status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store), &result, ex, "RETR %d", num); - if (status != CAMEL_POP3_OK) + if (status != CAMEL_POP3_OK) { + camel_operation_end(NULL); return NULL; - g_free (result); + } + + /* this should be "nnn octets" ? */ + if (sscanf(result, "%d", &total) != 1) + total = 0; - body = camel_pop3_command_get_additional_data (CAMEL_POP3_STORE (folder->parent_store), ex); + g_free (result); + body = camel_pop3_command_get_additional_data (CAMEL_POP3_STORE (folder->parent_store), total, ex); if (!body) { CamelService *service = CAMEL_SERVICE (folder->parent_store); camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, _("Could not retrieve message from POP " "server %s: %s"), service->url->host, camel_exception_get_description (ex)); + camel_operation_end(NULL); return NULL; } @@ -300,6 +317,8 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex) camel_object_unref (CAMEL_OBJECT (msgstream)); + camel_operation_end(NULL); + return msg; } -- cgit v1.2.3