Patch: fix PGP/GPG signed messages parsing in tinymail



	Hi,

	Here goes one of the historical issues we had in Tinymail: the strange
offset added on the mime parts of a PGP-signed message. With this patch,
the structure is properly created, and then, you'll get the expected
parts properly aligned.

Changelog entry:
* libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c:
  take into account the original substream bounds to calculate the new
  substream bounds on creating new message structure (fixes parsing
  of PGP signed messages)

-- 
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index 33b6c1e..9331fe1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-03-29  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c:
+	take into account the original substream bounds to calculate the new
+	substream bounds on creating new message structure (fixes parsing
+	of PGP signed messages)
+
 2009-03-24  Jose Dapena Paz  <jdapena igalia com>
 
 	* libtinymailui-gtk/tny-gtk-folder-list-store.[ch]: added
diff --git a/libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c b/libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c
index 3ec953e..04a4c54 100644
--- a/libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c
+++ b/libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c
@@ -90,9 +90,15 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
 	if (buffer == NULL) {
 		end = camel_mime_parser_tell (mp);
 		
-		if (stream != NULL)
-			stream = camel_seekable_substream_new ((CamelSeekableStream *) stream, start, end);
-		else
+		if (stream != NULL) {
+			uint offset;
+			if (CAMEL_IS_SEEKABLE_SUBSTREAM (stream)) {
+				offset = ((CamelSeekableStream *)stream)->bound_start;
+			} else {
+				offset = 0;
+			}
+			stream = camel_seekable_substream_new ((CamelSeekableStream *) stream, start + offset, end + offset);
+		} else
 			stream = camel_stream_fs_new_with_fd_and_bounds (dup (fd), start, end);
 	} else {
 		stream = camel_stream_mem_new_with_byte_array (buffer);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]