[evolution] I#120 - Show security bar above message headers
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#120 - Show security bar above message headers
- Date: Mon, 22 Oct 2018 16:53:49 +0000 (UTC)
commit 9c55a311325f5905d8b8403b96607e46cf343f21
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 22 18:53:28 2018 +0200
I#120 - Show security bar above message headers
Closes https://gitlab.gnome.org/GNOME/evolution/issues/120
src/em-format/e-mail-parser.c | 63 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
---
diff --git a/src/em-format/e-mail-parser.c b/src/em-format/e-mail-parser.c
index 793d891dfc..c81bcc2aca 100644
--- a/src/em-format/e-mail-parser.c
+++ b/src/em-format/e-mail-parser.c
@@ -79,6 +79,67 @@ GType e_mail_parser_application_smime_get_type (void);
static gpointer parent_class;
+static void
+mail_parser_move_security_before_headers (GQueue *part_queue)
+{
+ GList *link, *last_headers = NULL;
+ GSList *headers_stack = NULL;
+
+ link = g_queue_peek_head_link (part_queue);
+ while (link) {
+ EMailPart *part = link->data;
+ const gchar *id;
+
+ if (!part) {
+ link = g_list_next (link);
+ continue;
+ }
+
+ id = e_mail_part_get_id (part);
+ if (!id) {
+ link = g_list_next (link);
+ continue;
+ }
+
+ if (g_str_has_suffix (id, ".rfc822")) {
+ headers_stack = g_slist_prepend (headers_stack, last_headers);
+ last_headers = NULL;
+ } else if (g_str_has_suffix (id, ".rfc822.end")) {
+ g_warn_if_fail (headers_stack != NULL);
+
+ if (headers_stack) {
+ last_headers = headers_stack->data;
+ headers_stack = g_slist_remove (headers_stack, last_headers);
+ } else {
+ last_headers = NULL;
+ }
+ }
+
+ if (g_strcmp0 (e_mail_part_get_mime_type (part), "application/vnd.evolution.headers") == 0) {
+ last_headers = link;
+ link = g_list_next (link);
+ } else if (g_strcmp0 (e_mail_part_get_mime_type (part),
"application/vnd.evolution.secure-button") == 0) {
+ g_warn_if_fail (last_headers != NULL);
+
+ if (last_headers) {
+ GList *next = g_list_next (link);
+
+ g_warn_if_fail (g_queue_remove (part_queue, part));
+ g_queue_insert_before (part_queue, last_headers, part);
+
+ link = next;
+ } else {
+ link = g_list_next (link);
+ }
+ } else {
+ link = g_list_next (link);
+ }
+ }
+
+ g_warn_if_fail (headers_stack == NULL);
+ g_slist_free (headers_stack);
+}
+
static void
mail_parser_run (EMailParser *parser,
EMailPartList *part_list,
@@ -142,6 +203,8 @@ mail_parser_run (EMailParser *parser,
break;
}
+ mail_parser_move_security_before_headers (&mail_part_queue);
+
while (!g_queue_is_empty (&mail_part_queue)) {
mail_part = g_queue_pop_head (&mail_part_queue);
e_mail_part_list_add_part (part_list, mail_part);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]