aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-08 06:09:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-08 06:09:57 +0800
commit55ee13ab6bf8760fb14de209d2519d6bbaf67c30 (patch)
treea7ce969d86b586fc945d818b2e09df57fd4c2a3a /camel/providers
parent0c9c8a55f81cfd4274b96a13d26f224f48f0a1aa (diff)
downloadgsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.tar
gsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.tar.gz
gsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.tar.bz2
gsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.tar.lz
gsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.tar.xz
gsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.tar.zst
gsoc2013-evolution-55ee13ab6bf8760fb14de209d2519d6bbaf67c30.zip
Don't cache the exact server response, only cache the important data (aka
2000-07-07 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-stream.c (stream_read): Don't cache the exact server response, only cache the important data (aka the mime part). svn path=/trunk/; revision=3964
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-stream.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/camel/providers/imap/camel-imap-stream.c b/camel/providers/imap/camel-imap-stream.c
index 74d46eb95c..d7fb0ee75c 100644
--- a/camel/providers/imap/camel-imap-stream.c
+++ b/camel/providers/imap/camel-imap-stream.c
@@ -25,6 +25,7 @@
#include "camel-imap-stream.h"
#include <sys/types.h>
#include <errno.h>
+#include <stdlib.h>
static CamelStreamClass *parent_class = NULL;
@@ -128,17 +129,19 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
if (!imap_stream->cache) {
/* We need to send the IMAP command since this is our first fetch */
CamelFolder *folder = CAMEL_FOLDER (imap_stream->folder);
- gint status;
+ gchar *result, *p, *q;
+ gint status, part_len;
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store),
CAMEL_FOLDER (imap_stream->folder),
- &imap_stream->cache, "%s",
+ &result, "%s\r\n",
imap_stream->command);
- if (status != CAMEL_IMAP_OK) {
+ if (!result || status != CAMEL_IMAP_OK) {
/* we got an error, dump this stuff */
- g_free (imap_stream->cache);
+ g_free (result);
imap_stream->cache = NULL;
+ gtk_object_unref (GTK_OBJECT (imap_stream->folder));
return -1;
}
@@ -146,6 +149,29 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
/* we don't need the folder anymore... */
gtk_object_unref (GTK_OBJECT (imap_stream->folder));
+ /* parse out the message part */
+ for (p = result; *p && *p != '{' && *p != '\n'; p++);
+ if (*p != '{') {
+ g_free (result);
+ return -1;
+ }
+
+ part_len = atoi (p + 1);
+ for ( ; *p && *p != '\n'; p++);
+ if (*p != '\n') {
+ g_free (result);
+ return -1;
+ }
+
+ /* calculate the new part-length */
+ for (q = p; *q && (q - p) <= part_len; q++) {
+ if (*q == '\n')
+ part_len--;
+ }
+
+ imap_stream->cache = g_strndup (p, part_len);
+ g_free (result);
+
imap_stream->cache_ptr = imap_stream->cache;
}