File gmime-1.0.7-patch of Package gmane-weaverd

diff --unified -r tmp/gmime-1.0.7/gmime-content-type.c gmime-1.0.7/gmime-content-type.c
--- tmp/gmime-1.0.7/gmime-content-type.c	Fri Apr 26 03:18:40 2002
+++ gmime-1.0.7/gmime-content-type.c	Sat Mar  6 12:53:31 2004
@@ -89,9 +89,11 @@
 			mime_type->subtype = g_strdup ("octet-stream");
 		}
 		
+		/*
 		g_warning ("Invalid or incomplete type: %s%s%s: defaulting to %s/%s",
 			   type ? type : "", subtype ? "/" : "", subtype ? subtype : "",
 			   mime_type->type, mime_type->subtype);
+		*/
 	}
 	
 	return mime_type;
diff --unified -r tmp/gmime-1.0.7/gmime-iconv.c gmime-1.0.7/gmime-iconv.c
--- tmp/gmime-1.0.7/gmime-iconv.c	Fri Apr 26 03:19:02 2002
+++ gmime-1.0.7/gmime-iconv.c	Sat Mar  6 19:23:56 2004
@@ -119,12 +119,19 @@
 		
 		/* remove from the iconv open hash */
 		g_hash_table_remove (iconv_open_hash, node->cd);
+
+		node->next = node->bucket->unused;
+		node->next->prev = node;
+		node->bucket->unused = node;
+		node->prev = NULL;
 	}
 }
 
 static void
 iconv_node_destroy (struct _iconv_node *node)
 {
+	return;
+
 	if (node) {
 		if (node->cd != (iconv_t) -1)
 			iconv_close (node->cd);
@@ -209,6 +216,8 @@
 iconv_cache_bucket_destroy (struct _iconv_cache_bucket *bucket)
 {
 	struct _iconv_node *node, *next;
+
+	return;
 	
 	node = bucket->unused;
 	while (node) {
diff --unified -r tmp/gmime-1.0.7/gmime-parser.c gmime-1.0.7/gmime-parser.c
--- tmp/gmime-1.0.7/gmime-parser.c	Wed Jul 31 05:20:25 2002
+++ gmime-1.0.7/gmime-parser.c	Sat Oct 23 10:11:33 2004
@@ -367,6 +367,7 @@
 	unsigned char *start, *inend;
 	struct _header_raw *hend;
 	size_t len = 0;
+	int times = 0;
 	
 	parser->midline = FALSE;
 	hend = (struct _header_raw *) &parser->headers;
@@ -378,7 +379,7 @@
 	
 	do {
 	refill:
-		if (parser_fill (parser) <= len)
+		if (parser_fill (parser) <= len || times++ > 100)
 			break;
 		
 		inptr = parser->inptr;
@@ -544,6 +545,7 @@
 	gboolean found_eos = FALSE;
 	size_t nleft, len;
 	int found;
+	int times = 0;
 	
 	d(printf ("scan-content\n"));
 	
@@ -555,6 +557,9 @@
 	
 	do {
 	refill:
+		if (times++ > 1000)
+			break;
+
 		nleft = parser->inend - inptr;
 		if (parser_fill (parser) <= 0) {
 			start = parser->inptr;
@@ -980,7 +985,7 @@
 
 
 static GMimeMessage *
-parser_construct_message (GMimeParser *parser)
+parser_construct_message_1 (GMimeParser *parser, int headers_only)
 {
 	GMimeContentType *content_type;
 	struct _header_raw *header;
@@ -1051,6 +1056,10 @@
 		
 		header = header->next;
 	}
+
+	if (headers_only) {
+		return message;
+	}
 	
 	content_type = parser_content_type (parser);
 	if (!content_type)
@@ -1069,6 +1078,18 @@
 	return message;
 }
 
+static GMimeMessage *
+parser_construct_message (GMimeParser *parser)
+{
+	return parser_construct_message_1 (parser, 0);
+}
+
+static GMimeMessage *
+parser_construct_message_headers_only (GMimeParser *parser)
+{
+	return parser_construct_message_1 (parser, 1);
+}
+
 
 /**
  * g_mime_parser_construct_message:
@@ -1092,3 +1113,19 @@
 	
 	return message;
 }
+
+GMimeMessage *
+g_mime_parser_construct_message_headers_only (GMimeStream *stream)
+{
+	GMimeMessage *message;
+	GMimeParser *parser;
+	
+	g_return_val_if_fail (stream != NULL, NULL);
+	
+	parser = parser_new (stream);
+	message = parser_construct_message_headers_only (parser);
+	parser_destroy (parser);
+	
+	return message;
+}
+
diff --unified -r tmp/gmime-1.0.7/gmime-utils.c gmime-1.0.7/gmime-utils.c
--- tmp/gmime-1.0.7/gmime-utils.c	Sat Oct 19 04:02:42 2002
+++ gmime-1.0.7/gmime-utils.c	Mon Oct 25 19:14:07 2004
@@ -224,7 +224,7 @@
 		mask = 0;
 		
 		/* find the end of this token */
-		for (end = start; *end && !strchr ("-/,\t\r\n ", *end); end++) {
+		for (end = start; *end && !strchr ("/,\t\r\n ", *end); end++) {
 			mask |= gmime_datetok_table[*end];
 		}
 		
@@ -1130,6 +1130,12 @@
 }
 
 
+gboolean extended_is_atom (char c, gboolean in_encoded_word) {
+	return is_atom (c) ||
+		(in_encoded_word && 
+		 (c == ':' || c == '.' || c == ','));
+}
+
 /**
  * g_mime_utils_8bit_header_decode:
  * @in: header to decode
@@ -1146,16 +1152,22 @@
 	unsigned char *decoded;
 	gboolean last_was_encoded = FALSE;
 	gboolean last_was_space = FALSE;
+	gboolean in_encoded_word = FALSE;
 	
 	out = g_string_sized_new (256);
 	lwsp = g_string_sized_new (256);
 	atom = g_string_sized_new (256);
 	inptr = in;
-	
+
 	while (inptr && *inptr) {
 		unsigned char c = *inptr++;
 		
-		if (!is_atom (c) && !last_was_space) {
+		if (c == '=' && *inptr == '?')
+			in_encoded_word = TRUE;
+		else if (c == '?' && *inptr == '=')
+			in_encoded_word = FALSE;
+
+		if (!extended_is_atom (c, in_encoded_word) && !last_was_space) {
 			/* we reached the end of an atom */
 			unsigned char *dword = NULL;
 			const unsigned char *word;
@@ -1202,7 +1214,7 @@
 			continue;
 		}
 		
-		if (is_atom (c)) {
+		if (extended_is_atom (c, in_encoded_word)) {
 			g_string_append_c (atom, c);
 			last_was_space = FALSE;
 		} else {
openSUSE Build Service is sponsored by