diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-07-02 04:07:13 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-02 04:07:13 +0800 |
commit | 3e96455b29cdd0494fc4faf7edbf0532594a9cc0 (patch) | |
tree | 36dba5225c485828884b3a65df4a9d6c2f1535a4 | |
parent | 57abc7f89543a5295008ab1d808a8b0f59808bb1 (diff) | |
download | gsoc2013-evolution-3e96455b29cdd0494fc4faf7edbf0532594a9cc0.tar.gz gsoc2013-evolution-3e96455b29cdd0494fc4faf7edbf0532594a9cc0.tar.zst gsoc2013-evolution-3e96455b29cdd0494fc4faf7edbf0532594a9cc0.zip |
Fixed the bug that would sometimes leave part of the server response
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.
svn path=/trunk/; revision=3847
-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"); |