[gmime] Implemented support for hiding headers using GMimeFormatOptions
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Implemented support for hiding headers using GMimeFormatOptions
- Date: Sat, 18 Mar 2017 11:50:58 +0000 (UTC)
commit 24867e053f5a2974026d334b3b553daaaa8bf962
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Fri Mar 17 21:50:22 2017 -0400
Implemented support for hiding headers using GMimeFormatOptions
gmime/gmime-header.c | 10 ++++++----
gmime/gmime-message.c | 36 ++++++++++++++++++++++++------------
2 files changed, 30 insertions(+), 16 deletions(-)
---
diff --git a/gmime/gmime-header.c b/gmime/gmime-header.c
index 53efad5..2e2364a 100644
--- a/gmime/gmime-header.c
+++ b/gmime/gmime-header.c
@@ -858,10 +858,12 @@ g_mime_header_list_write_to_stream (GMimeHeaderList *headers, GMimeFormatOptions
for (i = 0; i < headers->array->len; i++) {
header = (GMimeHeader *) headers->array->pdata[i];
- if ((nwritten = g_mime_header_write_to_stream (headers, header, options, stream)) == -1)
- return -1;
-
- total += nwritten;
+ if (g_mime_format_options_is_hidden_header (options, header->name)) {
+ if ((nwritten = g_mime_header_write_to_stream (headers, header, options, stream)) ==
-1)
+ return -1;
+
+ total += nwritten;
+ }
}
return total;
diff --git a/gmime/gmime-message.c b/gmime/gmime-message.c
index 15cf274..67b03f1 100644
--- a/gmime/gmime-message.c
+++ b/gmime/gmime-message.c
@@ -882,16 +882,22 @@ write_headers_to_stream (GMimeObject *object, GMimeFormatOptions *options, GMime
offset = g_mime_header_get_offset (header);
if (offset >= 0 && offset < body_offset) {
- if ((nwritten = g_mime_header_write_to_stream (object->headers, header,
options, stream)) == -1)
- return -1;
+ if (!g_mime_format_options_is_hidden_header (options, header->name)) {
+ if ((nwritten = g_mime_header_write_to_stream (object->headers,
header, options, stream)) == -1)
+ return -1;
+
+ total += nwritten;
+ }
- total += nwritten;
index++;
} else {
- if ((nwritten = g_mime_header_write_to_stream (mime_part->headers,
body_header, options, stream)) == -1)
- return -1;
+ if (!g_mime_format_options_is_hidden_header (options, header->name)) {
+ if ((nwritten = g_mime_header_write_to_stream (mime_part->headers,
body_header, options, stream)) == -1)
+ return -1;
+
+ total += nwritten;
+ }
- total += nwritten;
body_index++;
}
}
@@ -899,20 +905,26 @@ write_headers_to_stream (GMimeObject *object, GMimeFormatOptions *options, GMime
while (index < count) {
header = g_mime_header_list_get_header_at (object->headers, index);
- if ((nwritten = g_mime_header_write_to_stream (object->headers, header, options,
stream)) == -1)
- return -1;
+ if (g_mime_format_options_is_hidden_header (options, header->name)) {
+ if ((nwritten = g_mime_header_write_to_stream (object->headers, header,
options, stream)) == -1)
+ return -1;
+
+ total += nwritten;
+ }
- total += nwritten;
index++;
}
while (body_index < body_count) {
header = g_mime_header_list_get_header_at (mime_part->headers, body_index);
- if ((nwritten = g_mime_header_write_to_stream (mime_part->headers, header, options,
stream)) == -1)
- return -1;
+ if (g_mime_format_options_is_hidden_header (options, header->name)) {
+ if ((nwritten = g_mime_header_write_to_stream (mime_part->headers, header,
options, stream)) == -1)
+ return -1;
+
+ total += nwritten;
+ }
- total += nwritten;
body_index++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]