summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2017-08-03 14:13:01 -0400
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2017-08-03 14:15:26 -0400
commit123c93a77c5411f0d8686d454640ae3e619fd658 (patch)
treefeeba6dd2efb45ae88e52e3f7f8c32e85eec6c96 /res
parent2be8d91c0f5802a1f9c87b35f8f419e0db1b22d8 (diff)
Support GMIME 3.0
Support building the Asterisk httpd with version 3.0 of gmime as well as earlier versions of that library. ASTERISK-27173 Change-Id: I7e13dd05a3083ccb0df2dabf83110223f6a9fa8f
Diffstat (limited to 'res')
-rw-r--r--res/res_http_post.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/res/res_http_post.c b/res/res_http_post.c
index 3f0a58e36..9f5b1837a 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -55,6 +55,9 @@
#ifdef GMIME_TYPE_CONTENT_TYPE
#define AST_GMIME_VER_24
#endif
+#if GMIME_MAJOR_VERSION >= 3
+#define AST_GMIME_VER_30
+#endif
/* just a little structure to hold callback info for gmime */
struct mime_cbinfo {
@@ -84,7 +87,11 @@ static void post_raw(GMimePart *part, const char *post_dir, const char *fn)
stream = g_mime_stream_fs_new(fd);
+#ifdef AST_GMIME_VER_30
+ content = g_mime_part_get_content(part);
+#else
content = g_mime_part_get_content_object(part);
+#endif
g_mime_data_wrapper_write_to_stream(content, stream);
g_mime_stream_flush(stream);
@@ -107,7 +114,11 @@ static GMimeMessage *parse_message(FILE *f)
g_object_unref(stream);
- message = g_mime_parser_construct_message(parser);
+ message = g_mime_parser_construct_message(parser
+#ifdef AST_GMIME_VER_30
+ , NULL
+#endif
+ );
g_object_unref(parser);
@@ -486,7 +497,11 @@ static int reload(void)
static int load_module(void)
{
- g_mime_init(0);
+ g_mime_init(
+#ifndef AST_GMIME_VER_30
+ 0
+#endif
+ );
__ast_http_post_load(0);