diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 2000-02-10 04:35:35 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 2000-02-10 04:35:35 +0800 |
commit | 3bd58106efb22b78e6fbabe9307880338ae92746 (patch) | |
tree | 6f54c6597f461a01d0750232d3c0f1ca423389a1 /camel | |
parent | 4c87a79aa40f9fccc40f036b8e182122914cadb0 (diff) | |
download | gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.tar gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.tar.gz gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.tar.bz2 gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.tar.lz gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.tar.xz gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.tar.zst gsoc2013-evolution-3bd58106efb22b78e6fbabe9307880338ae92746.zip |
various typo fixes in the ctree construction.
2000-02-09 bertrand <Bertrand.Guiheneuf@aful.org>
* tests/ui-tests/message-browser.c: various typo
fixes in the ctree construction.
* camel/string-utils.c (string_trim): fix braindead
trailing trim bug.
* camel/gmime-content-field.c (gmime_content_field_construct_from_string):
strip the leading and trailing quotes when constructing the
content field. This should be done in a more generic
RFC822 approach, but this fixes a bug that prevent
matt from analysing some multipart messages.
* camel/camel-data-wrapper.h: reorganize the
deprecated and new methods.
* camel/providers/mbox/camel-mbox-folder.c
(_check_get_or_maybe_generate_summary_file):
Use "From " as the message separating string.
* camel/providers/mbox/camel-mbox-folder.c (_append_message):
set the mode when creating the mbox file.
* camel/providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev):
ditto
* camel/providers/mbox/camel-mbox-summary.c (camel_mbox_save_summary):
ditto
svn path=/trunk/; revision=1711
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-data-wrapper.h | 15 | ||||
-rw-r--r-- | camel/camel-multipart.c | 5 | ||||
-rw-r--r-- | camel/gmime-content-field.c | 30 | ||||
-rw-r--r-- | camel/gmime-utils.c | 2 | ||||
-rw-r--r-- | camel/md5-utils.c | 1 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 7 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-summary.c | 4 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-utils.c | 5 | ||||
-rw-r--r-- | camel/string-utils.c | 3 |
9 files changed, 51 insertions, 21 deletions
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h index c9f8e8b65c..5035d06f98 100644 --- a/camel/camel-data-wrapper.h +++ b/camel/camel-data-wrapper.h @@ -60,6 +60,7 @@ typedef struct typedef struct { + GtkObjectClass parent_class; /* Virtual methods */ @@ -68,15 +69,17 @@ typedef struct { void (*set_output_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream); CamelStream * (*get_output_stream) (CamelDataWrapper *data_wrapper); - /* deprecated method */ - void (*write_to_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream); - void (*construct_from_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream); - void (*set_mime_type) (CamelDataWrapper *data_wrapper, gchar * mime_type); gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper); GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper); void (*set_mime_type_field) (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type_field); + + + /* deprecated method */ CamelStream * (*get_stream) (CamelDataWrapper *data_wrapper); + void (*write_to_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream); + void (*construct_from_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream); + } CamelDataWrapperClass; @@ -90,12 +93,14 @@ GtkType camel_data_wrapper_get_type (void); void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); -void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type); gchar *camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper); GMimeContentField *camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper); void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type); + +/* deprecated methods. Left until the new parser scheme is ok */ CamelStream *camel_data_wrapper_get_stream (CamelDataWrapper *data_wrapper); +void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); #ifdef __cplusplus } diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c index 9b6734f011..b30f8590b0 100644 --- a/camel/camel-multipart.c +++ b/camel/camel-multipart.c @@ -343,6 +343,7 @@ _get_boundary (CamelMultipart *multipart) return NULL; } boundary = gmime_content_field_get_parameter (CAMEL_DATA_WRAPPER (multipart)->mime_type, "boundary"); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::boundary found : \"%s\"\n", boundary); CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_get_boundary\n"); return boundary; } @@ -443,10 +444,12 @@ _read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_bou new_line = gmime_read_line_from_stream (stream); } } + if (new_line) g_free (new_line); + else last_part = TRUE; CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _read_part\n"); - return (last_part || (new_line == NULL)); + return (last_part); } static void diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c index 0a72246a0d..3c1f4fbc7b 100644 --- a/camel/gmime-content-field.c +++ b/camel/gmime-content-field.c @@ -309,21 +309,30 @@ gmime_content_field_construct_from_string (GMimeContentField *content_field, con first = 0; len = strlen (string); - if (!len) return; + if (!len) { + CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, leaving\n"); + return; + } CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string, All checks done\n"); - + CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string the complete header is\n" + "-------------------\n%s\n-------------------\n", string); /* find the type */ while ( (i<len) && (!strchr ("/;", string[i])) ) i++; - if (i == 0) return; + if (i == 0) { + CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, leaving\n"); + return; + } type = g_strndup (string, i); - string_trim (type, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); + string_trim (type, " \t\"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); content_field->type = type; CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime type : \"%s\"\n", type); if (i >= len-1) { content_field->subtype = NULL; - return; + + CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string only found the type leaving\n"); + return; } first = i+1; @@ -332,10 +341,13 @@ gmime_content_field_construct_from_string (GMimeContentField *content_field, con while ( (i<len) && (string[i] != ';') ) i++; if (i != first) { subtype = g_strndup (string+first, i-first); - string_trim (subtype, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); + string_trim (subtype, " \t\"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); content_field->subtype = subtype; CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime subtype: \"%s\"\n", subtype); - if (i >= len-1) return; + if (i >= len-1) { + CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string found the subtype but no parameter, leaving\n"); + return; + } } } first = i+1; @@ -348,7 +360,7 @@ gmime_content_field_construct_from_string (GMimeContentField *content_field, con else { /* we have found parameter name */ param_name = g_strndup (string+first, i-first); - string_trim (param_name, " ", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); + string_trim (param_name, " \"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); i++; first = i; /* Let's find parameter value */ @@ -356,7 +368,7 @@ gmime_content_field_construct_from_string (GMimeContentField *content_field, con if (i != first) param_value = g_strndup (string+first, i-first); else param_value = g_strdup (""); CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime parameter \"%s\"=\"%s\"\n", param_name, param_value); - string_trim (param_value, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); + string_trim (param_value, " \t\"", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING); gmime_content_field_set_parameter (content_field, param_name, param_value); g_free (param_name); g_free (param_value); diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c index 4e089aeeb6..421808a4d4 100644 --- a/camel/gmime-utils.c +++ b/camel/gmime-utils.c @@ -196,6 +196,8 @@ get_header_array_from_stream (CamelStream *stream) if (nb_char_read>0) { switch (next_char) { + case '\r': CAMEL_LOG_FULL_DEBUG ( "gmime-utils::get_header_table_from_stream " + "****** FOUND A \\r******* \n"); case '\n': /* a blank line means end of headers */ if (crlf) { end_of_headers=TRUE; diff --git a/camel/md5-utils.c b/camel/md5-utils.c index 53f3373bb5..1300c00f9f 100644 --- a/camel/md5-utils.c +++ b/camel/md5-utils.c @@ -188,7 +188,6 @@ md5_final (guchar digest[16], MD5Context *ctx) if (ctx->doByteReverse) _byte_reverse ((guchar *) ctx->buf, 4); memcpy (digest, ctx->buf, 16); - memset (ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 87456ac0fe..53da87b746 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -242,7 +242,7 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelEx mbox_file_fd = open (mbox_folder->folder_file_path, O_RDONLY); message_info_array = camel_mbox_parse_file (mbox_file_fd, - "From - ", + "From ", 0, &file_size, &next_uid, @@ -981,7 +981,10 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException /* append the temporary file message to the mbox file */ fd1 = open (tmp_message_filename, O_RDONLY); - fd2 = open (mbox_folder->folder_file_path, O_WRONLY | O_CREAT | O_APPEND); + fd2 = open (mbox_folder->folder_file_path, + O_WRONLY | O_CREAT | O_APPEND, + S_IRUSR | S_IWUSR); + if (fd2 == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index 094d032cb3..244fe34073 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -51,7 +51,9 @@ camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, Camel CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n"); - fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC); + fd = open (filename, + O_WRONLY | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR); if (fd == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, diff --git a/camel/providers/mbox/camel-mbox-utils.c b/camel/providers/mbox/camel-mbox-utils.c index 1f0285be8a..64fb4cb283 100644 --- a/camel/providers/mbox/camel-mbox-utils.c +++ b/camel/providers/mbox/camel-mbox-utils.c @@ -233,7 +233,10 @@ camel_mbox_write_xev (gchar *mbox_file_name, tmp_file_name_secure = g_strdup_printf ("%s__.ev_tmp_secure", mbox_file_name); fd1 = open (mbox_file_name, O_RDONLY); - fd2 = open (tmp_file_name, O_WRONLY | O_CREAT | O_TRUNC ); + fd2 = open (tmp_file_name, + O_WRONLY | O_CREAT | O_TRUNC , + S_IRUSR | S_IWUSR); + if (fd2 == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, diff --git a/camel/string-utils.c b/camel/string-utils.c index 3f9ce4805d..7cd9e97af0 100644 --- a/camel/string-utils.c +++ b/camel/string-utils.c @@ -245,7 +245,8 @@ string_trim (gchar *string, const gchar *trim_chars, StringTrimOption options) string, first_ok, last_ok); if (first_ok > 0) - memmove (string, string+first_ok, last_ok - first_ok +2); + memmove (string, string+first_ok, last_ok - first_ok + 1); + string[last_ok - first_ok +1] = '\0'; } |