aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/pop3/camel-pop3-folder.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-03-28 05:37:49 +0800
committerDan Winship <danw@src.gnome.org>2000-03-28 05:37:49 +0800
commitabd054f4244d020873c031bdc8de0cb7c57ca2c2 (patch)
tree3aa1d207b594bef0d31d68de5900b671688d4428 /camel/providers/pop3/camel-pop3-folder.c
parent7b379b8f3b59bafc137054a66ffd40a1e5908971 (diff)
downloadgsoc2013-evolution-abd054f4244d020873c031bdc8de0cb7c57ca2c2.tar.gz
gsoc2013-evolution-abd054f4244d020873c031bdc8de0cb7c57ca2c2.tar.zst
gsoc2013-evolution-abd054f4244d020873c031bdc8de0cb7c57ca2c2.zip
keep separate input and output streams so the output doesn't end up being
* providers/pop3/camel-pop3-store.c: keep separate input and output streams so the output doesn't end up being buffered. * providers/pop3/camel-pop3-folder.c (get_message_by_number): finish implementing this. * providers/Makefile.am (SUBDIRS): Add pop3. svn path=/trunk/; revision=2196
Diffstat (limited to 'camel/providers/pop3/camel-pop3-folder.c')
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index e87cd97f4d..ad856cc2be 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -26,6 +26,8 @@
#include "camel-pop3-folder.h"
#include "camel-pop3-store.h"
#include "camel-exception.h"
+#include "camel-stream-mem.h"
+#include "camel-mime-message.h"
#include <stdlib.h>
@@ -118,6 +120,8 @@ get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
{
int status;
char *result, *body;
+ CamelStream *msgstream;
+ CamelMimeMessage *msg;
status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
&result, "RETR %d", number);
@@ -133,8 +137,22 @@ get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
}
g_free (result);
- /* XXX finish this */
- return NULL;
+ body = camel_pop3_command_get_additional_data (CAMEL_POP3_STORE (folder->parent_store));
+ 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.", service->url->host);
+ return NULL;
+ }
+
+ msgstream = camel_stream_mem_new_with_buffer (body, strlen (body),
+ CAMEL_STREAM_MEM_READ);
+ msg = camel_mime_message_new_with_session (camel_service_get_session (CAMEL_SERVICE (folder->parent_store)));
+ camel_data_wrapper_set_input_stream (CAMEL_DATA_WRAPPER (msg),
+ msgstream);
+
+ return msg;
}