diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-07 10:39:28 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-07 10:39:28 +0800 |
commit | 83b2e9c05c490db58c558c17e39c59ec2a6915eb (patch) | |
tree | 603f31eb8b8583a358083e040139b32b47e3ab9d | |
parent | 7216ef812939353bc70951c2a46b272f62a99372 (diff) | |
download | gsoc2013-evolution-83b2e9c05c490db58c558c17e39c59ec2a6915eb.tar.gz gsoc2013-evolution-83b2e9c05c490db58c558c17e39c59ec2a6915eb.tar.zst gsoc2013-evolution-83b2e9c05c490db58c558c17e39c59ec2a6915eb.zip |
Modify to take a headers_only argument which will then only fetch message
2001-08-06 Jeffrey Stedfast <fejj@ximian.com>
* providers/pop3/camel-pop3-folder.c (pop3_get_message_stream):
Modify to take a headers_only argument which will then only fetch
message headers.
(pop3_generate_uids): Pass in TRUE for headers_only.
(pop3_get_message): Pass in FALSE for headers_only and move the
camel_operation() stuff out of get_message_stream and in to here
instead.
(pop3_generate_uids): We also need to be using i+ 1 as the id
since we are starting at 0.
svn path=/trunk/; revision=11722
-rw-r--r-- | camel/ChangeLog | 12 | ||||
-rw-r--r-- | camel/providers/pop3/camel-pop3-folder.c | 16 |
2 files changed, 19 insertions, 9 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 219209bd82..2f331d6696 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,6 +1,18 @@ 2001-08-06 Jeffrey Stedfast <fejj@ximian.com> * providers/pop3/camel-pop3-folder.c (pop3_get_message_stream): + Modify to take a headers_only argument which will then only fetch + message headers. + (pop3_generate_uids): Pass in TRUE for headers_only. + (pop3_get_message): Pass in FALSE for headers_only and move the + camel_operation() stuff out of get_message_stream and in to here + instead. + (pop3_generate_uids): We also need to be using i+ 1 as the id + since we are starting at 0. + +2001-08-06 Jeffrey Stedfast <fejj@ximian.com> + + * providers/pop3/camel-pop3-folder.c (pop3_get_message_stream): New internal function to get a message stream by message sequence id (so that we can share code between pop3_get_message and pop3_generate_uids). diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index 2648a48a5b..c8dc315ac3 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -52,7 +52,7 @@ static void pop3_sync (CamelFolder *folder, gboolean expunge, static gint pop3_get_message_count (CamelFolder *folder); static GPtrArray *pop3_get_uids (CamelFolder *folder); static CamelStreamMem *pop3_get_message_stream (CamelFolder *folder, int id, - CamelException *ex); + gboolean headers_only, CamelException *ex); static CamelMimeMessage *pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex); @@ -159,7 +159,7 @@ pop3_generate_uids (CamelFolder *folder, int count, CamelException *ex) guchar digest[16]; char *uid; - stream = pop3_get_message_stream (folder, i, ex); + stream = pop3_get_message_stream (folder, i + 1, TRUE, ex); if (stream == NULL) goto exception; @@ -317,16 +317,14 @@ uid_to_number (CamelPop3Folder *pop3_folder, const char *uid) } static CamelStreamMem * -pop3_get_message_stream (CamelFolder *folder, int id, CamelException *ex) +pop3_get_message_stream (CamelFolder *folder, int id, gboolean headers_only, CamelException *ex) { CamelStream *stream; char *result, *body; int status, total; - camel_operation_start_transient (NULL, _("Retrieving POP message %d"), id); - status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store), - &result, ex, "RETR %d", id); + &result, ex, headers_only ? "TOP %d 0" : "RETR %d", id); switch (status) { case CAMEL_POP3_ERR: camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, @@ -356,8 +354,6 @@ pop3_get_message_stream (CamelFolder *folder, int id, CamelException *ex) stream = camel_stream_mem_new_with_buffer (body, strlen (body)); g_free (body); - camel_operation_end (NULL); - return CAMEL_STREAM_MEM (stream); } @@ -375,7 +371,9 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex) return NULL; } - stream = pop3_get_message_stream (folder, id, ex); + camel_operation_start_transient (NULL, _("Retrieving POP message %d"), id); + stream = pop3_get_message_stream (folder, id, FALSE, ex); + camel_operation_end (NULL); if (stream == NULL) return NULL; |