aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/pop3/camel-pop3-folder.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-02-08 09:42:53 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-02-08 09:42:53 +0800
commit49f8a687a41e635cd83807d33c74afe8e55fb3df (patch)
tree4162f19a2db18ff787386c7c97a98e5e8a5e7744 /camel/providers/pop3/camel-pop3-folder.c
parent1290da3f286a31745b1814610c16918c2e84e140 (diff)
downloadgsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.tar
gsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.tar.gz
gsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.tar.bz2
gsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.tar.lz
gsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.tar.xz
gsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.tar.zst
gsoc2013-evolution-49f8a687a41e635cd83807d33c74afe8e55fb3df.zip
Changed to push the operation into a status stack.
2001-02-07 Not Zed <NotZed@Ximian.com> * 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
Diffstat (limited to 'camel/providers/pop3/camel-pop3-folder.c')
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c31
1 files changed, 25 insertions, 6 deletions
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 <stdlib.h>
#include <string.h>
@@ -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;
}