diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-09-09 21:44:55 -0400 |
---|---|---|
committer | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-09-09 21:44:55 -0400 |
commit | 3efc24a6cdc88198e11e43f23e03e32f12b13bd8 (patch) | |
tree | 181fcccf3d338cae905c6505c5aff8c7e98e4d34 | |
parent | e83530afd378b6c913d7bbe614e41cc4eb4ad62f (diff) | |
download | gmime-3efc24a6cdc88198e11e43f23e03e32f12b13bd8.tar.gz |
Added g_mime_object_write_contyent_to_stream()
Fixes issue #97
-rw-r--r-- | gmime/gmime-object.c | 21 | ||||
-rw-r--r-- | gmime/gmime-object.h | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/gmime/gmime-object.c b/gmime/gmime-object.c index 8d11cee1..861a0191 100644 --- a/gmime/gmime-object.c +++ b/gmime/gmime-object.c @@ -975,7 +975,7 @@ object_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, gboole * @options: (nullable): a #GMimeFormatOptions or %NULL * @stream: stream * - * Write the contents of the MIME object to @stream. + * Write the headers and content of the MIME object to @stream. * * Returns: the number of bytes written or %-1 on fail. **/ @@ -989,6 +989,25 @@ g_mime_object_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, } +/** + * g_mime_object_write_content_to_stream: + * @object: a #GMimeObject + * @options: (nullable): a #GMimeFormatOptions or %NULL + * @stream: stream + * + * Write only the content of the MIME object to @stream. + * + * Returns: the number of bytes written or %-1 on fail. + **/ +ssize_t +g_mime_object_write_content_to_stream (GMimeObject *object, GMimeFormatOptions *options, GMimeStream *stream) +{ + g_return_val_if_fail (GMIME_IS_OBJECT (object), -1); + g_return_val_if_fail (GMIME_IS_STREAM (stream), -1); + + return GMIME_OBJECT_GET_CLASS (object)->write_to_stream (object, options, TRUE, stream); +} + static void object_encode (GMimeObject *object, GMimeEncodingConstraint constraint) { diff --git a/gmime/gmime-object.h b/gmime/gmime-object.h index c258de57..1852c9b5 100644 --- a/gmime/gmime-object.h +++ b/gmime/gmime-object.h @@ -134,6 +134,7 @@ GMimeHeaderList *g_mime_object_get_header_list (GMimeObject *object); char *g_mime_object_get_headers (GMimeObject *object, GMimeFormatOptions *options); ssize_t g_mime_object_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, GMimeStream *stream); +ssize_t g_mime_object_write_content_to_stream (GMimeObject *object, GMimeFormatOptions *options, GMimeStream *stream); char *g_mime_object_to_string (GMimeObject *object, GMimeFormatOptions *options); void g_mime_object_encode (GMimeObject *object, GMimeEncodingConstraint constraint); |