mirror of https://git.wownero.com/dsc/mxe.git
upgrade package vmime
This commit is contained in:
parent
bbee76e2c1
commit
481ba6cabe
|
@ -1,640 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN b/m4/lib-link.m4 c/m4/lib-link.m4
|
||||
--- b/m4/lib-link.m4 2008-01-05 18:49:17.000000000 +0100
|
||||
+++ c/m4/lib-link.m4 2010-02-15 10:38:53.572219098 +0100
|
||||
@@ -1,17 +1,19 @@
|
||||
-# lib-link.m4 serial 6 (gettext-0.14.3)
|
||||
-dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
|
||||
+# lib-link.m4 serial 13 (gettext-0.17)
|
||||
+dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
-AC_PREREQ(2.50)
|
||||
+AC_PREREQ(2.54)
|
||||
|
||||
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
|
||||
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
|
||||
dnl augments the CPPFLAGS variable.
|
||||
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
|
||||
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
@@ -24,13 +26,16 @@
|
||||
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
|
||||
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
|
||||
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
|
||||
+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
|
||||
])
|
||||
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
|
||||
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
|
||||
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
|
||||
+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||
AC_SUBST([LIB]NAME)
|
||||
AC_SUBST([LTLIB]NAME)
|
||||
+ AC_SUBST([LIB]NAME[_PREFIX])
|
||||
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
|
||||
dnl results of this search when this library appears as a dependency.
|
||||
HAVE_LIB[]NAME=yes
|
||||
@@ -46,6 +51,8 @@
|
||||
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
|
||||
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
|
||||
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
|
||||
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
|
||||
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
@@ -82,17 +89,23 @@
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
LIB[]NAME=
|
||||
LTLIB[]NAME=
|
||||
+ LIB[]NAME[]_PREFIX=
|
||||
fi
|
||||
AC_SUBST([HAVE_LIB]NAME)
|
||||
AC_SUBST([LIB]NAME)
|
||||
AC_SUBST([LTLIB]NAME)
|
||||
+ AC_SUBST([LIB]NAME[_PREFIX])
|
||||
undefine([Name])
|
||||
undefine([NAME])
|
||||
])
|
||||
|
||||
dnl Determine the platform dependent parameters needed to use rpath:
|
||||
-dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
|
||||
-dnl hardcode_direct, hardcode_minus_L.
|
||||
+dnl acl_libext,
|
||||
+dnl acl_shlibext,
|
||||
+dnl acl_hardcode_libdir_flag_spec,
|
||||
+dnl acl_hardcode_libdir_separator,
|
||||
+dnl acl_hardcode_direct,
|
||||
+dnl acl_hardcode_minus_L.
|
||||
AC_DEFUN([AC_LIB_RPATH],
|
||||
[
|
||||
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
|
||||
@@ -109,12 +122,14 @@
|
||||
acl_cv_rpath=done
|
||||
])
|
||||
wl="$acl_cv_wl"
|
||||
- libext="$acl_cv_libext"
|
||||
- shlibext="$acl_cv_shlibext"
|
||||
- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
|
||||
- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
|
||||
- hardcode_direct="$acl_cv_hardcode_direct"
|
||||
- hardcode_minus_L="$acl_cv_hardcode_minus_L"
|
||||
+ acl_libext="$acl_cv_libext"
|
||||
+ acl_shlibext="$acl_cv_shlibext"
|
||||
+ acl_libname_spec="$acl_cv_libname_spec"
|
||||
+ acl_library_names_spec="$acl_cv_library_names_spec"
|
||||
+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
|
||||
+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
|
||||
+ acl_hardcode_direct="$acl_cv_hardcode_direct"
|
||||
+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
|
||||
dnl Determine whether the user wants rpath handling at all.
|
||||
AC_ARG_ENABLE(rpath,
|
||||
[ --disable-rpath do not hardcode runtime library paths],
|
||||
@@ -124,19 +139,24 @@
|
||||
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
|
||||
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
|
||||
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
|
||||
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
||||
[
|
||||
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
+ dnl Autoconf >= 2.61 supports dots in --with options.
|
||||
+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
|
||||
dnl By default, look in $includedir and $libdir.
|
||||
use_additional=yes
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
- AC_LIB_ARG_WITH([lib$1-prefix],
|
||||
-[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
|
||||
- --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
|
||||
+ AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
|
||||
+[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
|
||||
+ --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
|
||||
[
|
||||
if test "X$withval" = "Xno"; then
|
||||
use_additional=no
|
||||
@@ -148,7 +168,7 @@
|
||||
])
|
||||
else
|
||||
additional_includedir="$withval/include"
|
||||
- additional_libdir="$withval/lib"
|
||||
+ additional_libdir="$withval/$acl_libdirstem"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
@@ -157,6 +177,7 @@
|
||||
LIB[]NAME=
|
||||
LTLIB[]NAME=
|
||||
INC[]NAME=
|
||||
+ LIB[]NAME[]_PREFIX=
|
||||
rpathdirs=
|
||||
ltrpathdirs=
|
||||
names_already_handled=
|
||||
@@ -196,22 +217,55 @@
|
||||
found_la=
|
||||
found_so=
|
||||
found_a=
|
||||
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
|
||||
+ if test -n "$acl_shlibext"; then
|
||||
+ shrext=".$acl_shlibext" # typically: shrext=.so
|
||||
+ else
|
||||
+ shrext=
|
||||
+ fi
|
||||
if test $use_additional = yes; then
|
||||
- if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
- found_dir="$additional_libdir"
|
||||
- found_so="$additional_libdir/lib$name.$shlibext"
|
||||
- if test -f "$additional_libdir/lib$name.la"; then
|
||||
- found_la="$additional_libdir/lib$name.la"
|
||||
- fi
|
||||
- else
|
||||
- if test -f "$additional_libdir/lib$name.$libext"; then
|
||||
- found_dir="$additional_libdir"
|
||||
- found_a="$additional_libdir/lib$name.$libext"
|
||||
- if test -f "$additional_libdir/lib$name.la"; then
|
||||
- found_la="$additional_libdir/lib$name.la"
|
||||
+ dir="$additional_libdir"
|
||||
+ dnl The same code as in the loop below:
|
||||
+ dnl First look for a shared library.
|
||||
+ if test -n "$acl_shlibext"; then
|
||||
+ if test -f "$dir/$libname$shrext"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_so="$dir/$libname$shrext"
|
||||
+ else
|
||||
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
|
||||
+ ver=`(cd "$dir" && \
|
||||
+ for f in "$libname$shrext".*; do echo "$f"; done \
|
||||
+ | sed -e "s,^$libname$shrext\\\\.,," \
|
||||
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
|
||||
+ | sed 1q ) 2>/dev/null`
|
||||
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_so="$dir/$libname$shrext.$ver"
|
||||
+ fi
|
||||
+ else
|
||||
+ eval library_names=\"$acl_library_names_spec\"
|
||||
+ for f in $library_names; do
|
||||
+ if test -f "$dir/$f"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_so="$dir/$f"
|
||||
+ break
|
||||
+ fi
|
||||
+ done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
+ dnl Then look for a static library.
|
||||
+ if test "X$found_dir" = "X"; then
|
||||
+ if test -f "$dir/$libname.$acl_libext"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_a="$dir/$libname.$acl_libext"
|
||||
+ fi
|
||||
+ fi
|
||||
+ if test "X$found_dir" != "X"; then
|
||||
+ if test -f "$dir/$libname.la"; then
|
||||
+ found_la="$dir/$libname.la"
|
||||
+ fi
|
||||
+ fi
|
||||
fi
|
||||
if test "X$found_dir" = "X"; then
|
||||
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||
@@ -219,21 +273,46 @@
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
- if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
- found_dir="$dir"
|
||||
- found_so="$dir/lib$name.$shlibext"
|
||||
- if test -f "$dir/lib$name.la"; then
|
||||
- found_la="$dir/lib$name.la"
|
||||
- fi
|
||||
- else
|
||||
- if test -f "$dir/lib$name.$libext"; then
|
||||
+ dnl First look for a shared library.
|
||||
+ if test -n "$acl_shlibext"; then
|
||||
+ if test -f "$dir/$libname$shrext"; then
|
||||
found_dir="$dir"
|
||||
- found_a="$dir/lib$name.$libext"
|
||||
- if test -f "$dir/lib$name.la"; then
|
||||
- found_la="$dir/lib$name.la"
|
||||
+ found_so="$dir/$libname$shrext"
|
||||
+ else
|
||||
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
|
||||
+ ver=`(cd "$dir" && \
|
||||
+ for f in "$libname$shrext".*; do echo "$f"; done \
|
||||
+ | sed -e "s,^$libname$shrext\\\\.,," \
|
||||
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
|
||||
+ | sed 1q ) 2>/dev/null`
|
||||
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_so="$dir/$libname$shrext.$ver"
|
||||
+ fi
|
||||
+ else
|
||||
+ eval library_names=\"$acl_library_names_spec\"
|
||||
+ for f in $library_names; do
|
||||
+ if test -f "$dir/$f"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_so="$dir/$f"
|
||||
+ break
|
||||
+ fi
|
||||
+ done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
+ dnl Then look for a static library.
|
||||
+ if test "X$found_dir" = "X"; then
|
||||
+ if test -f "$dir/$libname.$acl_libext"; then
|
||||
+ found_dir="$dir"
|
||||
+ found_a="$dir/$libname.$acl_libext"
|
||||
+ fi
|
||||
+ fi
|
||||
+ if test "X$found_dir" != "X"; then
|
||||
+ if test -f "$dir/$libname.la"; then
|
||||
+ found_la="$dir/$libname.la"
|
||||
+ fi
|
||||
+ fi
|
||||
;;
|
||||
esac
|
||||
if test "X$found_dir" != "X"; then
|
||||
@@ -248,7 +327,7 @@
|
||||
dnl Linking with a shared library. We attempt to hardcode its
|
||||
dnl directory into the executable's runpath, unless it's the
|
||||
dnl standard /usr/lib.
|
||||
- if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
|
||||
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
|
||||
dnl No hardcoding is needed.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
@@ -267,12 +346,12 @@
|
||||
ltrpathdirs="$ltrpathdirs $found_dir"
|
||||
fi
|
||||
dnl The hardcoding into $LIBNAME is system dependent.
|
||||
- if test "$hardcode_direct" = yes; then
|
||||
+ if test "$acl_hardcode_direct" = yes; then
|
||||
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
dnl resulting binary.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
- if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
|
||||
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
|
||||
dnl Use an explicit option to hardcode DIR into the resulting
|
||||
dnl binary.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
@@ -303,13 +382,13 @@
|
||||
if test -z "$haveit"; then
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
|
||||
fi
|
||||
- if test "$hardcode_minus_L" != no; then
|
||||
+ if test "$acl_hardcode_minus_L" != no; then
|
||||
dnl FIXME: Not sure whether we should use
|
||||
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||
dnl here.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
- dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
|
||||
+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
|
||||
dnl here, because this doesn't fit in flags passed to the
|
||||
dnl compiler. So give up. No hardcoding. This affects only
|
||||
dnl very old systems.
|
||||
@@ -334,8 +413,9 @@
|
||||
dnl Assume the include files are nearby.
|
||||
additional_includedir=
|
||||
case "$found_dir" in
|
||||
- */lib | */lib/)
|
||||
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
|
||||
+ */$acl_libdirstem | */$acl_libdirstem/)
|
||||
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
|
||||
+ LIB[]NAME[]_PREFIX="$basedir"
|
||||
additional_includedir="$basedir/include"
|
||||
;;
|
||||
esac
|
||||
@@ -396,9 +476,9 @@
|
||||
dnl 3. if it's already present in $LDFLAGS or the already
|
||||
dnl constructed $LIBNAME,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
- if test "X$additional_libdir" != "X/usr/lib"; then
|
||||
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
|
||||
haveit=
|
||||
- if test "X$additional_libdir" = "X/usr/local/lib"; then
|
||||
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
@@ -497,18 +577,18 @@
|
||||
done
|
||||
done
|
||||
if test "X$rpathdirs" != "X"; then
|
||||
- if test -n "$hardcode_libdir_separator"; then
|
||||
+ if test -n "$acl_hardcode_libdir_separator"; then
|
||||
dnl Weird platform: only the last -rpath option counts, the user must
|
||||
dnl pass all path elements in one option. We can arrange that for a
|
||||
dnl single library, but not when more than one $LIBNAMEs are used.
|
||||
alldirs=
|
||||
for found_dir in $rpathdirs; do
|
||||
- alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
|
||||
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
|
||||
done
|
||||
- dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
|
||||
+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$alldirs"
|
||||
- eval flag=\"$hardcode_libdir_flag_spec\"
|
||||
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||
else
|
||||
@@ -516,7 +596,7 @@
|
||||
for found_dir in $rpathdirs; do
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$found_dir"
|
||||
- eval flag=\"$hardcode_libdir_flag_spec\"
|
||||
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||
done
|
||||
@@ -551,3 +631,79 @@
|
||||
fi
|
||||
done
|
||||
])
|
||||
+
|
||||
+dnl For those cases where a variable contains several -L and -l options
|
||||
+dnl referring to unknown libraries and directories, this macro determines the
|
||||
+dnl necessary additional linker options for the runtime path.
|
||||
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
|
||||
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
|
||||
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
|
||||
+dnl otherwise linking without libtool is assumed.
|
||||
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
|
||||
+[
|
||||
+ AC_REQUIRE([AC_LIB_RPATH])
|
||||
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||
+ $1=
|
||||
+ if test "$enable_rpath" != no; then
|
||||
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
|
||||
+ dnl Use an explicit option to hardcode directories into the resulting
|
||||
+ dnl binary.
|
||||
+ rpathdirs=
|
||||
+ next=
|
||||
+ for opt in $2; do
|
||||
+ if test -n "$next"; then
|
||||
+ dir="$next"
|
||||
+ dnl No need to hardcode the standard /usr/lib.
|
||||
+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
|
||||
+ rpathdirs="$rpathdirs $dir"
|
||||
+ fi
|
||||
+ next=
|
||||
+ else
|
||||
+ case $opt in
|
||||
+ -L) next=yes ;;
|
||||
+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
|
||||
+ dnl No need to hardcode the standard /usr/lib.
|
||||
+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
|
||||
+ rpathdirs="$rpathdirs $dir"
|
||||
+ fi
|
||||
+ next= ;;
|
||||
+ *) next= ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ done
|
||||
+ if test "X$rpathdirs" != "X"; then
|
||||
+ if test -n ""$3""; then
|
||||
+ dnl libtool is used for linking. Use -R options.
|
||||
+ for dir in $rpathdirs; do
|
||||
+ $1="${$1}${$1:+ }-R$dir"
|
||||
+ done
|
||||
+ else
|
||||
+ dnl The linker is used for linking directly.
|
||||
+ if test -n "$acl_hardcode_libdir_separator"; then
|
||||
+ dnl Weird platform: only the last -rpath option counts, the user
|
||||
+ dnl must pass all path elements in one option.
|
||||
+ alldirs=
|
||||
+ for dir in $rpathdirs; do
|
||||
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
|
||||
+ done
|
||||
+ acl_save_libdir="$libdir"
|
||||
+ libdir="$alldirs"
|
||||
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
+ libdir="$acl_save_libdir"
|
||||
+ $1="$flag"
|
||||
+ else
|
||||
+ dnl The -rpath options are cumulative.
|
||||
+ for dir in $rpathdirs; do
|
||||
+ acl_save_libdir="$libdir"
|
||||
+ libdir="$dir"
|
||||
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
+ libdir="$acl_save_libdir"
|
||||
+ $1="${$1}${$1:+ }$flag"
|
||||
+ done
|
||||
+ fi
|
||||
+ fi
|
||||
+ fi
|
||||
+ fi
|
||||
+ fi
|
||||
+ AC_SUBST([$1])
|
||||
+])
|
||||
diff -urN b/m4/lib-prefix.m4 c/m4/lib-prefix.m4
|
||||
--- b/m4/lib-prefix.m4 2008-01-05 18:49:17.000000000 +0100
|
||||
+++ c/m4/lib-prefix.m4 2010-02-15 10:39:25.710466533 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-# lib-prefix.m4 serial 4 (gettext-0.14.2)
|
||||
+# lib-prefix.m4 serial 5 (gettext-0.15)
|
||||
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -24,6 +24,7 @@
|
||||
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
dnl By default, look in $includedir and $libdir.
|
||||
use_additional=yes
|
||||
@@ -45,7 +46,7 @@
|
||||
])
|
||||
else
|
||||
additional_includedir="$withval/include"
|
||||
- additional_libdir="$withval/lib"
|
||||
+ additional_libdir="$withval/$acl_libdirstem"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
@@ -87,7 +88,7 @@
|
||||
dnl 2. if it's already present in $LDFLAGS,
|
||||
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
- if test "X$additional_libdir" != "X/usr/lib"; then
|
||||
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
|
||||
haveit=
|
||||
for x in $LDFLAGS; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
@@ -97,7 +98,7 @@
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
- if test "X$additional_libdir" = "X/usr/local/lib"; then
|
||||
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux*) haveit=yes;;
|
||||
@@ -151,3 +152,34 @@
|
||||
exec_prefix="$acl_save_exec_prefix"
|
||||
prefix="$acl_save_prefix"
|
||||
])
|
||||
+
|
||||
+dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
|
||||
+dnl the basename of the libdir, either "lib" or "lib64".
|
||||
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
|
||||
+[
|
||||
+ dnl There is no formal standard regarding lib and lib64. The current
|
||||
+ dnl practice is that on a system supporting 32-bit and 64-bit instruction
|
||||
+ dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
|
||||
+ dnl libraries go under $prefix/lib. We determine the compiler's default
|
||||
+ dnl mode by looking at the compiler's library search path. If at least
|
||||
+ dnl of its elements ends in /lib64 or points to a directory whose absolute
|
||||
+ dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
|
||||
+ dnl default, namely "lib".
|
||||
+ acl_libdirstem=lib
|
||||
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
|
||||
+ if test -n "$searchpath"; then
|
||||
+ acl_save_IFS="${IFS= }"; IFS=":"
|
||||
+ for searchdir in $searchpath; do
|
||||
+ if test -d "$searchdir"; then
|
||||
+ case "$searchdir" in
|
||||
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
|
||||
+ *) searchdir=`cd "$searchdir" && pwd`
|
||||
+ case "$searchdir" in
|
||||
+ */lib64 ) acl_libdirstem=lib64 ;;
|
||||
+ esac ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ done
|
||||
+ IFS="$acl_save_IFS"
|
||||
+ fi
|
||||
+])
|
||||
diff -urN b/SConstruct c/SConstruct
|
||||
--- b/SConstruct 2010-02-15 10:42:41.522349056 +0100
|
||||
+++ c/SConstruct 2010-02-15 10:38:27.636218961 +0100
|
||||
@@ -459,15 +459,15 @@
|
||||
|
||||
|
||||
# Command line options
|
||||
-opts = Options('options.cache')
|
||||
+opts = Variables('options.cache')
|
||||
|
||||
-opts.AddOptions(
|
||||
+opts.AddVariables(
|
||||
(
|
||||
'prefix',
|
||||
'Installation prefix directory',
|
||||
'/usr'
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'debug',
|
||||
'Debug version (useful for developers only)',
|
||||
'no',
|
||||
@@ -475,7 +475,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'with_messaging',
|
||||
'Messaging support (connection to mail store/transport servers)',
|
||||
'yes',
|
||||
@@ -483,7 +483,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'with_filesystem',
|
||||
'Enable file-system support (this is needed for "maildir" messaging support)',
|
||||
'yes',
|
||||
@@ -509,7 +509,7 @@
|
||||
+ 'Currently available platform handlers: posix.',
|
||||
'"posix"'
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'with_sasl',
|
||||
'Enable SASL support (requires GNU SASL library)',
|
||||
'yes',
|
||||
@@ -517,7 +517,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'with_tls',
|
||||
'Enable TLS support (requires GNU TLS library)',
|
||||
'yes',
|
||||
@@ -530,7 +530,7 @@
|
||||
'Specifies the path to sendmail.',
|
||||
defaultSendmailPath
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'byte_order',
|
||||
'Byte order (Big Endian or Little Endian)',
|
||||
sys.byteorder,
|
||||
@@ -538,7 +538,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'pf_8bit_type',
|
||||
'The C-language 8-bit type for your platform',
|
||||
'char',
|
||||
@@ -546,7 +546,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'pf_16bit_type',
|
||||
'The C-language 16-bit type for your platform',
|
||||
'short',
|
||||
@@ -554,7 +554,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'pf_32bit_type',
|
||||
'The C-language 32-bit type for your platform',
|
||||
'int',
|
||||
@@ -562,7 +562,7 @@
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
- EnumOption(
|
||||
+ EnumVariable(
|
||||
'build_tests',
|
||||
'Build unit tests (run with "scons run-tests")',
|
||||
'no',
|
||||
@@ -1364,7 +1364,7 @@
|
||||
$CXX -c $CFLAGS $CPPFLAGS mytest.$ac_ext >&5
|
||||
sh libtool --mode=link $CXX -o mytest mytest.o libtest.la >&5 2>/dev/null
|
||||
|
||||
-if test -x mytest; then
|
||||
+if test -x mytest -a "$cross_compiling" != yes; then
|
||||
myresult=`./mytest`
|
||||
if test "X$myresult" = "XPASS"; then
|
||||
AC_MSG_RESULT(yes)
|
|
@ -1,12 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/bootstrap b/bootstrap
|
||||
--- a/bootstrap 2010-02-18 02:25:13.325568851 +0100
|
||||
+++ b/bootstrap 2010-02-18 02:26:04.310693246 +0100
|
||||
@@ -1,4 +1,5 @@
|
||||
#! /bin/bash
|
||||
+#! /usr/bin/env bash
|
||||
#
|
||||
# Bootstrap file for 'autotools' build
|
||||
#
|
|
@ -1,65 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/bootstrap b/bootstrap
|
||||
--- a/bootstrap 2010-03-12 09:49:06.176332875 +0100
|
||||
+++ b/bootstrap 2010-03-12 09:50:54.138458453 +0100
|
||||
@@ -13,6 +13,13 @@
|
||||
(mkdir autotools >& /dev/null)
|
||||
(cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile ltmain.sh depcomp install-sh)
|
||||
|
||||
+# Check for "glibtoolize" instead of "libtoolize" on OSX
|
||||
+LIBTOOLIZE=libtoolize
|
||||
+if which glibtoolize > /dev/null 2>&1; then
|
||||
+ LIBTOOLIZE=glibtoolize
|
||||
+fi
|
||||
+
|
||||
+
|
||||
DIE=0
|
||||
|
||||
echo ""
|
||||
@@ -36,7 +43,7 @@
|
||||
fi
|
||||
|
||||
if test $DIE = 0 ; then
|
||||
- echo -n "* Running libtoolize... " ; (libtoolize --copy --force --automake >& bootstrap.tmpout) \
|
||||
+ echo -n "* Running libtoolize... " ; ($LIBTOOLIZE --copy --force --automake >& bootstrap.tmpout) \
|
||||
&& (echo "[OK]" ; cat bootstrap.tmpout ; rm -f bootstrap.tmpout) \
|
||||
|| (echo "[NO]" ; cat bootstrap.tmpout ; rm -f bootstrap.tmpout ; not_a_command >& /dev/null) || DIE=1
|
||||
fi
|
||||
diff -urN a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/defaultSASLAuthenticator.cpp
|
||||
--- a/src/security/sasl/defaultSASLAuthenticator.cpp 2010-03-12 09:48:28.343325021 +0100
|
||||
+++ b/src/security/sasl/defaultSASLAuthenticator.cpp 2010-03-12 09:50:54.138458453 +0100
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
const string defaultSASLAuthenticator::getServiceName() const
|
||||
{
|
||||
- return m_saslSession->getServiceName();
|
||||
+ return m_saslSession.acquire()->getServiceName();
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
ref <SASLSession> defaultSASLAuthenticator::getSASLSession() const
|
||||
{
|
||||
- return m_saslSession;
|
||||
+ return m_saslSession.acquire().constCast <SASLSession>();
|
||||
}
|
||||
|
||||
|
||||
diff -urN a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sasl/defaultSASLAuthenticator.hpp
|
||||
--- a/vmime/security/sasl/defaultSASLAuthenticator.hpp 2010-03-12 09:48:28.373325002 +0100
|
||||
+++ b/vmime/security/sasl/defaultSASLAuthenticator.hpp 2010-03-12 09:50:54.138458453 +0100
|
||||
@@ -67,10 +67,8 @@
|
||||
|
||||
defaultAuthenticator m_default;
|
||||
|
||||
-
|
||||
weak_ref <net::service> m_service;
|
||||
-
|
||||
- ref <SASLSession> m_saslSession;
|
||||
+ weak_ref <SASLSession> m_saslSession;
|
||||
ref <SASLMechanism> m_saslMech;
|
||||
};
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN b/SConstruct c/SConstruct
|
||||
--- b/SConstruct 2010-03-29 00:54:38.397987385 +0200
|
||||
+++ c/SConstruct 2010-03-29 00:57:19.822986846 +0200
|
||||
@@ -436,7 +436,7 @@
|
||||
# Set options #
|
||||
#################
|
||||
|
||||
-EnsureSConsVersion(0, 94)
|
||||
+EnsureSConsVersion(0, 98, 1)
|
||||
|
||||
SetOption('implicit_cache', 1)
|
||||
|
||||
@@ -578,7 +578,10 @@
|
||||
# Configuration Environment #
|
||||
###############################
|
||||
|
||||
-env = Environment(options = opts)
|
||||
+try:
|
||||
+ env = Environment(variables = opts)
|
||||
+except TypeError:
|
||||
+ env = Environment(options = opts)
|
||||
|
||||
env.Append(ENV = os.environ)
|
||||
env.Append(ENV = {'PATH' : os.environ['PATH']})
|
||||
@@ -953,7 +956,7 @@
|
||||
# Tests
|
||||
if env['build_tests'] == 'yes':
|
||||
if env['debug'] == 'yes':
|
||||
- env = env.Copy()
|
||||
+ env = env.Clone()
|
||||
env.Append(LIBS = ['cppunit', 'dl', packageVersionedGenericName + '-debug', 'pthread'])
|
||||
env.Append(LIBPATH=['.'])
|
||||
Default(
|
||||
diff -urN b/src/mailbox.cpp c/src/mailbox.cpp
|
||||
--- b/src/mailbox.cpp 2010-03-29 00:54:29.510858398 +0200
|
||||
+++ c/src/mailbox.cpp 2010-03-29 00:57:19.822986846 +0200
|
||||
@@ -311,7 +311,7 @@
|
||||
// (email address is mandatory, whereas name is optional).
|
||||
if (address.empty() && !name.empty())
|
||||
{
|
||||
- m_email.empty();
|
||||
+ m_email.clear();
|
||||
m_email.reserve(name.size());
|
||||
m_name.removeAllWords();
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
else
|
||||
{
|
||||
text::decodeAndUnfold(name, &m_name);
|
||||
- m_email.empty();
|
||||
+ m_email.clear();
|
||||
m_email.reserve(address.size());
|
||||
|
||||
for (string::size_type i = 0 ; i < address.size() ; ++i)
|
||||
diff -urN b/src/platforms/posix/posixFile.cpp c/src/platforms/posix/posixFile.cpp
|
||||
--- b/src/platforms/posix/posixFile.cpp 2010-03-29 00:54:29.522857280 +0200
|
||||
+++ c/src/platforms/posix/posixFile.cpp 2010-03-29 00:57:19.821867144 +0200
|
||||
@@ -306,6 +306,9 @@
|
||||
|
||||
if (::stat(m_nativePath.c_str(), &buf) == -1)
|
||||
{
|
||||
+ if (errno == ENOENT)
|
||||
+ return false;
|
||||
+
|
||||
posixFileSystemFactory::reportError(m_path, errno);
|
||||
return false;
|
||||
}
|
||||
@@ -320,6 +323,9 @@
|
||||
|
||||
if (::stat(m_nativePath.c_str(), &buf) == -1)
|
||||
{
|
||||
+ if (errno == ENOENT)
|
||||
+ return false;
|
||||
+
|
||||
posixFileSystemFactory::reportError(m_path, errno);
|
||||
return false;
|
||||
}
|
||||
@@ -334,6 +340,9 @@
|
||||
|
||||
if (::stat(m_nativePath.c_str(), &buf) == -1)
|
||||
{
|
||||
+ if (errno == ENOENT)
|
||||
+ return false;
|
||||
+
|
||||
posixFileSystemFactory::reportError(m_path, errno);
|
||||
return false;
|
||||
}
|
||||
@@ -349,6 +358,9 @@
|
||||
|
||||
if (::stat(m_nativePath.c_str(), &buf) == -1)
|
||||
{
|
||||
+ if (errno == ENOENT)
|
||||
+ return false;
|
||||
+
|
||||
posixFileSystemFactory::reportError(m_path, errno);
|
||||
return false;
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/bootstrap b/bootstrap
|
||||
--- a/bootstrap 2010-04-11 15:55:51.526807677 +0200
|
||||
+++ b/bootstrap 2010-04-11 16:02:47.027050352 +0200
|
||||
@@ -1,4 +1,3 @@
|
||||
-#! /bin/bash
|
||||
#! /usr/bin/env bash
|
||||
#
|
||||
# Bootstrap file for 'autotools' build
|
||||
diff -urN a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
|
||||
--- a/src/parameterizedHeaderField.cpp 2010-04-11 15:55:51.482792934 +0200
|
||||
+++ b/src/parameterizedHeaderField.cpp 2010-04-11 16:02:47.026046027 +0200
|
||||
@@ -85,12 +85,32 @@
|
||||
const string::value_type* const pstart = buffer.data() + position;
|
||||
const string::value_type* p = pstart;
|
||||
|
||||
- const string::size_type start = position;
|
||||
+ // Skip non-significant whitespaces
|
||||
+ string::size_type valueStart = position;
|
||||
|
||||
- while (p < pend && *p != ';') ++p;
|
||||
+ while (p < pend && parserHelpers::isSpace(*p))
|
||||
+ {
|
||||
+ ++p;
|
||||
+ ++valueStart;
|
||||
+ }
|
||||
|
||||
- getValue()->parse(buffer, start, position + (p - pstart));
|
||||
+ // Advance up to ';', if any
|
||||
+ string::size_type valueLength = 0;
|
||||
|
||||
+ while (p < pend && *p != ';') // FIXME: support ";" inside quoted or RFC-2047-encoded text
|
||||
+ {
|
||||
+ ++p;
|
||||
+ ++valueLength;
|
||||
+ }
|
||||
+
|
||||
+ // Trim whitespaces at the end of the value
|
||||
+ while (valueLength > 0 && parserHelpers::isSpace(buffer[valueStart + valueLength - 1]))
|
||||
+ --valueLength;
|
||||
+
|
||||
+ // Parse value
|
||||
+ getValue()->parse(buffer, valueStart, valueStart + valueLength);
|
||||
+
|
||||
+ // Reset parameters
|
||||
removeAllParameters();
|
||||
|
||||
// If there is one or more parameters following...
|
||||
diff -urN a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
|
||||
--- a/tests/parser/parameterTest.cpp 2010-04-11 15:55:51.494792999 +0200
|
||||
+++ b/tests/parser/parameterTest.cpp 2010-04-11 16:02:47.026046027 +0200
|
||||
@@ -36,6 +36,7 @@
|
||||
VMIME_TEST(testGenerate)
|
||||
VMIME_TEST(testGenerateRFC2231)
|
||||
VMIME_TEST(testNonStandardEncodedParam)
|
||||
+ VMIME_TEST(testParseNonSignificantWS)
|
||||
VMIME_TEST_LIST_END
|
||||
|
||||
|
||||
@@ -53,6 +54,7 @@
|
||||
};
|
||||
|
||||
|
||||
+#define FIELD_VALUE(f) (f.getValue()->generate())
|
||||
#define PARAM_VALUE(p, n) (p.getParameterAt(n)->getValue().generate())
|
||||
#define PARAM_NAME(p, n) (p.getParameterAt(n)->getName())
|
||||
#define PARAM_CHARSET(p, n) \
|
||||
@@ -278,5 +280,22 @@
|
||||
VASSERT_EQ("2.3", "Logo VMime.png", PARAM_VALUE(p2, 0));
|
||||
}
|
||||
|
||||
+ // Parse parameters with non-significant whitespaces
|
||||
+ void testParseNonSignificantWS()
|
||||
+ {
|
||||
+ parameterizedHeaderField p1;
|
||||
+ p1.parse(" \t X \r\n");
|
||||
+
|
||||
+ VASSERT_EQ("1.1", "X", FIELD_VALUE(p1));
|
||||
+
|
||||
+ parameterizedHeaderField p2;
|
||||
+ p2.parse(" X ; param1 = value1 \r\n");
|
||||
+
|
||||
+ VASSERT_EQ("2.1", 1, p2.getParameterCount());
|
||||
+ VASSERT_EQ("2.2", "X", FIELD_VALUE(p2));
|
||||
+ VASSERT_EQ("2.3", "param1", PARAM_NAME(p2, 0));
|
||||
+ VASSERT_EQ("2.4", "value1", PARAM_VALUE(p2, 0));
|
||||
+ }
|
||||
+
|
||||
VMIME_TEST_SUITE_END
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/SConstruct b/SConstruct
|
||||
--- a/SConstruct 2010-05-10 21:21:02.535809341 +0200
|
||||
+++ b/SConstruct 2010-05-10 21:21:28.163800740 +0200
|
||||
@@ -1071,7 +1071,7 @@
|
||||
# Generate pkg-config file for shared and static library
|
||||
vmime_pc_in = open(packageVersionedGenericName + ".pc.in", 'w')
|
||||
vmime_pc_in.write("# File automatically generated by SConstruct ('scons autotools')\n")
|
||||
- vmime_pc_in.write("# DOT NOT EDIT!\n")
|
||||
+ vmime_pc_in.write("# DO NOT EDIT!\n")
|
||||
vmime_pc_in.write("\n")
|
||||
vmime_pc_in.write("prefix=@prefix@\n")
|
||||
vmime_pc_in.write("exec_prefix=@exec_prefix@\n")
|
||||
@@ -1091,7 +1091,7 @@
|
||||
Makefile_am = open("Makefile.am", 'w')
|
||||
Makefile_am.write("""
|
||||
# File automatically generated by SConstruct ('scons autotools')
|
||||
-# DOT NOT EDIT!
|
||||
+# DO NOT EDIT!
|
||||
|
||||
BINDING =
|
||||
INCLUDE = vmime
|
||||
@@ -1123,7 +1123,7 @@
|
||||
Makefile_am = open("vmime/Makefile.am", 'w')
|
||||
Makefile_am.write("""
|
||||
# File automatically generated by SConstruct ('scons autotools')
|
||||
-# DOT NOT EDIT!
|
||||
+# DO NOT EDIT!
|
||||
""")
|
||||
|
||||
#Makefile_am.write(packageVersionedName + "includedir = $(prefix)/include/@GENERIC_VERSIONED_LIBRARY_NAME@/@GENERIC_LIBRARY_NAME@\n")
|
||||
@@ -1145,7 +1145,7 @@
|
||||
Makefile_am = open("src/Makefile.am", 'w')
|
||||
Makefile_am.write("""
|
||||
# File automatically generated by SConstruct ('scons autotools')
|
||||
-# DOT NOT EDIT!
|
||||
+# DO NOT EDIT!
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies foreign
|
||||
INTERNALS =
|
||||
@@ -1235,7 +1235,7 @@
|
||||
# configure.in
|
||||
|
||||
# File automatically generated by SConstruct ('scons autotools')
|
||||
-# DOT NOT EDIT!
|
||||
+# DO NOT EDIT!
|
||||
|
||||
# Init
|
||||
""")
|
||||
diff -urN a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
|
||||
--- a/src/net/imap/IMAPConnection.cpp 2010-05-10 21:21:02.392809549 +0200
|
||||
+++ b/src/net/imap/IMAPConnection.cpp 2010-05-10 21:21:28.163800740 +0200
|
||||
@@ -156,7 +156,7 @@
|
||||
const bool tlsRequired = HAS_PROPERTY(PROPERTY_CONNECTION_TLS_REQUIRED)
|
||||
&& GET_PROPERTY(bool, PROPERTY_CONNECTION_TLS_REQUIRED);
|
||||
|
||||
- if (!store->isSecuredConnection() && tls) // only if not IMAPS
|
||||
+ if (!store->isIMAPS() && tls) // only if not IMAPS
|
||||
{
|
||||
try
|
||||
{
|
||||
diff -urN a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoderFactory.cpp
|
||||
--- a/src/utility/encoder/encoderFactory.cpp 2010-05-10 21:21:02.431820130 +0200
|
||||
+++ b/src/utility/encoder/encoderFactory.cpp 2010-05-10 21:21:28.163800740 +0200
|
||||
@@ -46,6 +46,10 @@
|
||||
registerName <sevenBitEncoder>("7bit");
|
||||
registerName <eightBitEncoder>("8bit");
|
||||
registerName <binaryEncoder>("binary");
|
||||
+
|
||||
+ // Also register some non-standard encoding names
|
||||
+ registerName <sevenBitEncoder>("7-bit");
|
||||
+ registerName <eightBitEncoder>("8-bit");
|
||||
}
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/src/headerField.cpp b/src/headerField.cpp
|
||||
--- a/src/headerField.cpp 2010-05-15 20:36:05.685783611 +0200
|
||||
+++ b/src/headerField.cpp 2010-05-15 20:36:18.853452026 +0200
|
||||
@@ -146,6 +146,12 @@
|
||||
{
|
||||
c = buffer[pos];
|
||||
|
||||
+ // Check for folded line
|
||||
+ if (c == '\r' && pos + 2 < end && buffer[pos + 1] == '\n' &&
|
||||
+ (buffer[pos + 2] == ' ' || buffer[pos + 2] == '\t'))
|
||||
+ {
|
||||
+ pos += 3;
|
||||
+ }
|
||||
// Check for end of contents
|
||||
if (c == '\r' && pos + 1 < end && buffer[pos + 1] == '\n')
|
||||
{
|
File diff suppressed because it is too large
Load Diff
|
@ -1,280 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
|
||||
--- a/src/utility/stringUtils.cpp 2010-05-22 13:23:38.947821913 +0200
|
||||
+++ b/src/utility/stringUtils.cpp 2010-05-22 13:24:17.295331088 +0200
|
||||
@@ -151,6 +151,24 @@
|
||||
}
|
||||
|
||||
|
||||
+string::size_type stringUtils::findFirstNonASCIIchar
|
||||
+ (const string::const_iterator begin, const string::const_iterator end)
|
||||
+{
|
||||
+ string::size_type pos = string::npos;
|
||||
+
|
||||
+ for (string::const_iterator i = begin ; i != end ; ++i)
|
||||
+ {
|
||||
+ if (!parserHelpers::isAscii(*i))
|
||||
+ {
|
||||
+ pos = i - begin;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return pos;
|
||||
+}
|
||||
+
|
||||
+
|
||||
const string stringUtils::unquote(const string& str)
|
||||
{
|
||||
if (str.length() < 2)
|
||||
diff -urN a/src/word.cpp b/src/word.cpp
|
||||
--- a/src/word.cpp 2010-05-22 13:23:38.947821913 +0200
|
||||
+++ b/src/word.cpp 2010-05-22 13:24:17.263325063 +0200
|
||||
@@ -336,30 +336,22 @@
|
||||
if (state == NULL)
|
||||
state = &defaultGeneratorState;
|
||||
|
||||
- // Calculate the number of ASCII chars to check whether encoding is needed
|
||||
- // and _which_ encoding to use.
|
||||
- const string::size_type asciiCount =
|
||||
- utility::stringUtils::countASCIIchars(m_buffer.begin(), m_buffer.end());
|
||||
+ // Find out if encoding is forced or required by contents + charset
|
||||
+ bool encodingNeeded = (flags & text::FORCE_ENCODING) != 0;
|
||||
|
||||
- bool noEncoding = (flags & text::FORCE_NO_ENCODING) ||
|
||||
- (!(flags & text::FORCE_ENCODING) && asciiCount == m_buffer.length());
|
||||
-
|
||||
- if (!(flags & text::FORCE_NO_ENCODING) &&
|
||||
- m_buffer.find_first_of("\n\r") != string::npos)
|
||||
- {
|
||||
- // Force encoding when there are only ASCII chars, but there is
|
||||
- // also at least one of '\n' or '\r' (header fields)
|
||||
- noEncoding = false;
|
||||
- }
|
||||
+ if (encodingNeeded == false)
|
||||
+ encodingNeeded = wordEncoder::isEncodingNeeded(m_buffer, m_charset);
|
||||
+ else if ((flags & text::FORCE_NO_ENCODING) != 0)
|
||||
+ encodingNeeded = false;
|
||||
|
||||
// If possible and requested (with flag), quote the buffer (no folding is performed).
|
||||
// Quoting is possible if and only if:
|
||||
- // - the whole buffer is ASCII-only
|
||||
+ // - the buffer does not need to be encoded
|
||||
// - the buffer does not contain quoting character (")
|
||||
// - there is enough remaining space on the current line to hold the whole buffer
|
||||
- if (!noEncoding &&
|
||||
+ if (!encodingNeeded &&
|
||||
(flags & text::QUOTE_IF_POSSIBLE) &&
|
||||
- asciiCount == m_buffer.length() &&
|
||||
+ !encodingNeeded &&
|
||||
m_buffer.find('"') == string::npos &&
|
||||
(curLineLength + 2 /* 2 x " */ + m_buffer.length()) < maxLineLength)
|
||||
{
|
||||
@@ -367,7 +359,7 @@
|
||||
curLineLength += 2 + m_buffer.length();
|
||||
}
|
||||
// We will fold lines without encoding them.
|
||||
- else if (noEncoding)
|
||||
+ else if (!encodingNeeded)
|
||||
{
|
||||
string::const_iterator lastWSpos = m_buffer.end(); // last white-space position
|
||||
string::const_iterator curLineStart = m_buffer.begin(); // current line start
|
||||
diff -urN a/src/wordEncoder.cpp b/src/wordEncoder.cpp
|
||||
--- a/src/wordEncoder.cpp 2010-05-22 13:23:38.947821913 +0200
|
||||
+++ b/src/wordEncoder.cpp 2010-05-22 13:24:17.263325063 +0200
|
||||
@@ -260,17 +260,75 @@
|
||||
}
|
||||
|
||||
|
||||
+// Explicitly force encoding for some charsets
|
||||
+struct CharsetEncodingEntry
|
||||
+{
|
||||
+ CharsetEncodingEntry(const std::string& charset_, const wordEncoder::Encoding encoding_)
|
||||
+ : charset(charset_), encoding(encoding_)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ std::string charset;
|
||||
+ wordEncoder::Encoding encoding;
|
||||
+};
|
||||
+
|
||||
+CharsetEncodingEntry g_charsetEncodingMap[] =
|
||||
+{
|
||||
+ // Use QP encoding for ISO-8859-x charsets
|
||||
+ CharsetEncodingEntry("iso-8859", wordEncoder::ENCODING_QP),
|
||||
+ CharsetEncodingEntry("iso8859", wordEncoder::ENCODING_QP),
|
||||
+
|
||||
+ // RFC-1468 states:
|
||||
+ // " ISO-2022-JP may also be used in MIME Part 2 headers. The "B"
|
||||
+ // encoding should be used with ISO-2022-JP text. "
|
||||
+ // Use Base64 encoding for all ISO-2022 charsets.
|
||||
+ CharsetEncodingEntry("iso-2022", wordEncoder::ENCODING_B64),
|
||||
+ CharsetEncodingEntry("iso2022", wordEncoder::ENCODING_B64),
|
||||
+
|
||||
+ // Last entry is not used
|
||||
+ CharsetEncodingEntry("", wordEncoder::ENCODING_AUTO)
|
||||
+};
|
||||
+
|
||||
+
|
||||
+// static
|
||||
+bool wordEncoder::isEncodingNeeded(const string& buffer, const charset& charset)
|
||||
+{
|
||||
+ // Special treatment for some charsets
|
||||
+ const string cset = utility::stringUtils::toLower(charset.getName());
|
||||
+
|
||||
+ for (unsigned int i = 0 ; i < (sizeof(g_charsetEncodingMap) / sizeof(g_charsetEncodingMap[0])) - 1 ; ++i)
|
||||
+ {
|
||||
+ if (cset.find(g_charsetEncodingMap[i].charset) != string::npos)
|
||||
+ {
|
||||
+ if (g_charsetEncodingMap[i].encoding != wordEncoder::ENCODING_AUTO)
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // No encoding is needed if the buffer only contains ASCII chars
|
||||
+ if (utility::stringUtils::findFirstNonASCIIchar(buffer.begin(), buffer.end()) != string::npos)
|
||||
+ return true;
|
||||
+
|
||||
+ // Force encoding when there are only ASCII chars, but there is
|
||||
+ // also at least one of '\n' or '\r' (header fields)
|
||||
+ if (buffer.find_first_of("\n\r") != string::npos)
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+
|
||||
// static
|
||||
wordEncoder::Encoding wordEncoder::guessBestEncoding
|
||||
(const string& buffer, const charset& charset)
|
||||
{
|
||||
- // If the charset is ISO-8859-x, set to QP encoding
|
||||
+ // Special treatment for some charsets
|
||||
const string cset = utility::stringUtils::toLower(charset.getName());
|
||||
|
||||
- if (cset.find("iso-8859") != string::npos ||
|
||||
- cset.find("iso8859") != string::npos)
|
||||
+ for (unsigned int i = 0 ; i < (sizeof(g_charsetEncodingMap) / sizeof(g_charsetEncodingMap[0])) - 1 ; ++i)
|
||||
{
|
||||
- return ENCODING_QP;
|
||||
+ if (cset.find(g_charsetEncodingMap[i].charset) != string::npos)
|
||||
+ return g_charsetEncodingMap[i].encoding;
|
||||
}
|
||||
|
||||
// Use Base64 if more than 40% non-ASCII, or Quoted-Printable else (default)
|
||||
diff -urN a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
|
||||
--- a/tests/parser/textTest.cpp 2010-05-22 13:23:38.955319215 +0200
|
||||
+++ b/tests/parser/textTest.cpp 2010-05-22 13:24:17.295331088 +0200
|
||||
@@ -44,6 +44,8 @@
|
||||
VMIME_TEST(testWordGenerateSpace)
|
||||
VMIME_TEST(testWordGenerateSpace2)
|
||||
VMIME_TEST(testWordGenerateMultiBytes)
|
||||
+ VMIME_TEST(testWordGenerateQuote)
|
||||
+ VMIME_TEST(testWordGenerateSpecialCharsets)
|
||||
VMIME_TEST_LIST_END
|
||||
|
||||
|
||||
@@ -335,9 +337,38 @@
|
||||
VASSERT_EQ("1", "=?utf-8?Q?aaa?==?utf-8?Q?=C3=A9?==?utf-8?Q?zzz?=",
|
||||
cleanGeneratedWords(vmime::word("aaa\xc3\xa9zzz", vmime::charset("utf-8")).generate(16)));
|
||||
|
||||
- VASSERT_EQ("1", "=?utf-8?Q?aaa=C3=A9?==?utf-8?Q?zzz?=",
|
||||
+ VASSERT_EQ("2", "=?utf-8?Q?aaa=C3=A9?==?utf-8?Q?zzz?=",
|
||||
cleanGeneratedWords(vmime::word("aaa\xc3\xa9zzz", vmime::charset("utf-8")).generate(17)));
|
||||
}
|
||||
|
||||
+ void testWordGenerateQuote()
|
||||
+ {
|
||||
+ std::string str;
|
||||
+ vmime::utility::outputStreamStringAdapter os(str);
|
||||
+
|
||||
+ // ASCII-only text is quotable
|
||||
+ str.clear();
|
||||
+ vmime::word("Quoted text").generate(os, 1000, 0, NULL, vmime::text::QUOTE_IF_POSSIBLE, NULL);
|
||||
+ VASSERT_EQ("1", "\"Quoted text\"", cleanGeneratedWords(str));
|
||||
+
|
||||
+ // Text with CR/LF is not quotable
|
||||
+ str.clear();
|
||||
+ vmime::word("Non-quotable\ntext", "us-ascii").generate(os, 1000, 0, NULL, vmime::text::QUOTE_IF_POSSIBLE, NULL);
|
||||
+ VASSERT_EQ("2", "=?us-ascii?Q?Non-quotable=0Atext?=", cleanGeneratedWords(str));
|
||||
+
|
||||
+ // Text with non-ASCII chars is not quotable
|
||||
+ str.clear();
|
||||
+ vmime::word("Non-quotable text \xc3\xa9").generate(os, 1000, 0, NULL, vmime::text::QUOTE_IF_POSSIBLE, NULL);
|
||||
+ VASSERT_EQ("3", "=?UTF-8?Q?Non-quotable_text_=C3=A9?=", cleanGeneratedWords(str));
|
||||
+ }
|
||||
+
|
||||
+ void testWordGenerateSpecialCharsets()
|
||||
+ {
|
||||
+ // ISO-2022-JP only uses 7-bit chars but should be encoded in Base64
|
||||
+ VASSERT_EQ("1", "=?iso-2022-jp?B?XlskQiVRITwlPSVKJWshJiU9JVUlSCUmJSclIl5bKEI=?=",
|
||||
+ cleanGeneratedWords(vmime::word("^[$B%Q!<%=%J%k!&%=%U%H%&%'%\"^[(B",
|
||||
+ vmime::charset("iso-2022-jp")).generate(100)));
|
||||
+ }
|
||||
+
|
||||
VMIME_TEST_SUITE_END
|
||||
|
||||
diff -urN a/vmime/component.hpp b/vmime/component.hpp
|
||||
--- a/vmime/component.hpp 2010-05-22 13:23:38.967821097 +0200
|
||||
+++ b/vmime/component.hpp 2010-05-22 13:24:17.295331088 +0200
|
||||
@@ -32,8 +32,8 @@
|
||||
{
|
||||
|
||||
|
||||
-/** This abstract class is the base for all the classes in the library.
|
||||
- * It defines the methods for parsing and generating all the components.
|
||||
+/** This abstract class is the base class for all the components of a message.
|
||||
+ * It defines methods for parsing and generating a component.
|
||||
*/
|
||||
|
||||
class component : public object
|
||||
diff -urN a/vmime/utility/stringUtils.hpp b/vmime/utility/stringUtils.hpp
|
||||
--- a/vmime/utility/stringUtils.hpp 2010-05-22 13:23:39.023322447 +0200
|
||||
+++ b/vmime/utility/stringUtils.hpp 2010-05-22 13:24:17.295331088 +0200
|
||||
@@ -104,6 +104,14 @@
|
||||
*/
|
||||
static string::size_type countASCIIchars(const string::const_iterator begin, const string::const_iterator end);
|
||||
|
||||
+ /** Returns the position of the first non 7-bit US-ASCII character in a string.
|
||||
+ *
|
||||
+ * @param begin start position
|
||||
+ * @param end end position
|
||||
+ * @return position since begin, or string::npos
|
||||
+ */
|
||||
+ static string::size_type findFirstNonASCIIchar(const string::const_iterator begin, const string::const_iterator end);
|
||||
+
|
||||
/** Convert the specified value to a string value.
|
||||
*
|
||||
* @param value to convert
|
||||
diff -urN a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
|
||||
--- a/vmime/wordEncoder.hpp 2010-05-22 13:23:39.027319211 +0200
|
||||
+++ b/vmime/wordEncoder.hpp 2010-05-22 13:24:17.295331088 +0200
|
||||
@@ -73,12 +73,23 @@
|
||||
*/
|
||||
Encoding getEncoding() const;
|
||||
|
||||
-private:
|
||||
+ /** Test whether RFC-2047 encoding is needed.
|
||||
+ *
|
||||
+ * @param buffer buffer to analyze
|
||||
+ * @param charset charset of the buffer
|
||||
+ * @return true if encoding is needed, false otherwise.
|
||||
+ */
|
||||
+ static bool isEncodingNeeded(const string& buffer, const charset& charset);
|
||||
|
||||
+ /** Guess the best RFC-2047 encoding to use for the specified buffer.
|
||||
+ *
|
||||
+ * @param buffer buffer to analyze
|
||||
+ * @param charset charset of the buffer
|
||||
+ * @return RFC-2047 encoding
|
||||
+ */
|
||||
static Encoding guessBestEncoding(const string& buffer, const charset& charset);
|
||||
|
||||
- void guessBestEncoding();
|
||||
-
|
||||
+private:
|
||||
|
||||
string m_buffer;
|
||||
string::size_type m_pos;
|
|
@ -1,721 +0,0 @@
|
|||
This file is part of mingw-cross-env.
|
||||
See doc/index.html for further information.
|
||||
|
||||
diff -urN a/examples/example3.cpp b/examples/example3.cpp
|
||||
--- a/examples/example3.cpp 2010-05-24 10:54:47.983682375 +0200
|
||||
+++ b/examples/example3.cpp 2010-05-24 10:55:53.035683414 +0200
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
// -- embed an image (the returned "CID" (content identifier) is used to reference
|
||||
// -- the image into HTML content).
|
||||
- vmime::utility::fileSystemFactory* fs =
|
||||
+ vmime::ref <vmime::utility::fileSystemFactory> fs =
|
||||
vmime::platform::getHandler()->getFileSystemFactory();
|
||||
|
||||
vmime::ref <vmime::utility::file> imageFile =
|
||||
diff -urN a/src/body.cpp b/src/body.cpp
|
||||
--- a/src/body.cpp 2010-05-24 10:54:48.003683032 +0200
|
||||
+++ b/src/body.cpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -213,8 +213,26 @@
|
||||
// Treat the contents as 'simple' data
|
||||
else
|
||||
{
|
||||
+ encoding enc;
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ const ref <const headerField> cef =
|
||||
+ m_header.acquire()->findField(fields::CONTENT_TRANSFER_ENCODING);
|
||||
+
|
||||
+ enc = *cef->getValue().dynamicCast <const encoding>();
|
||||
+ }
|
||||
+ catch (exceptions::no_such_field&)
|
||||
+ {
|
||||
+ // Defaults to "7bit" (RFC-1521)
|
||||
+ enc = vmime::encoding(encodingTypes::SEVEN_BIT);
|
||||
+
|
||||
+ // Set header field
|
||||
+ m_header.acquire()->ContentTransferEncoding()->setValue(enc);
|
||||
+ }
|
||||
+
|
||||
// Extract the (encoded) contents
|
||||
- m_contents = vmime::create <stringContentHandler>(buffer, position, end, getEncoding());
|
||||
+ m_contents = vmime::create <stringContentHandler>(buffer, position, end, enc);
|
||||
}
|
||||
|
||||
setParsedBounds(position, end);
|
||||
@@ -406,6 +424,22 @@
|
||||
// Quick-access functions
|
||||
//
|
||||
|
||||
+
|
||||
+void body::setContentType(const mediaType& type, const charset& chset)
|
||||
+{
|
||||
+ ref <contentTypeField> ctf = m_header.acquire()->ContentType().dynamicCast <contentTypeField>();
|
||||
+
|
||||
+ ctf->setValue(type);
|
||||
+ ctf->setCharset(chset);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void body::setContentType(const mediaType& type)
|
||||
+{
|
||||
+ m_header.acquire()->ContentType()->setValue(type);
|
||||
+}
|
||||
+
|
||||
+
|
||||
const mediaType body::getContentType() const
|
||||
{
|
||||
try
|
||||
@@ -423,6 +457,25 @@
|
||||
}
|
||||
|
||||
|
||||
+void body::setCharset(const charset& chset)
|
||||
+{
|
||||
+ // If a Content-Type field exists, set charset
|
||||
+ try
|
||||
+ {
|
||||
+ ref <contentTypeField> ctf =
|
||||
+ m_header.acquire()->findField(fields::CONTENT_TYPE).dynamicCast <contentTypeField>();
|
||||
+
|
||||
+ ctf->setCharset(chset);
|
||||
+ }
|
||||
+ // Else, create a new Content-Type field of default type "text/plain"
|
||||
+ // and set charset on it
|
||||
+ catch (exceptions::no_such_field&)
|
||||
+ {
|
||||
+ setContentType(mediaType(mediaTypes::TEXT, mediaTypes::TEXT_PLAIN), chset);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
const charset body::getCharset() const
|
||||
{
|
||||
try
|
||||
@@ -445,6 +498,12 @@
|
||||
}
|
||||
|
||||
|
||||
+void body::setEncoding(const encoding& enc)
|
||||
+{
|
||||
+ m_header.acquire()->ContentTransferEncoding()->setValue(enc);
|
||||
+}
|
||||
+
|
||||
+
|
||||
const encoding body::getEncoding() const
|
||||
{
|
||||
try
|
||||
@@ -456,8 +515,15 @@
|
||||
}
|
||||
catch (exceptions::no_such_field&)
|
||||
{
|
||||
- // Defaults to "7bit" (RFC-1521)
|
||||
- return (vmime::encoding(encodingTypes::SEVEN_BIT));
|
||||
+ if (m_contents->isEncoded())
|
||||
+ {
|
||||
+ return m_contents->getEncoding();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ // Defaults to "7bit" (RFC-1521)
|
||||
+ return vmime::encoding(encodingTypes::SEVEN_BIT);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,6 +617,32 @@
|
||||
}
|
||||
|
||||
|
||||
+void body::setContents(ref <const contentHandler> contents, const mediaType& type)
|
||||
+{
|
||||
+ m_contents = contents;
|
||||
+
|
||||
+ setContentType(type);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void body::setContents(ref <const contentHandler> contents, const mediaType& type, const charset& chset)
|
||||
+{
|
||||
+ m_contents = contents;
|
||||
+
|
||||
+ setContentType(type, chset);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void body::setContents(ref <const contentHandler> contents, const mediaType& type,
|
||||
+ const charset& chset, const encoding& enc)
|
||||
+{
|
||||
+ m_contents = contents;
|
||||
+
|
||||
+ setContentType(type, chset);
|
||||
+ setEncoding(enc);
|
||||
+}
|
||||
+
|
||||
+
|
||||
void body::initNewPart(ref <bodyPart> part)
|
||||
{
|
||||
part->m_parent = m_part;
|
||||
diff -urN a/src/charset.cpp b/src/charset.cpp
|
||||
--- a/src/charset.cpp 2010-05-24 10:54:48.003683032 +0200
|
||||
+++ b/src/charset.cpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "vmime/charset.hpp"
|
||||
#include "vmime/exception.hpp"
|
||||
#include "vmime/platform.hpp"
|
||||
+#include "vmime/encoding.hpp"
|
||||
|
||||
#include "vmime/utility/stringUtils.hpp"
|
||||
|
||||
@@ -140,4 +141,53 @@
|
||||
}
|
||||
|
||||
|
||||
+
|
||||
+// Explicitly force encoding for some charsets
|
||||
+struct CharsetEncodingEntry
|
||||
+{
|
||||
+ CharsetEncodingEntry(const string& charset_, const string& encoding_)
|
||||
+ : charset(charset_), encoding(encoding_)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ const string charset;
|
||||
+ const string encoding;
|
||||
+};
|
||||
+
|
||||
+CharsetEncodingEntry g_charsetEncodingMap[] =
|
||||
+{
|
||||
+ // Use QP encoding for ISO-8859-x charsets
|
||||
+ CharsetEncodingEntry("iso-8859", encodingTypes::QUOTED_PRINTABLE),
|
||||
+ CharsetEncodingEntry("iso8859", encodingTypes::QUOTED_PRINTABLE),
|
||||
+
|
||||
+ // RFC-1468 states:
|
||||
+ // " ISO-2022-JP may also be used in MIME Part 2 headers. The "B"
|
||||
+ // encoding should be used with ISO-2022-JP text. "
|
||||
+ // Use Base64 encoding for all ISO-2022 charsets.
|
||||
+ CharsetEncodingEntry("iso-2022", encodingTypes::BASE64),
|
||||
+ CharsetEncodingEntry("iso2022", encodingTypes::BASE64),
|
||||
+
|
||||
+ // Last entry is not used
|
||||
+ CharsetEncodingEntry("", "")
|
||||
+};
|
||||
+
|
||||
+
|
||||
+bool charset::getRecommendedEncoding(encoding& enc) const
|
||||
+{
|
||||
+ // Special treatment for some charsets
|
||||
+ const string cset = utility::stringUtils::toLower(getName());
|
||||
+
|
||||
+ for (unsigned int i = 0 ; i < (sizeof(g_charsetEncodingMap) / sizeof(g_charsetEncodingMap[0])) - 1 ; ++i)
|
||||
+ {
|
||||
+ if (cset.find(g_charsetEncodingMap[i].charset) != string::npos)
|
||||
+ {
|
||||
+ enc = g_charsetEncodingMap[i].encoding;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+
|
||||
} // vmime
|
||||
diff -urN a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
|
||||
--- a/src/emptyContentHandler.cpp 2010-05-24 10:54:48.007697118 +0200
|
||||
+++ b/src/emptyContentHandler.cpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -96,4 +96,10 @@
|
||||
}
|
||||
|
||||
|
||||
+bool emptyContentHandler::isBuffered() const
|
||||
+{
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+
|
||||
} // vmime
|
||||
diff -urN a/src/encoding.cpp b/src/encoding.cpp
|
||||
--- a/src/encoding.cpp 2010-05-24 10:54:48.007697118 +0200
|
||||
+++ b/src/encoding.cpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -110,7 +110,7 @@
|
||||
}
|
||||
|
||||
|
||||
-const encoding encoding::decide
|
||||
+const encoding encoding::decideImpl
|
||||
(const string::const_iterator begin, const string::const_iterator end)
|
||||
{
|
||||
const string::difference_type length = end - begin;
|
||||
@@ -164,10 +164,40 @@
|
||||
}
|
||||
|
||||
|
||||
-const encoding encoding::decide(ref <const contentHandler> /* data */)
|
||||
+const encoding encoding::decide
|
||||
+ (ref <const contentHandler> data, const EncodingUsage usage)
|
||||
{
|
||||
- // TODO: a better solution to do that?
|
||||
- return (encoding(encodingTypes::BASE64));
|
||||
+ if (usage == USAGE_TEXT && data->isBuffered() &&
|
||||
+ data->getLength() > 0 && data->getLength() < 32768)
|
||||
+ {
|
||||
+ // Extract data into temporary buffer
|
||||
+ string buffer;
|
||||
+ utility::outputStreamStringAdapter os(buffer);
|
||||
+
|
||||
+ data->extract(os);
|
||||
+ os.flush();
|
||||
+
|
||||
+ return decideImpl(buffer.begin(), buffer.end());
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return encoding(encodingTypes::BASE64);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+const encoding encoding::decide(ref <const contentHandler> data,
|
||||
+ const charset& chset, const EncodingUsage usage)
|
||||
+{
|
||||
+ if (usage == USAGE_TEXT)
|
||||
+ {
|
||||
+ encoding recEncoding;
|
||||
+
|
||||
+ if (chset.getRecommendedEncoding(recEncoding))
|
||||
+ return recEncoding;
|
||||
+ }
|
||||
+
|
||||
+ return decide(data, usage);
|
||||
}
|
||||
|
||||
|
||||
diff -urN a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
|
||||
--- a/src/htmlTextPart.cpp 2010-05-24 10:54:48.011682988 +0200
|
||||
+++ b/src/htmlTextPart.cpp 2010-05-24 10:55:53.027697497 +0200
|
||||
@@ -69,27 +69,20 @@
|
||||
ref <bodyPart> part = vmime::create <bodyPart>();
|
||||
parent->getBody()->appendPart(part);
|
||||
|
||||
- // -- Set header fields
|
||||
- part->getHeader()->ContentType()->setValue
|
||||
- (mediaType(mediaTypes::TEXT, mediaTypes::TEXT_PLAIN));
|
||||
- part->getHeader()->ContentType().dynamicCast <contentTypeField>()->setCharset(m_charset);
|
||||
- part->getHeader()->ContentTransferEncoding()->setValue(encoding(encodingTypes::QUOTED_PRINTABLE));
|
||||
-
|
||||
// -- Set contents
|
||||
- part->getBody()->setContents(m_plainText);
|
||||
+ part->getBody()->setContents(m_plainText,
|
||||
+ mediaType(mediaTypes::TEXT, mediaTypes::TEXT_PLAIN), m_charset,
|
||||
+ encoding::decide(m_plainText, m_charset, encoding::USAGE_TEXT));
|
||||
}
|
||||
|
||||
// HTML text
|
||||
// -- Create a new part
|
||||
ref <bodyPart> htmlPart = vmime::create <bodyPart>();
|
||||
|
||||
- // -- Set header fields
|
||||
- htmlPart->getHeader()->ContentType()->setValue(mediaType(mediaTypes::TEXT, mediaTypes::TEXT_HTML));
|
||||
- htmlPart->getHeader()->ContentType().dynamicCast <contentTypeField>()->setCharset(m_charset);
|
||||
- htmlPart->getHeader()->ContentTransferEncoding()->setValue(encoding(encodingTypes::QUOTED_PRINTABLE));
|
||||
-
|
||||
// -- Set contents
|
||||
- htmlPart->getBody()->setContents(m_text);
|
||||
+ htmlPart->getBody()->setContents(m_text,
|
||||
+ mediaType(mediaTypes::TEXT, mediaTypes::TEXT_HTML), m_charset,
|
||||
+ encoding::decide(m_text, m_charset, encoding::USAGE_TEXT));
|
||||
|
||||
// Handle the case we have embedded objects
|
||||
if (!m_objects.empty())
|
||||
diff -urN a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp
|
||||
--- a/src/net/imap/IMAPMessagePartContentHandler.cpp 2010-05-24 10:54:48.167694191 +0200
|
||||
+++ b/src/net/imap/IMAPMessagePartContentHandler.cpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -173,6 +173,12 @@
|
||||
}
|
||||
|
||||
|
||||
+bool IMAPMessagePartContentHandler::isBuffered() const
|
||||
+{
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+
|
||||
} // imap
|
||||
} // net
|
||||
} // vmime
|
||||
diff -urN a/src/plainTextPart.cpp b/src/plainTextPart.cpp
|
||||
--- a/src/plainTextPart.cpp 2010-05-24 10:54:48.039690584 +0200
|
||||
+++ b/src/plainTextPart.cpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -63,13 +63,10 @@
|
||||
ref <bodyPart> part = vmime::create <bodyPart>();
|
||||
parent->getBody()->appendPart(part);
|
||||
|
||||
- // Set header fields
|
||||
- part->getHeader()->ContentType()->setValue(mediaType(mediaTypes::TEXT, mediaTypes::TEXT_PLAIN));
|
||||
- part->getHeader()->ContentType().dynamicCast <contentTypeField>()->setCharset(m_charset);
|
||||
- part->getHeader()->ContentTransferEncoding()->setValue(encoding(encodingTypes::QUOTED_PRINTABLE));
|
||||
-
|
||||
// Set contents
|
||||
- part->getBody()->setContents(m_text);
|
||||
+ part->getBody()->setContents(m_text,
|
||||
+ mediaType(mediaTypes::TEXT, mediaTypes::TEXT_PLAIN), m_charset,
|
||||
+ encoding::decide(m_text, m_charset, encoding::USAGE_TEXT));
|
||||
}
|
||||
|
||||
|
||||
diff -urN a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
|
||||
--- a/src/streamContentHandler.cpp 2010-05-24 10:54:48.051685838 +0200
|
||||
+++ b/src/streamContentHandler.cpp 2010-05-24 10:55:53.027697497 +0200
|
||||
@@ -201,4 +201,11 @@
|
||||
}
|
||||
|
||||
|
||||
+bool streamContentHandler::isBuffered() const
|
||||
+{
|
||||
+ // FIXME: some streams can be resetted
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+
|
||||
} // vmime
|
||||
diff -urN a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
|
||||
--- a/src/stringContentHandler.cpp 2010-05-24 10:54:48.051685838 +0200
|
||||
+++ b/src/stringContentHandler.cpp 2010-05-24 10:55:53.027697497 +0200
|
||||
@@ -202,4 +202,10 @@
|
||||
}
|
||||
|
||||
|
||||
+bool stringContentHandler::isBuffered() const
|
||||
+{
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+
|
||||
} // vmime
|
||||
diff -urN a/src/wordEncoder.cpp b/src/wordEncoder.cpp
|
||||
--- a/src/wordEncoder.cpp 2010-05-24 10:54:48.175690024 +0200
|
||||
+++ b/src/wordEncoder.cpp 2010-05-24 10:55:53.027697497 +0200
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "vmime/exception.hpp"
|
||||
#include "vmime/charsetConverter.hpp"
|
||||
|
||||
+#include "vmime/encoding.hpp"
|
||||
+
|
||||
#include "vmime/utility/encoder/b64Encoder.hpp"
|
||||
#include "vmime/utility/encoder/qpEncoder.hpp"
|
||||
|
||||
@@ -260,50 +262,14 @@
|
||||
}
|
||||
|
||||
|
||||
-// Explicitly force encoding for some charsets
|
||||
-struct CharsetEncodingEntry
|
||||
-{
|
||||
- CharsetEncodingEntry(const std::string& charset_, const wordEncoder::Encoding encoding_)
|
||||
- : charset(charset_), encoding(encoding_)
|
||||
- {
|
||||
- }
|
||||
-
|
||||
- std::string charset;
|
||||
- wordEncoder::Encoding encoding;
|
||||
-};
|
||||
-
|
||||
-CharsetEncodingEntry g_charsetEncodingMap[] =
|
||||
-{
|
||||
- // Use QP encoding for ISO-8859-x charsets
|
||||
- CharsetEncodingEntry("iso-8859", wordEncoder::ENCODING_QP),
|
||||
- CharsetEncodingEntry("iso8859", wordEncoder::ENCODING_QP),
|
||||
-
|
||||
- // RFC-1468 states:
|
||||
- // " ISO-2022-JP may also be used in MIME Part 2 headers. The "B"
|
||||
- // encoding should be used with ISO-2022-JP text. "
|
||||
- // Use Base64 encoding for all ISO-2022 charsets.
|
||||
- CharsetEncodingEntry("iso-2022", wordEncoder::ENCODING_B64),
|
||||
- CharsetEncodingEntry("iso2022", wordEncoder::ENCODING_B64),
|
||||
-
|
||||
- // Last entry is not used
|
||||
- CharsetEncodingEntry("", wordEncoder::ENCODING_AUTO)
|
||||
-};
|
||||
-
|
||||
-
|
||||
// static
|
||||
bool wordEncoder::isEncodingNeeded(const string& buffer, const charset& charset)
|
||||
{
|
||||
- // Special treatment for some charsets
|
||||
- const string cset = utility::stringUtils::toLower(charset.getName());
|
||||
+ // Charset-specific encoding
|
||||
+ encoding recEncoding;
|
||||
|
||||
- for (unsigned int i = 0 ; i < (sizeof(g_charsetEncodingMap) / sizeof(g_charsetEncodingMap[0])) - 1 ; ++i)
|
||||
- {
|
||||
- if (cset.find(g_charsetEncodingMap[i].charset) != string::npos)
|
||||
- {
|
||||
- if (g_charsetEncodingMap[i].encoding != wordEncoder::ENCODING_AUTO)
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
+ if (charset.getRecommendedEncoding(recEncoding))
|
||||
+ return true;
|
||||
|
||||
// No encoding is needed if the buffer only contains ASCII chars
|
||||
if (utility::stringUtils::findFirstNonASCIIchar(buffer.begin(), buffer.end()) != string::npos)
|
||||
@@ -322,13 +288,15 @@
|
||||
wordEncoder::Encoding wordEncoder::guessBestEncoding
|
||||
(const string& buffer, const charset& charset)
|
||||
{
|
||||
- // Special treatment for some charsets
|
||||
- const string cset = utility::stringUtils::toLower(charset.getName());
|
||||
+ // Charset-specific encoding
|
||||
+ encoding recEncoding;
|
||||
|
||||
- for (unsigned int i = 0 ; i < (sizeof(g_charsetEncodingMap) / sizeof(g_charsetEncodingMap[0])) - 1 ; ++i)
|
||||
+ if (charset.getRecommendedEncoding(recEncoding))
|
||||
{
|
||||
- if (cset.find(g_charsetEncodingMap[i].charset) != string::npos)
|
||||
- return g_charsetEncodingMap[i].encoding;
|
||||
+ if (recEncoding == encoding(encodingTypes::QUOTED_PRINTABLE))
|
||||
+ return ENCODING_QP;
|
||||
+ else
|
||||
+ return ENCODING_B64;
|
||||
}
|
||||
|
||||
// Use Base64 if more than 40% non-ASCII, or Quoted-Printable else (default)
|
||||
diff -urN a/vmime/body.hpp b/vmime/body.hpp
|
||||
--- a/vmime/body.hpp 2010-05-24 10:54:48.079694131 +0200
|
||||
+++ b/vmime/body.hpp 2010-05-24 10:55:53.035683414 +0200
|
||||
@@ -184,6 +184,45 @@
|
||||
*/
|
||||
void setContents(ref <const contentHandler> contents);
|
||||
|
||||
+ /** Set the body contents and type.
|
||||
+ *
|
||||
+ * @param contents new body contents
|
||||
+ * @param type type of contents
|
||||
+ */
|
||||
+ void setContents(ref <const contentHandler> contents, const mediaType& type);
|
||||
+
|
||||
+ /** Set the body contents, type and charset.
|
||||
+ *
|
||||
+ * @param contents new body contents
|
||||
+ * @param type type of contents
|
||||
+ * @param charset charset of contents
|
||||
+ */
|
||||
+ void setContents(ref <const contentHandler> contents, const mediaType& type, const charset& chset);
|
||||
+
|
||||
+ /** Set the body contents, type, charset and encoding.
|
||||
+ *
|
||||
+ * @param contents new body contents
|
||||
+ * @param type type of contents
|
||||
+ * @param charset charset of contents
|
||||
+ * @param encoding contents encoding
|
||||
+ */
|
||||
+ void setContents(ref <const contentHandler> contents, const mediaType& type,
|
||||
+ const charset& chset, const encoding& enc);
|
||||
+
|
||||
+ /** Set the MIME type and charset of contents.
|
||||
+ * If a charset is defined, it will not be modified.
|
||||
+ *
|
||||
+ * @param type MIME media type of contents
|
||||
+ * @param chset charset of contents
|
||||
+ */
|
||||
+ void setContentType(const mediaType& type, const charset& chset);
|
||||
+
|
||||
+ /** Set the MIME type of contents.
|
||||
+ *
|
||||
+ * @param type MIME media type of contents
|
||||
+ */
|
||||
+ void setContentType(const mediaType& type);
|
||||
+
|
||||
/** Return the media type of the data contained in the body contents.
|
||||
* This is a shortcut for getHeader()->ContentType()->getValue()
|
||||
* on the parent part.
|
||||
@@ -192,6 +231,13 @@
|
||||
*/
|
||||
const mediaType getContentType() const;
|
||||
|
||||
+ /** Set the charset of contents.
|
||||
+ * If the type is not set, it will be set to default "text/plain" type.
|
||||
+ *
|
||||
+ * @param chset charset of contents
|
||||
+ */
|
||||
+ void setCharset(const charset& chset);
|
||||
+
|
||||
/** Return the charset of the data contained in the body contents.
|
||||
* This is a shortcut for getHeader()->ContentType()->getCharset()
|
||||
* on the parent part.
|
||||
@@ -200,6 +246,13 @@
|
||||
*/
|
||||
const charset getCharset() const;
|
||||
|
||||
+ /** Set the output encoding of contents.
|
||||
+ * Contents will be encoded (or re-encoded) when this node is being generated.
|
||||
+ *
|
||||
+ * @param enc encoding of contents
|
||||
+ */
|
||||
+ void setEncoding(const encoding& enc);
|
||||
+
|
||||
/** Return the encoding used to encode the body contents.
|
||||
* This is a shortcut for getHeader()->ContentTransferEncoding()->getValue()
|
||||
* on the parent part.
|
||||
diff -urN a/vmime/charset.hpp b/vmime/charset.hpp
|
||||
--- a/vmime/charset.hpp 2010-05-24 10:54:48.079694131 +0200
|
||||
+++ b/vmime/charset.hpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -33,6 +33,9 @@
|
||||
{
|
||||
|
||||
|
||||
+class encoding; // forward reference
|
||||
+
|
||||
+
|
||||
/** Charset description (basic type).
|
||||
*/
|
||||
|
||||
@@ -59,6 +62,16 @@
|
||||
|
||||
const std::vector <ref <const component> > getChildComponents() const;
|
||||
|
||||
+ /** Gets the recommended encoding for this charset.
|
||||
+ * Note: there may be no recommended encoding.
|
||||
+ *
|
||||
+ * @param enc output parameter that will hold recommended encoding
|
||||
+ * @return true if an encoding is recommended (the encoding is stored
|
||||
+ * in the enc parameter), false otherwise (in this case, the enc
|
||||
+ * parameter is not modified)
|
||||
+ */
|
||||
+ bool getRecommendedEncoding(encoding& enc) const;
|
||||
+
|
||||
/** Returns the default charset used on the system.
|
||||
*
|
||||
* This function simply calls <code>platformHandler::getLocaleCharset()</code>
|
||||
diff -urN a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
|
||||
--- a/vmime/contentHandler.hpp 2010-05-24 10:54:48.171682994 +0200
|
||||
+++ b/vmime/contentHandler.hpp 2010-05-24 10:55:53.035683414 +0200
|
||||
@@ -111,6 +111,13 @@
|
||||
* @return true if no data is managed by this object, false otherwise
|
||||
*/
|
||||
virtual bool isEmpty() const = 0;
|
||||
+
|
||||
+ /** Indicates whether the extract() method can be called multiple times.
|
||||
+ *
|
||||
+ * @return true if the data can be extracted multiple times, or false
|
||||
+ * if not (ie. streamed data from socket)
|
||||
+ */
|
||||
+ virtual bool isBuffered() const = 0;
|
||||
};
|
||||
|
||||
|
||||
diff -urN a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
|
||||
--- a/vmime/emptyContentHandler.hpp 2010-05-24 10:54:48.083683563 +0200
|
||||
+++ b/vmime/emptyContentHandler.hpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -52,6 +52,8 @@
|
||||
const vmime::encoding& getEncoding() const;
|
||||
|
||||
bool isEmpty() const;
|
||||
+
|
||||
+ bool isBuffered() const;
|
||||
};
|
||||
|
||||
|
||||
diff -urN a/vmime/encoding.hpp b/vmime/encoding.hpp
|
||||
--- a/vmime/encoding.hpp 2010-05-24 10:54:48.083683563 +0200
|
||||
+++ b/vmime/encoding.hpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -45,6 +45,13 @@
|
||||
{
|
||||
public:
|
||||
|
||||
+ enum EncodingUsage
|
||||
+ {
|
||||
+ USAGE_TEXT, /**< Use for body text. */
|
||||
+ USAGE_BINARY_DATA /**< Use for attachment, image... */
|
||||
+ };
|
||||
+
|
||||
+
|
||||
encoding();
|
||||
explicit encoding(const string& name);
|
||||
encoding(const encoding& enc);
|
||||
@@ -75,20 +82,21 @@
|
||||
|
||||
/** Decide which encoding to use based on the specified data.
|
||||
*
|
||||
- * \deprecated Use the new decide() method which takes a contentHandler parameter.
|
||||
- *
|
||||
- * @param begin start iterator in buffer
|
||||
- * @param end end iterator in buffer
|
||||
+ * @param data data used to determine encoding
|
||||
+ * @param usage context of use of data
|
||||
* @return suitable encoding for specified data
|
||||
*/
|
||||
- static const encoding decide(const string::const_iterator begin, const string::const_iterator end);
|
||||
+ static const encoding decide(ref <const contentHandler> data, const EncodingUsage usage = USAGE_BINARY_DATA);
|
||||
|
||||
- /** Decide which encoding to use based on the specified data.
|
||||
+ /** Decide which encoding to use based on the specified data and charset.
|
||||
*
|
||||
* @param data data used to determine encoding
|
||||
- * @return suitable encoding for specified data
|
||||
+ * @param charset charset of data
|
||||
+ * @param usage context of use of data
|
||||
+ * @return suitable encoding for specified data and charset
|
||||
*/
|
||||
- static const encoding decide(ref <const contentHandler> data);
|
||||
+ static const encoding decide(ref <const contentHandler> data, const charset& chset, const EncodingUsage usage = USAGE_BINARY_DATA);
|
||||
+
|
||||
|
||||
ref <component> clone() const;
|
||||
void copyFrom(const component& other);
|
||||
@@ -106,6 +114,17 @@
|
||||
|
||||
string m_name;
|
||||
|
||||
+ /** Decide which encoding to use based on the specified data.
|
||||
+ *
|
||||
+ * Please note: this will read the whole buffer, so it should be used only
|
||||
+ * for small amount of data (eg. text), and not large binary attachments.
|
||||
+ *
|
||||
+ * @param begin start iterator in buffer
|
||||
+ * @param end end iterator in buffer
|
||||
+ * @return suitable encoding for specified data
|
||||
+ */
|
||||
+ static const encoding decideImpl(const string::const_iterator begin, const string::const_iterator end);
|
||||
+
|
||||
public:
|
||||
|
||||
using component::parse;
|
||||
diff -urN a/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
|
||||
--- a/vmime/net/imap/IMAPMessagePartContentHandler.hpp 2010-05-24 10:54:48.171682994 +0200
|
||||
+++ b/vmime/net/imap/IMAPMessagePartContentHandler.hpp 2010-05-24 10:55:53.035683414 +0200
|
||||
@@ -55,6 +55,8 @@
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
+ bool isBuffered() const;
|
||||
+
|
||||
private:
|
||||
|
||||
weak_ref <IMAPMessage> m_message;
|
||||
diff -urN a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
|
||||
--- a/vmime/streamContentHandler.hpp 2010-05-24 10:54:48.135692627 +0200
|
||||
+++ b/vmime/streamContentHandler.hpp 2010-05-24 10:55:53.035683414 +0200
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
+ bool isBuffered() const;
|
||||
+
|
||||
private:
|
||||
|
||||
// Equals to NO_ENCODING if data is not encoded, otherwise this
|
||||
diff -urN a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
|
||||
--- a/vmime/stringContentHandler.hpp 2010-05-24 10:54:48.135692627 +0200
|
||||
+++ b/vmime/stringContentHandler.hpp 2010-05-24 10:55:53.031689093 +0200
|
||||
@@ -80,6 +80,8 @@
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
+ bool isBuffered() const;
|
||||
+
|
||||
private:
|
||||
|
||||
// Equals to NO_ENCODING if data is not encoded, otherwise this
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue