diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-05-18 23:02:20 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-05-20 01:07:20 +0800 |
commit | 5fd22430809036acf607d3d3cd5f4b32c1f1cc81 (patch) | |
tree | 460fd37581efc61e5e0caf5772fb26bedbd6a25b | |
parent | 366b731a169ac54a0407f5d85879c38ba463398a (diff) | |
download | gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.tar gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.tar.gz gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.tar.bz2 gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.tar.lz gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.tar.xz gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.tar.zst gsoc2013-evolution-5fd22430809036acf607d3d3cd5f4b32c1f1cc81.zip |
Add e_mail_part_id_has_suffix().
-rw-r--r-- | em-format/e-mail-formatter-message-rfc822.c | 6 | ||||
-rw-r--r-- | em-format/e-mail-formatter-print.c | 4 | ||||
-rw-r--r-- | em-format/e-mail-formatter-quote-message-rfc822.c | 6 | ||||
-rw-r--r-- | em-format/e-mail-formatter-quote.c | 4 | ||||
-rw-r--r-- | em-format/e-mail-formatter.c | 12 | ||||
-rw-r--r-- | em-format/e-mail-part.c | 10 | ||||
-rw-r--r-- | em-format/e-mail-part.h | 2 |
7 files changed, 28 insertions, 16 deletions
diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c index 8e7b1cee8b..01b67c64da 100644 --- a/em-format/e-mail-formatter-message-rfc822.c +++ b/em-format/e-mail-formatter-message-rfc822.c @@ -90,7 +90,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension, p_id = e_mail_part_get_id (p); /* Check for nested rfc822 messages */ - if (g_str_has_suffix (p->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (p, ".rfc822")) { gchar *sub_end = g_strconcat (p_id, ".end", NULL); while (link != NULL) { @@ -152,13 +152,13 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension, const gchar *p_id; /* Skip attachment bar */ - if (g_str_has_suffix (part->id, ".attachment-bar")) + if (e_mail_part_id_has_suffix (part, ".attachment-bar")) continue; p_id = e_mail_part_get_id (p); /* Check for nested rfc822 messages */ - if (g_str_has_suffix (p->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (p, ".rfc822")) { gchar *sub_end = g_strconcat (p_id, ".end", NULL); while (link != NULL) { diff --git a/em-format/e-mail-formatter-print.c b/em-format/e-mail-formatter-print.c index 7ad03be956..ccbdeea9de 100644 --- a/em-format/e-mail-formatter-print.c +++ b/em-format/e-mail-formatter-print.c @@ -137,7 +137,7 @@ mail_formatter_print_run (EMailFormatter *formatter, break; if (part->is_hidden && !part->is_error) { - if (g_str_has_suffix (part->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (part, ".rfc822")) { link = e_mail_formatter_find_rfc822_end_iter (link); } @@ -163,7 +163,7 @@ mail_formatter_print_run (EMailFormatter *formatter, * jump to the end of the message, because content * of the whole message has been formatted by * message_rfc822 formatter */ - if (ok && g_str_has_suffix (part->id, ".rfc822")) { + if (ok && e_mail_part_id_has_suffix (part, ".rfc822")) { link = e_mail_formatter_find_rfc822_end_iter (link); continue; diff --git a/em-format/e-mail-formatter-quote-message-rfc822.c b/em-format/e-mail-formatter-quote-message-rfc822.c index ae09a0285b..ae1d3a4e54 100644 --- a/em-format/e-mail-formatter-quote-message-rfc822.c +++ b/em-format/e-mail-formatter-quote-message-rfc822.c @@ -89,10 +89,10 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension, p_id = e_mail_part_get_id (p); /* Skip attachment bar */ - if (g_str_has_suffix (p->id, ".attachment-bar")) + if (e_mail_part_id_has_suffix (p, ".attachment-bar")) continue; - if (g_str_has_suffix (p->id, ".headers.")) { + if (e_mail_part_id_has_suffix (p, ".headers.")) { if (qc->qf_flags & E_MAIL_FORMATTER_QUOTE_FLAG_HEADERS) { e_mail_formatter_format_as ( formatter, context, part, stream, @@ -104,7 +104,7 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension, } /* Check for nested rfc822 messages */ - if (g_str_has_suffix (p->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (p, ".rfc822")) { gchar *sub_end = g_strconcat (p_id, ".end", NULL); while (link != NULL) { diff --git a/em-format/e-mail-formatter-quote.c b/em-format/e-mail-formatter-quote.c index f810f231a7..837b810267 100644 --- a/em-format/e-mail-formatter-quote.c +++ b/em-format/e-mail-formatter-quote.c @@ -105,12 +105,12 @@ mail_formatter_quote_run (EMailFormatter *formatter, for (link = head; link != NULL; link = g_list_next (link)) { EMailPart *part = E_MAIL_PART (link->data); - if (g_str_has_suffix (part->id, ".headers") && + if (e_mail_part_id_has_suffix (part, ".headers") && !(qf_context->qf_flags & E_MAIL_FORMATTER_QUOTE_FLAG_HEADERS)) { continue; } - if (g_str_has_suffix (part->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (part, ".rfc822")) { link = e_mail_formatter_find_rfc822_end_iter (link); continue; } diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c index fb1c069ffa..e2e6da75a3 100644 --- a/em-format/e-mail-formatter.c +++ b/em-format/e-mail-formatter.c @@ -405,7 +405,7 @@ mail_formatter_run (EMailFormatter *formatter, break; if (part->is_hidden && !part->is_error) { - if (g_str_has_suffix (part->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (part, ".rfc822")) { link = e_mail_formatter_find_rfc822_end_iter (link); } @@ -429,7 +429,7 @@ mail_formatter_run (EMailFormatter *formatter, * jump to the end of the message, because content * of the whole message has been formatted by * message_rfc822 formatter */ - if (ok && g_str_has_suffix (part->id, ".rfc822")) { + if (ok && e_mail_part_id_has_suffix (part, ".rfc822")) { link = e_mail_formatter_find_rfc822_end_iter (link); if (link == NULL) @@ -444,8 +444,8 @@ mail_formatter_run (EMailFormatter *formatter, if (!ok) { /* We don't want to source these */ - if (g_str_has_suffix (part->id, ".headers") || - g_str_has_suffix (part->id, "attachment-bar")) + if (e_mail_part_id_has_suffix (part, ".headers") || + e_mail_part_id_has_suffix (part, "attachment-bar")) continue; e_mail_formatter_format_as ( @@ -460,11 +460,11 @@ mail_formatter_run (EMailFormatter *formatter, /* If we just wrote source of a rfc822 message, then jump * behind the message (otherwise source of all parts * would be rendered twice) */ - if (g_str_has_suffix (part->id, ".rfc822")) { + if (e_mail_part_id_has_suffix (part, ".rfc822")) { do { part = link->data; - if (g_str_has_suffix (part->id, ".rfc822.end")) + if (e_mail_part_id_has_suffix (part, ".rfc822.end")) break; link = g_list_next (link); diff --git a/em-format/e-mail-part.c b/em-format/e-mail-part.c index 95e4929286..945175cca2 100644 --- a/em-format/e-mail-part.c +++ b/em-format/e-mail-part.c @@ -211,6 +211,16 @@ e_mail_part_id_has_prefix (EMailPart *part, return g_str_has_prefix (part->id, prefix); } +gboolean +e_mail_part_id_has_suffix (EMailPart *part, + const gchar *suffix) +{ + g_return_val_if_fail (part != NULL, FALSE); + g_return_val_if_fail (suffix != NULL, FALSE); + + return g_str_has_suffix (part->id, suffix); +} + static EMailPartValidityPair * mail_part_find_validity_pair (EMailPart *part, guint32 validity_type) diff --git a/em-format/e-mail-part.h b/em-format/e-mail-part.h index 8a71d3be9f..769d5bbc4c 100644 --- a/em-format/e-mail-part.h +++ b/em-format/e-mail-part.h @@ -101,6 +101,8 @@ void e_mail_part_set_cid (EMailPart *part, const gchar *cid); gboolean e_mail_part_id_has_prefix (EMailPart *part, const gchar *prefix); +gboolean e_mail_part_id_has_suffix (EMailPart *part, + const gchar *suffix); void e_mail_part_update_validity (EMailPart *part, CamelCipherValidity *validity, guint32 validity_type); |