aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-10-18 14:11:54 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-10-18 14:11:54 +0800
commit229f78b929e0a9553b543f596a7643129d80b494 (patch)
tree8b33f2672a07f2431fae5bf2f686a52fb8b2e401 /camel/camel-mime-part.c
parent345f04ccae499e039f1f6f3d21768a2d93ea1c83 (diff)
downloadgsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.tar
gsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.tar.gz
gsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.tar.bz2
gsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.tar.lz
gsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.tar.xz
gsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.tar.zst
gsoc2013-evolution-229f78b929e0a9553b543f596a7643129d80b494.zip
No, we must not encode the headers here. These interfaces ARE raw
2000-10-18 Not Zed <NotZed@HelixCode.com> * camel-mime-part.c (add_header): No, we must not encode the headers here. These interfaces ARE raw interfaces as they are defined in camel_medium. Also removed a bogus/meaningless FIXME. (set_header): Likewise here, we must not. (process_header): Removed another bogus comment. * camel-object.c (shared_is_of_type): Comment out the spitting of a big warning when we're trying to determine types from code. * providers/mbox/camel-mbox-summary.c (message_info_new_from_parser): Only call ibex funcitons if we have an index. * providers/mh/camel-mh-summary.c (camel_mh_summary_add): Only call ibex functions if we have an index. (remove_summary): Likewise. (camel_mh_summary_check): Likewise. * providers/nntp/camel-nntp-store.c (nntp_store_get_folder): get_folder -> flags argument. * providers/vee/camel-vee-store.c (vee_get_folder): create->flags. * providers/pop3/camel-pop3-store.c (get_folder): Changed create -> flags. * providers/imap/camel-imap-store.c (get_folder): Added flags argument. * providers/mh/camel-mh-folder.c (camel_mh_folder_new): Added flags argument, and fixed code appropriately. * providers/mh/camel-mh-store.c (get_folder): Added flags argument. * camel-folder-search.c (message_body_contains): Perform a regex match on the contents of messages. This wont quite work yet as message contents are encoded when written to a stream. (build_match_regex): Converts a number of strings into a regex matching pattern, escaping special chars. (match_message): match a single message from a folder, by uid. Slow. (search_body_contains): Changed to support matching where no index is supplied. Matches are performed by retrieving message contents, etc. () WTF? camel should not be including any widget headers. * providers/mbox/camel-mbox-folder.c (camel_mbox_folder_new): Added flags argument. (mbox_refresh_info): Changed into a NOP, the refresh info code moved into the new function. (camel_mbox_folder_new): If we have an index requested, build one, otherwise, remove an old one, or just dont do anything. * providers/mbox/camel-mbox-store.c (get_folder): Changed create to flags, changed code to suit. * camel-store.c (camel_store_get_folder): Changed create to flags. (get_folder_internal): And here. (get_folder): And here too. * camel-store.h (camel_store_get_folder): Change the create argument to be a flags argument. svn path=/trunk/; revision=5978
Diffstat (limited to 'camel/camel-mime-part.c')
-rw-r--r--camel/camel-mime-part.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 955a3a7738..cb60d688a0 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -187,8 +187,6 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
/* known, the job is done in the parsing routine. If not, */
/* we simply add the header in a raw fashion */
- /* FIXME: MUST check fields for validity before adding them! */
-
header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
switch (header_type) {
case HEADER_DESCRIPTION: /* raw header->utf8 conversion */
@@ -197,7 +195,7 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
mime_part->description = g_strstrip (text);
break;
case HEADER_DISPOSITION:
- set_disposition (mime_part, header_value);
+ set_disposition(mime_part, header_value);
break;
case HEADER_CONTENT_ID:
text = header_msgid_decode(header_value);
@@ -214,7 +212,7 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
mime_part->content_MD5 = g_strdup(header_value);
break;
case HEADER_CONTENT_TYPE:
- gmime_content_field_construct_from_string (mime_part->content_type, header_value);
+ gmime_content_field_construct_from_string(mime_part->content_type, header_value);
break;
default:
return FALSE;
@@ -225,37 +223,39 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
/* Note: It is my understanding that we need to encode the values here as they are
not being encoded at the header_raw_* level. */
+/*
+ NO: This is absolutely wrong. The medium interface is entirely raw.
+ You cannot just go blingingly encoding headers because it depends entirely
+ on the header being encoded. process_header decodes and mirrors the
+ known headers, appropriately, and we just add this raw header to our
+ list.
+
+ Please read the comments, they explained it already!!!!!!!
+*/
+
static void
set_header (CamelMedium *medium, const char *header_name, const void *header_value)
{
CamelMimePart *part = CAMEL_MIME_PART (medium);
- char *encoded_value = header_encode_string (header_value);
- process_header (medium, header_name, encoded_value);
- header_raw_replace (&part->headers, header_name, encoded_value, -1);
-
- g_free (encoded_value);
+ process_header(medium, header_name, header_value);
+ header_raw_replace(&part->headers, header_name, header_value, -1);
}
static void
add_header (CamelMedium *medium, const char *header_name, const void *header_value)
{
CamelMimePart *part = CAMEL_MIME_PART (medium);
- char *encoded_value = header_encode_string (header_value);
/* Try to parse the header pair. If it corresponds to something */
/* known, the job is done in the parsing routine. If not, */
/* we simply add the header in a raw fashion */
- /* FIXME: MUST check fields for validity before adding them! */
-
/* If it was one of the headers we handled, it must be unique, set it instead of add */
- if (process_header (medium, header_name, encoded_value))
- header_raw_replace (&part->headers, header_name, encoded_value, -1);
+ if (process_header(medium, header_name, header_value))
+ header_raw_replace(&part->headers, header_name, header_value, -1);
else
- header_raw_append (&part->headers, header_name, encoded_value, -1);
-
- g_free (encoded_value);
+ header_raw_append(&part->headers, header_name, header_value, -1);
}
static void
@@ -473,10 +473,10 @@ set_content_object (CamelMedium *medium, CamelDataWrapper *content)
/**********************************************************************/
static int
-write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
+write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
{
- CamelMimePart *mp = CAMEL_MIME_PART (data_wrapper);
- CamelMedium *medium = CAMEL_MEDIUM (data_wrapper);
+ CamelMimePart *mp = CAMEL_MIME_PART(data_wrapper);
+ CamelMedium *medium = CAMEL_MEDIUM(data_wrapper);
CamelDataWrapper *content;
int total = 0;
int count;
@@ -494,12 +494,10 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
while (h) {
if (h->value == NULL){
- g_warning ("h->value is NULL here for %s", h->name);
+ g_warning("h->value is NULL here for %s", h->name);
count = 0;
} else {
- count = camel_stream_printf(
- stream, "%s%s%s\n", h->name,
- isspace(h->value[0]) ? ":" : ": ", h->value);
+ count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(h->value[0]) ? ":" : ": ", h->value);
}
if (count == -1)
return -1;
@@ -508,12 +506,12 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
}
}
- count = camel_stream_write (stream, "\n", 1);
+ count = camel_stream_write(stream, "\n", 1);
if (count == -1)
return -1;
total += count;
- content = camel_medium_get_content_object (medium);
+ content = camel_medium_get_content_object(medium);
if (content) {
/* I dont really like this here, but i dont know where else it might go ... */
#define CAN_THIS_GO_ELSEWHERE
@@ -569,7 +567,7 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
}
#endif
- count = camel_data_wrapper_write_to_stream (content, stream);
+ count = camel_data_wrapper_write_to_stream(content, stream);
if (filter_stream) {
camel_stream_flush((CamelStream *)filter_stream);
camel_object_unref((CamelObject *)filter_stream);