aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-05-29 01:57:28 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-05-29 01:57:28 +0800
commita5cd99a2635e4d199ba06e94c01d628e35573a35 (patch)
tree4124b0df0f97a7ba0e38305eaf18a50d9e3b27f0 /camel/camel-mime-part.c
parentfc41f66a50a6963f8012b8ed9d29266b19a1c63a (diff)
downloadgsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.tar
gsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.tar.gz
gsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.tar.bz2
gsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.tar.lz
gsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.tar.xz
gsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.tar.zst
gsoc2013-evolution-a5cd99a2635e4d199ba06e94c01d628e35573a35.zip
More header parsing code.
1999-05-28 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/camel-mime-part.c (_parse_header_pair): (_init_header_name_table): More header parsing code. svn path=/trunk/; revision=953
Diffstat (limited to 'camel/camel-mime-part.c')
-rw-r--r--camel/camel-mime-part.c64
1 files changed, 59 insertions, 5 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 1a18aeeb4b..f4c02b7d7f 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include "gmime-content-field.h"
#include "gstring-util.h"
+#include "camel-log.h"
typedef enum {
@@ -34,6 +35,7 @@ typedef enum {
HEADER_DISPOSITION,
HEADER_CONTENT_ID,
HEADER_ENCODING,
+ HEADER_CONTENT_MD5,
HEADER_CONTENT_LANGUAGES
} CamelHeaderType;
static GHashTable *header_name_table;
@@ -76,6 +78,9 @@ _init_header_name_table()
header_name_table = g_hash_table_new (g_string_hash, g_string_equal_for_hash);
g_hash_table_insert (header_name_table, g_string_new ("Content-Description"), (gpointer)HEADER_DESCRIPTION);
g_hash_table_insert (header_name_table, g_string_new ("Content-Disposition"), (gpointer)HEADER_DISPOSITION);
+ g_hash_table_insert (header_name_table, g_string_new ("Content-id"), (gpointer)HEADER_CONTENT_ID);
+ g_hash_table_insert (header_name_table, g_string_new ("Content-Transfer-Encoding"), (gpointer)HEADER_ENCODING);
+ g_hash_table_insert (header_name_table, g_string_new ("Content-MD5"), (gpointer)HEADER_CONTENT_MD5);
}
@@ -536,15 +541,64 @@ static gboolean
_parse_header_pair (CamelMimePart *mime_part, GString *header_name, GString *header_value)
{
CamelHeaderType header_type;
+ gboolean header_handled = FALSE;
+
+
header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
switch (header_type) {
case HEADER_DESCRIPTION:
- printf("found HEADER_DESCRIPTION\n");
- return TRUE;
+ CAMEL_LOG (FULL_DEBUG,
+ "CamelMimePart::parse_header_pair found HEADER_DESCRIPTION: %s\n",
+ header_value->str );
+
+ camel_mime_part_set_description (mime_part, header_value);
+ header_handled = TRUE;
break;
-
+
+ case HEADER_DISPOSITION:
+ CAMEL_LOG (FULL_DEBUG,
+ "CamelMimePart::parse_header_pair found HEADER_DISPOSITION: %s\n",
+ header_value->str );
+
+ camel_mime_part_set_disposition (mime_part, header_value);
+ header_handled = TRUE;
+ break;
+
+ case HEADER_CONTENT_ID:
+ CAMEL_LOG (FULL_DEBUG,
+ "CamelMimePart::parse_header_pair found HEADER_CONTENT_ID: %s\n",
+ header_value->str );
+
+ CMP_CLASS(mime_part)->set_content_id (mime_part, header_value);
+ header_handled = TRUE;
+ break;
+
+ case HEADER_ENCODING:
+ CAMEL_LOG (FULL_DEBUG,
+ "CamelMimePart::parse_header_pair found HEADER_ENCODING: %s\n",
+ header_value->str );
+
+ camel_mime_part_set_encoding (mime_part, header_value);
+ header_handled = TRUE;
+ break;
+
+ case HEADER_CONTENT_MD5:
+ CAMEL_LOG (FULL_DEBUG,
+ "CamelMimePart::parse_header_pair found HEADER_CONTENT_MD5: %s\n",
+ header_value->str );
+
+ CMP_CLASS(mime_part)->set_content_MD5 (mime_part, header_value);
+ header_handled = TRUE;
+ break;
+
+
}
- return FALSE;
-
+
+
+ if (header_handled) {
+ g_string_free (header_name, TRUE);
+ return TRUE;
+ } else return FALSE;
+
}