Support gmime-2.4

(closes issue #18863)
Reported by: tzafrir
Patches:
      gmime-2.4-18.diff uploaded by tzafrir (license 46)
      Tested by: tzafrir

Review: https://reviewboard.asterisk.org/r/1213/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@319085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Paul Belanger
2011-05-16 14:35:21 +00:00
parent d75f80fe08
commit e8935ca8e4
4 changed files with 7823 additions and 33348 deletions

41072
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1995,18 +1995,17 @@ fi
AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);]) AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
if test "x${PBX_GMIME}" = "x0"; then if test "x${PBX_GMIME}" = "x0"; then
# Later versions of GMime use pkg-config # Later versions of GMime use pkg-config
if test "x${PKGCONFIG}" = xNo; then :; else for ver in 2.0 2.2 2.4; do
GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.0 --cflags 2>/dev/null) if ! ${PKGCONFIG} --exists gmime-$ver; then
GMIME_LIB=$(${PKGCONFIG} gmime-2.0 --libs) continue
if test "x${GMIME_INCLUDE}${GMIME_LIB}" = "x"; then
GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.2 --cflags 2>/dev/null)
GMIME_LIB=$(${PKGCONFIG} gmime-2.2 --libs)
fi fi
if test "x${GMIME_INCLUDE}${GMIME_LIB}" != "x"; then # If we got here, we have this version:
PBX_GMIME=1 GMIME_INCLUDE=$(${PKGCONFIG} gmime-$ver --cflags 2>/dev/null)
AC_DEFINE([HAVE_GMIME], 1, [Define if your system has the GMIME libraries.]) GMIME_LIB=$(${PKGCONFIG} gmime-$ver --libs)
fi PBX_GMIME=1
fi AC_DEFINE([HAVE_GMIME], 1, [Define if your system has the GMIME libraries.])
break;
done
fi fi
AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], []) AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])

View File

@@ -819,16 +819,16 @@
/* Define to 1 if you have the `strtoq' function. */ /* Define to 1 if you have the `strtoq' function. */
#undef HAVE_STRTOQ #undef HAVE_STRTOQ
/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */ /* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
/* Define to 1 if `st_blksize' is member of `struct stat'. */ /* Define to 1 if `st_blksize' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE #undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if `cr_uid' is member of `struct ucred'. */ /* Define to 1 if `cr_uid' is a member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_CR_UID #undef HAVE_STRUCT_UCRED_CR_UID
/* Define to 1 if `uid' is member of `struct ucred'. */ /* Define to 1 if `uid' is a member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_UID #undef HAVE_STRUCT_UCRED_UID
/* Define to 1 if you have the mISDN Supplemental Services library. */ /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1103,12 +1103,12 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES
/* Define to necessary symbol if this constant uses a non-standard name on /* Define to necessary symbol if this constant uses a non-standard name on
your system. */ your system. */
#undef PTHREAD_CREATE_JOINABLE #undef PTHREAD_CREATE_JOINABLE
@@ -1128,11 +1128,6 @@
/* Define to the type of arg 5 for `select'. */ /* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5 #undef SELECT_TYPE_ARG5
/* Define to 1 if the `setvbuf' function takes the buffering type as its
second argument and the buffer pointer as the third, as on System V before
release 3. */
#undef SETVBUF_REVERSED
/* The size of `char *', as computed by sizeof. */ /* The size of `char *', as computed by sizeof. */
#undef SIZEOF_CHAR_P #undef SIZEOF_CHAR_P
@@ -1168,12 +1163,27 @@
/* Define to a type of the same size as fd_set.fds_bits[[0]] */ /* Define to a type of the same size as fd_set.fds_bits[[0]] */
#undef TYPEOF_FD_SET_FDS_BITS #undef TYPEOF_FD_SET_FDS_BITS
/* Define to 1 if on AIX 3. /* Enable extensions on AIX 3, Interix. */
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE #ifndef _ALL_SOURCE
# undef _ALL_SOURCE # undef _ALL_SOURCE
#endif #endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if running on Darwin. */ /* Define to 1 if running on Darwin. */
#undef _DARWIN_UNLIMITED_SELECT #undef _DARWIN_UNLIMITED_SELECT
@@ -1181,11 +1191,6 @@
/* Number of bits in a file offset, on hosts where this is settable. */ /* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS #undef _FILE_OFFSET_BITS
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE #undef _LARGEFILE_SOURCE
@@ -1202,20 +1207,6 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */ /* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE #undef _POSIX_SOURCE
/* Enable extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Define like PROTOTYPES; this can be used by system headers. */
#undef __PROTOTYPES
/* Define to empty if `const' does not conform to ANSI C. */ /* Define to empty if `const' does not conform to ANSI C. */
#undef const #undef const

View File

@@ -52,6 +52,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define MAX_PREFIX 80 #define MAX_PREFIX 80
/* gmime 2.4 provides a newer interface. */
#ifdef GMIME_TYPE_CONTENT_TYPE
#define AST_GMIME_VER_24
#endif
/* just a little structure to hold callback info for gmime */ /* just a little structure to hold callback info for gmime */
struct mime_cbinfo { struct mime_cbinfo {
int count; int count;
@@ -84,7 +89,9 @@ static void post_raw(GMimePart *part, const char *post_dir, const char *fn)
g_mime_data_wrapper_write_to_stream(content, stream); g_mime_data_wrapper_write_to_stream(content, stream);
g_mime_stream_flush(stream); g_mime_stream_flush(stream);
#ifndef AST_GMIME_VER_24
g_object_unref(content); g_object_unref(content);
#endif
g_object_unref(stream); g_object_unref(stream);
} }
@@ -108,7 +115,11 @@ static GMimeMessage *parse_message(FILE *f)
return message; return message;
} }
#ifdef AST_GMIME_VER_24
static void process_message_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data)
#else
static void process_message_callback(GMimeObject *part, gpointer user_data) static void process_message_callback(GMimeObject *part, gpointer user_data)
#endif
{ {
struct mime_cbinfo *cbinfo = user_data; struct mime_cbinfo *cbinfo = user_data;
@@ -122,6 +133,7 @@ static void process_message_callback(GMimeObject *part, gpointer user_data)
ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PARTIAL\n"); ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PARTIAL\n");
return; return;
} else if (GMIME_IS_MULTIPART(part)) { } else if (GMIME_IS_MULTIPART(part)) {
#ifndef AST_GMIME_VER_24
GList *l; GList *l;
ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n"); ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
@@ -130,6 +142,9 @@ static void process_message_callback(GMimeObject *part, gpointer user_data)
process_message_callback(l->data, cbinfo); process_message_callback(l->data, cbinfo);
l = l->next; l = l->next;
} }
#else
ast_log(LOG_WARNING, "Got unexpected MIME subpart.\n");
#endif
} else if (GMIME_IS_PART(part)) { } else if (GMIME_IS_PART(part)) {
const char *filename; const char *filename;
@@ -151,7 +166,11 @@ static int process_message(GMimeMessage *message, const char *post_dir)
.post_dir = post_dir, .post_dir = post_dir,
}; };
#ifdef AST_GMIME_VER_24
g_mime_message_foreach(message, process_message_callback, &cbinfo);
#else
g_mime_message_foreach_part(message, process_message_callback, &cbinfo); g_mime_message_foreach_part(message, process_message_callback, &cbinfo);
#endif
return cbinfo.count; return cbinfo.count;
} }