]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Support GMIME 3.0
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>
Thu, 3 Aug 2017 18:13:01 +0000 (14:13 -0400)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Fri, 4 Aug 2017 14:44:07 +0000 (09:44 -0500)
Support building the Asterisk httpd with version 3.0 of gmime as
well as earlier versions of that library.

ASTERISK-27173

Change-Id: I7e13dd05a3083ccb0df2dabf83110223f6a9fa8f

configure
configure.ac
res/res_http_post.c

index 5507d87f333436913859253a21225a167b1cf9b7..d72e5801745c4107c0065b95c0c675c0c066ffd7 100755 (executable)
--- a/configure
+++ b/configure
@@ -34016,7 +34016,7 @@ fi
     fi
 fi
 
-for ver in 2.0 2.2 2.4 2.6; do
+for ver in 2.0 2.2 2.4 2.6 3.0; do
 
    if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
 
index bf875a29de744ef83ce85502d714514abdf3b74e..ca60fab2402737dbc5c065fd3d0ea5cf94ba8576 100644 (file)
@@ -2512,7 +2512,7 @@ then
     fi
 fi
 
-for ver in 2.0 2.2 2.4 2.6; do
+for ver in 2.0 2.2 2.4 2.6 3.0; do
        AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver)
        if test "$PBX_GMIME" = 1; then
                break;
index 37fc4fa091ca603459363cc4169e2f6d35f799e7..10db6756fd448b45947e029b2750834033c25e1c 100644 (file)
@@ -57,6 +57,9 @@ ASTERISK_REGISTER_FILE()
 #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 {
@@ -86,7 +89,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);
 
@@ -109,7 +116,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);
 
@@ -488,7 +499,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);