diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 4 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 23 |
2 files changed, 20 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index ceb01095f0..90cac0d0ee 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,9 @@ 2000-07-01 Jeffrey Stedfast <fejj@helixcode.com> + * providers/imap/camel-imap-folder.c (imap_get_message): Fixed + the bug that would sometimes leave part of the server response + tacked on to the end of the message. + * camel-folder.c: Renamed _by_uid methods. Since we no longer have get-by-number methods, no need to have the _by_uid extensions. diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index e1eebb0624..6b1a796738 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -752,7 +752,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex) /*CamelMimeFilter *filter;*/ CamelMimeMessage *msg; /*CamelMimePart *part;*/ - gchar *result, *header, *body, *mesg, *p; + gchar *result, *header, *body, *mesg, *p, *q; int id, status, part_len; status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder, @@ -783,10 +783,14 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex) return camel_mime_message_new (); } + /* calculate the new part-length */ + for (q = p; *q && (q - p) <= part_len; q++) { + if (*q == '\n') + part_len--; + } + header = g_strndup (p, part_len); - for (p = header + strlen (header) - 1; p > header && *p != ')'; p--); - if (p != header) - *p = '\0'; + g_free (result); printf ("*** We got the header ***\n"); @@ -821,13 +825,18 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex) return camel_mime_message_new (); } + /* calculate the new part-length */ + for (q = p; *q && (q - p) <= part_len; q++) { + if (*q == '\n') + part_len--; + } + body = g_strndup (p, part_len); - for (p = body + strlen (body) - 1; p > body && *p != ')'; p--); - *p = '\0'; + g_free (result); printf ("*** We got the body ***\n"); - mesg = g_strdup_printf ("%s%s", header, body); + mesg = g_strdup_printf ("%s\n%s", header, body); g_free (header); g_free (body); printf ("*** We got the mesg ***\n"); |