aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
Diffstat (limited to 'em-format')
-rw-r--r--em-format/e-mail-parser-application-mbox.c11
-rw-r--r--em-format/e-mail-parser-application-smime.c8
-rw-r--r--em-format/e-mail-parser-extension.c19
-rw-r--r--em-format/e-mail-parser-extension.h6
-rw-r--r--em-format/e-mail-parser-message-rfc822.c11
-rw-r--r--em-format/e-mail-parser-multipart-digest.c8
-rw-r--r--em-format/e-mail-parser-multipart-mixed.c8
-rw-r--r--em-format/e-mail-part-utils.c9
8 files changed, 17 insertions, 63 deletions
diff --git a/em-format/e-mail-parser-application-mbox.c b/em-format/e-mail-parser-application-mbox.c
index d4ff6b11bf..36fa6d5f01 100644
--- a/em-format/e-mail-parser-application-mbox.c
+++ b/em-format/e-mail-parser-application-mbox.c
@@ -160,19 +160,14 @@ empe_app_mbox_parse (EMailParserExtension *extension,
return TRUE;
}
-static guint32
-empe_app_mbox_get_flags (EMailParserExtension *extension)
-{
- return E_MAIL_PARSER_EXTENSION_INLINE |
- E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
-}
-
static void
e_mail_parser_application_mbox_class_init (EMailParserExtensionClass *class)
{
class->mime_types = parser_mime_types;
+ class->flags =
+ E_MAIL_PARSER_EXTENSION_INLINE |
+ E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
class->parse = empe_app_mbox_parse;
- class->get_flags = empe_app_mbox_get_flags;
}
static void
diff --git a/em-format/e-mail-parser-application-smime.c b/em-format/e-mail-parser-application-smime.c
index 29e623b52c..21593d326e 100644
--- a/em-format/e-mail-parser-application-smime.c
+++ b/em-format/e-mail-parser-application-smime.c
@@ -150,18 +150,12 @@ empe_app_smime_parse (EMailParserExtension *extension,
return TRUE;
}
-static guint32
-empe_app_smime_get_flags (EMailParserExtension *extension)
-{
- return E_MAIL_PARSER_EXTENSION_INLINE;
-}
-
static void
e_mail_parser_application_smime_class_init (EMailParserExtensionClass *class)
{
class->mime_types = parser_mime_types;
+ class->flags = E_MAIL_PARSER_EXTENSION_INLINE;
class->parse = empe_app_smime_parse;
- class->get_flags = empe_app_smime_get_flags;
}
static void
diff --git a/em-format/e-mail-parser-extension.c b/em-format/e-mail-parser-extension.c
index b20ae90e32..05fd952fe6 100644
--- a/em-format/e-mail-parser-extension.c
+++ b/em-format/e-mail-parser-extension.c
@@ -25,16 +25,9 @@ G_DEFINE_ABSTRACT_TYPE (
e_mail_parser_extension,
G_TYPE_OBJECT)
-static guint32
-mail_parser_extension_get_flags (EMailParserExtension *extension)
-{
- return 0;
-}
-
static void
e_mail_parser_extension_class_init (EMailParserExtensionClass *class)
{
- class->get_flags = mail_parser_extension_get_flags;
}
static void
@@ -100,15 +93,3 @@ e_mail_parser_extension_parse (EMailParserExtension *extension,
cancellable, out_mail_parts);
}
-guint32
-e_mail_parser_extension_get_flags (EMailParserExtension *extension)
-{
- EMailParserExtensionClass *class;
-
- g_return_val_if_fail (E_IS_MAIL_PARSER_EXTENSION (extension), 0);
-
- class = E_MAIL_PARSER_EXTENSION_GET_CLASS (extension);
- g_return_val_if_fail (class->get_flags != NULL, 0);
-
- return class->get_flags (extension);
-}
diff --git a/em-format/e-mail-parser-extension.h b/em-format/e-mail-parser-extension.h
index e510a15591..fdd48bf617 100644
--- a/em-format/e-mail-parser-extension.h
+++ b/em-format/e-mail-parser-extension.h
@@ -84,13 +84,15 @@ struct _EMailParserExtensionClass {
* wildcard (e.g. "text/ *"). */
const gchar **mime_types;
+ /* See the flag descriptions above. */
+ EMailParserExtensionFlags flags;
+
gboolean (*parse) (EMailParserExtension *extension,
EMailParser *parser,
CamelMimePart *mime_part,
GString *part_id,
GCancellable *cancellable,
GQueue *out_mail_parts);
- guint32 (*get_flags) (EMailParserExtension *extension);
};
GType e_mail_parser_extension_get_type
@@ -101,8 +103,6 @@ gboolean e_mail_parser_extension_parse (EMailParserExtension *extension,
GString *part_id,
GCancellable *cancellable,
GQueue *out_mail_parts);
-guint32 e_mail_parser_extension_get_flags
- (EMailParserExtension *extension);
G_END_DECLS
diff --git a/em-format/e-mail-parser-message-rfc822.c b/em-format/e-mail-parser-message-rfc822.c
index d2cd7ee7fe..5239c3c743 100644
--- a/em-format/e-mail-parser-message-rfc822.c
+++ b/em-format/e-mail-parser-message-rfc822.c
@@ -123,19 +123,14 @@ empe_msg_rfc822_parse (EMailParserExtension *extension,
return TRUE;
}
-static guint32
-empe_msg_rfc822_get_flags (EMailParserExtension *extension)
-{
- return E_MAIL_PARSER_EXTENSION_INLINE |
- E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
-}
-
static void
e_mail_parser_message_rfc822_class_init (EMailParserExtensionClass *class)
{
class->mime_types = parser_mime_types;
+ class->flags =
+ E_MAIL_PARSER_EXTENSION_INLINE |
+ E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
class->parse = empe_msg_rfc822_parse;
- class->get_flags = empe_msg_rfc822_get_flags;
}
static void
diff --git a/em-format/e-mail-parser-multipart-digest.c b/em-format/e-mail-parser-multipart-digest.c
index 2097b0cab8..6f22a44572 100644
--- a/em-format/e-mail-parser-multipart-digest.c
+++ b/em-format/e-mail-parser-multipart-digest.c
@@ -117,18 +117,12 @@ empe_mp_digest_parse (EMailParserExtension *extension,
return TRUE;
}
-static guint32
-empe_mp_digest_get_flags (EMailParserExtension *extension)
-{
- return E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
-}
-
static void
e_mail_parser_multipart_digest_class_init (EMailParserExtensionClass *class)
{
class->mime_types = parser_mime_types;
+ class->flags = E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
class->parse = empe_mp_digest_parse;
- class->get_flags = empe_mp_digest_get_flags;
}
static void
diff --git a/em-format/e-mail-parser-multipart-mixed.c b/em-format/e-mail-parser-multipart-mixed.c
index 67671afc1d..6a202bd889 100644
--- a/em-format/e-mail-parser-multipart-mixed.c
+++ b/em-format/e-mail-parser-multipart-mixed.c
@@ -115,18 +115,12 @@ empe_mp_mixed_parse (EMailParserExtension *extension,
return TRUE;
}
-static guint32
-empe_mp_mixed_get_flags (EMailParserExtension *extension)
-{
- return E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
-}
-
static void
e_mail_parser_multipart_mixed_class_init (EMailParserExtensionClass *class)
{
class->mime_types = parser_mime_types;
+ class->flags = E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE;
class->parse = empe_mp_mixed_parse;
- class->get_flags = empe_mp_mixed_get_flags;
}
static void
diff --git a/em-format/e-mail-part-utils.c b/em-format/e-mail-part-utils.c
index 6f8013d7a8..665a7b5996 100644
--- a/em-format/e-mail-part-utils.c
+++ b/em-format/e-mail-part-utils.c
@@ -533,15 +533,17 @@ e_mail_part_is_inline (CamelMimePart *mime_part,
{
const gchar *disposition;
EMailParserExtension *extension;
+ EMailParserExtensionClass *class;
if ((extensions == NULL) || g_queue_is_empty (extensions))
return FALSE;
extension = g_queue_peek_head (extensions);
+ class = E_MAIL_PARSER_EXTENSION_GET_CLASS (extension);
+
/* Some types need to override the disposition.
* e.g. application/x-pkcs7-mime */
- if (e_mail_parser_extension_get_flags (extension) &
- E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION)
+ if (class->flags & E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION)
return TRUE;
disposition = camel_mime_part_get_disposition (mime_part);
@@ -549,6 +551,5 @@ e_mail_part_is_inline (CamelMimePart *mime_part,
return g_ascii_strcasecmp (disposition, "inline") == 0;
/* Otherwise, use the default for this handler type. */
- return (e_mail_parser_extension_get_flags (extension) &
- E_MAIL_PARSER_EXTENSION_INLINE) != 0;
+ return (class->flags & E_MAIL_PARSER_EXTENSION_INLINE) != 0;
}