diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-11-09 08:41:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-11-09 08:41:09 +0800 |
commit | 64c19759bfa6820bd67b47d659ea7241f2efbd9b (patch) | |
tree | 6658ac64f2592da0df4bdb49838d1e7b83bd3943 /camel/providers/imap/camel-imap-folder.c | |
parent | 4e96a9415be10f8184d8b3b2e47f879f78faeac7 (diff) | |
download | gsoc2013-evolution-64c19759bfa6820bd67b47d659ea7241f2efbd9b.tar.gz gsoc2013-evolution-64c19759bfa6820bd67b47d659ea7241f2efbd9b.tar.zst gsoc2013-evolution-64c19759bfa6820bd67b47d659ea7241f2efbd9b.zip |
Now takes a command-length argument so we can 1) avoid duping the command
2001-11-06 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-command.c
(camel_imap_command_continuation): Now takes a command-length
argument so we can 1) avoid duping the command string yet again,
yay. 2) we now don't have to worry about embedded nul-chars
screwing us over (we still need to avoid allowing them into the
string but at least now it won't mess us up).
* providers/imap/camel-imap-folder.c (do_append): Instead of
appending a nul char to the end of the byte array and then passing
that off as if it were a string to
camel_imap_command_continuation, instead pass the byte-array
length since that function now takes a length argument. Yay. Also
encode any 8bit parts to avoid the possibility of sending embedded
nul chars to the imap server.
* providers/imap/camel-imap-store.c (try_auth): Updated to pass a
command-length argument to camel_imap_command_continuation().
svn path=/trunk/; revision=14637
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 67b515ec93..dcd33ad224 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -939,29 +939,33 @@ do_append (CamelFolder *folder, CamelMimeMessage *message, CamelStreamFilter *streamfilter; GByteArray *ba; char *flagstr, *result, *end; - + /* create flag string param */ if (info && info->flags) flagstr = imap_create_flag_list (info->flags); else flagstr = NULL; - + + /* encode any 8bit parts so we avoid sending embedded nul-chars and such */ + /* commented out because it might change the encoding on + signed parts which'd break stuff */ + /*camel_mime_message_encode_8bit_parts (message);*/ + /* FIXME: We could avoid this if we knew how big the message was. */ memstream = camel_stream_mem_new (); ba = g_byte_array_new (); camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (memstream), ba); - + streamfilter = camel_stream_filter_new_with_stream (memstream); - crlf_filter = camel_mime_filter_crlf_new ( - CAMEL_MIME_FILTER_CRLF_ENCODE, - CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); + crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE, + CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); camel_stream_filter_add (streamfilter, crlf_filter); camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (streamfilter)); camel_object_unref (CAMEL_OBJECT (streamfilter)); camel_object_unref (CAMEL_OBJECT (crlf_filter)); camel_object_unref (CAMEL_OBJECT (memstream)); - + response = camel_imap_command (store, NULL, ex, "APPEND %F%s%s {%d}", folder->full_name, flagstr ? " " : "", flagstr ? flagstr : "", ba->len); @@ -971,27 +975,27 @@ do_append (CamelFolder *folder, CamelMimeMessage *message, g_byte_array_free (ba, TRUE); return NULL; } + result = camel_imap_response_extract_continuation (store, response, ex); if (!result) { g_byte_array_free (ba, TRUE); return NULL; } g_free (result); - + /* send the rest of our data - the mime message */ - g_byte_array_append (ba, "\0", 3); - response = camel_imap_command_continuation (store, ba->data, ex); + response = camel_imap_command_continuation (store, ba->data, ba->len, ex); g_byte_array_free (ba, TRUE); if (!response) return response; - + if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) { *uid = strstrcase (response->status, "[APPENDUID "); if (*uid) *uid = strchr (*uid + 11, ' '); if (*uid) { *uid = g_strndup (*uid + 1, strcspn (*uid + 1, "]")); - /* Make sure it's a number */ + /* Make sure it's a number */ if (strtoul (*uid, &end, 10) == 0 || *end) { g_free (*uid); *uid = NULL; @@ -999,7 +1003,7 @@ do_append (CamelFolder *folder, CamelMimeMessage *message, } } else *uid = NULL; - + return response; } |