[evolution-data-server] Add camel_mime_parser_init_with_bytes().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Add camel_mime_parser_init_with_bytes().
- Date: Thu, 6 Feb 2014 18:46:12 +0000 (UTC)
commit 14c7d713955d67122ba14ee6b5ec02b059fd88ab
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Feb 6 13:03:12 2014 -0500
Add camel_mime_parser_init_with_bytes().
Convenience function creates a GMemoryInputStream from a GBytes
and hands it off to camel_mime_parser_init_with_input_stream().
camel/camel-mime-parser.c | 24 ++++++++++++++++++++++++
camel/camel-mime-parser.h | 1 +
docs/reference/camel/camel-sections.txt | 1 +
3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index 13f81e9..934be86 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -498,6 +498,30 @@ camel_mime_parser_init_with_input_stream (CamelMimeParser *parser,
}
/**
+ * camel_mime_parser_init_with_bytes:
+ * @parser: a #CamelMimeParser
+ * @bytes: a #GBytes containing the message content
+ *
+ * Convenience function creates a #GMemoryInputStream from @bytes and hands
+ * it off to camel_mime_parser_init_with_input_stream().
+ *
+ * Since: 3.12
+ **/
+void
+camel_mime_parser_init_with_bytes (CamelMimeParser *parser,
+ GBytes *bytes)
+{
+ GInputStream *input_stream;
+
+ g_return_if_fail (CAMEL_IS_MIME_PARSER (parser));
+ g_return_if_fail (bytes != NULL);
+
+ input_stream = g_memory_input_stream_new_from_bytes (bytes);
+ camel_mime_parser_init_with_input_stream (parser, input_stream);
+ g_object_unref (input_stream);
+}
+
+/**
* camel_mime_parser_scan_from:
* @parser: MIME parser object
* @scan_from: %TRUE if the scanner should scan From lines.
diff --git a/camel/camel-mime-parser.h b/camel/camel-mime-parser.h
index 7b5dd94..c44427b 100644
--- a/camel/camel-mime-parser.h
+++ b/camel/camel-mime-parser.h
@@ -100,6 +100,7 @@ gint camel_mime_parser_errno (CamelMimeParser *parser);
gint camel_mime_parser_init_with_fd (CamelMimeParser *m, gint fd);
gint camel_mime_parser_init_with_stream (CamelMimeParser *m, CamelStream *stream, GError **error);
void camel_mime_parser_init_with_input_stream (CamelMimeParser *parser, GInputStream
*input_stream);
+void camel_mime_parser_init_with_bytes (CamelMimeParser *parser, GBytes *bytes);
CamelStream *camel_mime_parser_stream (CamelMimeParser *parser);
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 8f2c7c5..cfa4aab 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -1226,6 +1226,7 @@ camel_mime_parser_errno
camel_mime_parser_init_with_fd
camel_mime_parser_init_with_stream
camel_mime_parser_init_with_input_stream
+camel_mime_parser_init_with_bytes
camel_mime_parser_stream
camel_mime_parser_scan_from
camel_mime_parser_scan_pre_from
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]