[geary/wip/362-utf8-attachments] Update PreviewText.with_header to use convenience APIs
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/362-utf8-attachments] Update PreviewText.with_header to use convenience APIs
- Date: Thu, 18 Jul 2019 05:36:54 +0000 (UTC)
commit 0863c9fc7482c528122ae5fde219ab6a31399ebc
Author: Michael Gratton <mike vee net>
Date: Thu Jul 18 15:36:26 2019 +1000
Update PreviewText.with_header to use convenience APIs
src/engine/rfc822/rfc822-message-data.vala | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-message-data.vala b/src/engine/rfc822/rfc822-message-data.vala
index f5eeb628..0c8d9e17 100644
--- a/src/engine/rfc822/rfc822-message-data.vala
+++ b/src/engine/rfc822/rfc822-message-data.vala
@@ -408,20 +408,12 @@ public class Geary.RFC822.PreviewText : Geary.RFC822.Text {
);
gpart.set_content_object(body);
- ByteArray output = new ByteArray();
- GMime.StreamMem output_stream =
- new GMime.StreamMem.with_byte_array(output);
- output_stream.set_owner(false);
-
try {
- part.write_to_stream(
- output_stream, Part.EncodingConversion.NONE
+ Memory.Buffer preview_buffer = part.write_to_buffer(
+ Part.EncodingConversion.UTF8
);
- uint8[] data = output.data;
- data += (uint8) '\0';
-
preview_text = Geary.RFC822.Utils.to_preview_text(
- (string) data,
+ preview_buffer.get_valid_utf8(),
is_html ? TextFormat.HTML : TextFormat.PLAIN
);
} catch (RFC822Error err) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]