summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2010-08-19 20:16:26 (GMT)
committerMark Brand <mabrand@mabrand.nl>2010-08-19 20:16:26 (GMT)
commit481ba6cabe14b54cd4eb3996cd0141bc456195aa (patch)
tree2fddd8f6f058696b1056387e7973909bf0483379 /src
parentbbee76e2c122846efdac988bbda89a8f2d253583 (diff)
downloadmxe-481ba6cabe14b54cd4eb3996cd0141bc456195aa.zip
mxe-481ba6cabe14b54cd4eb3996cd0141bc456195aa.tar.gz
mxe-481ba6cabe14b54cd4eb3996cd0141bc456195aa.tar.bz2
upgrade package vmime
Diffstat (limited to 'src')
-rw-r--r--src/vmime-0.9.1-svn-r533-20100215.patch640
-rw-r--r--src/vmime-0.9.1-svn-r534-20100218.patch12
-rw-r--r--src/vmime-0.9.1-svn-r537-20100310.patch65
-rw-r--r--src/vmime-0.9.1-svn-r540-20100316.patch100
-rw-r--r--src/vmime-0.9.1-svn-r542-20100410.patch92
-rw-r--r--src/vmime-0.9.1-svn-r545-20100504.patch77
-rw-r--r--src/vmime-0.9.1-svn-r546-20100514.patch19
-rw-r--r--src/vmime-0.9.1-svn-r551-20100520.patch1337
-rw-r--r--src/vmime-0.9.1-svn-r553-20100521.patch280
-rw-r--r--src/vmime-0.9.1-svn-r555-20100523.patch721
-rw-r--r--src/vmime-1-fastforward.patch (renamed from src/vmime-0.9.1-svn-r529-20100210.patch)15735
11 files changed, 11797 insertions, 7281 deletions
diff --git a/src/vmime-0.9.1-svn-r533-20100215.patch b/src/vmime-0.9.1-svn-r533-20100215.patch
deleted file mode 100644
index 473f0e3..0000000
--- a/src/vmime-0.9.1-svn-r533-20100215.patch
+++ /dev/null
@@ -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)
diff --git a/src/vmime-0.9.1-svn-r534-20100218.patch b/src/vmime-0.9.1-svn-r534-20100218.patch
deleted file mode 100644
index 5a66916..0000000
--- a/src/vmime-0.9.1-svn-r534-20100218.patch
+++ /dev/null
@@ -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
- #
diff --git a/src/vmime-0.9.1-svn-r537-20100310.patch b/src/vmime-0.9.1-svn-r537-20100310.patch
deleted file mode 100644
index dbceb33..0000000
--- a/src/vmime-0.9.1-svn-r537-20100310.patch
+++ /dev/null
@@ -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;
- };
-
diff --git a/src/vmime-0.9.1-svn-r540-20100316.patch b/src/vmime-0.9.1-svn-r540-20100316.patch
deleted file mode 100644
index 1099956..0000000
--- a/src/vmime-0.9.1-svn-r540-20100316.patch
+++ /dev/null
@@ -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;
- }
diff --git a/src/vmime-0.9.1-svn-r542-20100410.patch b/src/vmime-0.9.1-svn-r542-20100410.patch
deleted file mode 100644
index 31762d6..0000000
--- a/src/vmime-0.9.1-svn-r542-20100410.patch
+++ /dev/null
@@ -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
-
diff --git a/src/vmime-0.9.1-svn-r545-20100504.patch b/src/vmime-0.9.1-svn-r545-20100504.patch
deleted file mode 100644
index 7e0bba3..0000000
--- a/src/vmime-0.9.1-svn-r545-20100504.patch
+++ /dev/null
@@ -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");
- }
-
-
diff --git a/src/vmime-0.9.1-svn-r546-20100514.patch b/src/vmime-0.9.1-svn-r546-20100514.patch
deleted file mode 100644
index f46e138..0000000
--- a/src/vmime-0.9.1-svn-r546-20100514.patch
+++ /dev/null
@@ -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')
- {
diff --git a/src/vmime-0.9.1-svn-r551-20100520.patch b/src/vmime-0.9.1-svn-r551-20100520.patch
deleted file mode 100644
index 8d55013..0000000
--- a/src/vmime-0.9.1-svn-r551-20100520.patch
+++ /dev/null
@@ -1,1337 +0,0 @@
-This file is part of mingw-cross-env.
-See doc/index.html for further information.
-
-diff -urN a/ChangeLog b/ChangeLog
---- a/ChangeLog 2010-05-21 09:06:26.955934365 +0200
-+++ b/ChangeLog 2010-05-21 09:07:53.363928193 +0200
-@@ -2,6 +2,11 @@
- VERSION 0.9.1svn
- ================
-
-+2010-05-18 Vincent Richard <vincent@vincent-richard.net>
-+
-+ * net/*: added helper function vmime::net::message::getParsedMessage()
-+ to construct a RFC-822 parsed message from a net message.
-+
- 2009-09-06 Vincent Richard <vincent@vincent-richard.net>
-
- * Relicensed VMime under the GNU GPL license version 3. Dual licensing
-diff -urN a/SConstruct b/SConstruct
---- a/SConstruct 2010-05-21 09:06:27.116428601 +0200
-+++ b/SConstruct 2010-05-21 09:07:53.367948000 +0200
-@@ -261,6 +261,9 @@
- 'net/imap/IMAPMessage.cpp', 'net/imap/IMAPMessage.hpp',
- 'net/imap/IMAPTag.cpp', 'net/imap/IMAPTag.hpp',
- 'net/imap/IMAPUtils.cpp', 'net/imap/IMAPUtils.hpp',
-+ 'net/imap/IMAPMessagePartContentHandler.cpp', 'net/imap/IMAPMessagePartContentHandler.hpp',
-+ 'net/imap/IMAPStructure.cpp', 'net/imap/IMAPStructure.hpp',
-+ 'net/imap/IMAPPart.cpp', 'net/imap/IMAPPart.hpp',
- 'net/imap/IMAPParser.hpp',
- ]
- ],
-@@ -959,6 +962,10 @@
- env = env.Clone()
- env.Append(LIBS = ['cppunit', 'dl', packageVersionedGenericName + '-debug', 'pthread'])
- env.Append(LIBPATH=['.'])
-+
-+ if sys.platform == "mac" or sys.platform == "darwin":
-+ env.Append(LIBS = ['iconv', 'gcrypt'])
-+
- Default(
- env.Program(
- target = 'run-tests',
-diff -urN a/src/bodyPart.cpp b/src/bodyPart.cpp
---- a/src/bodyPart.cpp 2010-05-21 09:06:26.964428162 +0200
-+++ b/src/bodyPart.cpp 2010-05-21 09:07:53.367948000 +0200
-@@ -37,6 +37,15 @@
- }
-
-
-+bodyPart::bodyPart(weak_ref <vmime::bodyPart> parentPart)
-+ : m_header(vmime::create <header>()),
-+ m_body(vmime::create <body>()),
-+ m_parent(parentPart)
-+{
-+ m_body->setParentPart(thisRef().dynamicCast <bodyPart>());
-+}
-+
-+
- void bodyPart::parse(const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
- {
-diff -urN a/src/headerField.cpp b/src/headerField.cpp
---- a/src/headerField.cpp 2010-05-21 09:06:27.120433672 +0200
-+++ b/src/headerField.cpp 2010-05-21 09:07:53.367948000 +0200
-@@ -300,7 +300,8 @@
- {
- std::vector <ref <const component> > list;
-
-- list.push_back(m_value);
-+ if (m_value)
-+ list.push_back(m_value);
-
- return (list);
- }
-diff -urN a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
---- a/src/net/imap/IMAPMessage.cpp 2010-05-21 09:06:26.984436060 +0200
-+++ b/src/net/imap/IMAPMessage.cpp 2010-05-21 09:07:53.363928193 +0200
-@@ -27,6 +27,9 @@
- #include "vmime/net/imap/IMAPStore.hpp"
- #include "vmime/net/imap/IMAPConnection.hpp"
- #include "vmime/net/imap/IMAPUtils.hpp"
-+#include "vmime/net/imap/IMAPStructure.hpp"
-+#include "vmime/net/imap/IMAPPart.hpp"
-+#include "vmime/net/imap/IMAPMessagePartContentHandler.hpp"
-
- #include <sstream>
- #include <iterator>
-@@ -38,198 +41,6 @@
- namespace imap {
-
-
--//
--// IMAPpart
--//
--
--class IMAPstructure;
--
--class IMAPpart : public part
--{
--private:
--
-- friend class vmime::creator;
--
-- IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
-- IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part);
--
--public:
--
-- ref <const structure> getStructure() const;
-- ref <structure> getStructure();
--
-- ref <const IMAPpart> getParent() const { return m_parent.acquire(); }
--
-- const mediaType& getType() const { return (m_mediaType); }
-- int getSize() const { return (m_size); }
-- int getNumber() const { return (m_number); }
--
-- ref <const header> getHeader() const
-- {
-- if (m_header == NULL)
-- throw exceptions::unfetched_object();
-- else
-- return m_header;
-- }
--
--
-- static ref <IMAPpart> create
-- (ref <IMAPpart> parent, const int number, const IMAPParser::body* body)
-- {
-- if (body->body_type_mpart())
-- {
-- ref <IMAPpart> part = vmime::create <IMAPpart>(parent, number, body->body_type_mpart());
-- part->m_structure = vmime::create <IMAPstructure>(part, body->body_type_mpart()->list());
--
-- return part;
-- }
-- else
-- {
-- return vmime::create <IMAPpart>(parent, number, body->body_type_1part());
-- }
-- }
--
--
-- header& getOrCreateHeader()
-- {
-- if (m_header != NULL)
-- return (*m_header);
-- else
-- return (*(m_header = vmime::create <header>()));
-- }
--
--private:
--
-- ref <IMAPstructure> m_structure;
-- weak_ref <IMAPpart> m_parent;
-- ref <header> m_header;
--
-- int m_number;
-- int m_size;
-- mediaType m_mediaType;
--};
--
--
--
--//
--// IMAPstructure
--//
--
--class IMAPstructure : public structure
--{
--public:
--
-- IMAPstructure()
-- {
-- }
--
-- IMAPstructure(const IMAPParser::body* body)
-- {
-- m_parts.push_back(IMAPpart::create(NULL, 0, body));
-- }
--
-- IMAPstructure(ref <IMAPpart> parent, const std::vector <IMAPParser::body*>& list)
-- {
-- int number = 0;
--
-- for (std::vector <IMAPParser::body*>::const_iterator
-- it = list.begin() ; it != list.end() ; ++it, ++number)
-- {
-- m_parts.push_back(IMAPpart::create(parent, number, *it));
-- }
-- }
--
--
-- ref <const part> getPartAt(const int x) const
-- {
-- return m_parts[x];
-- }
--
-- ref <part> getPartAt(const int x)
-- {
-- return m_parts[x];
-- }
--
-- int getPartCount() const
-- {
-- return m_parts.size();
-- }
--
--
-- static ref <IMAPstructure> emptyStructure()
-- {
-- return (m_emptyStructure);
-- }
--
--private:
--
-- static ref <IMAPstructure> m_emptyStructure;
--
-- std::vector <ref <IMAPpart> > m_parts;
--};
--
--
--ref <IMAPstructure> IMAPstructure::m_emptyStructure = vmime::create <IMAPstructure>();
--
--
--
--IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart)
-- : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
--{
-- m_mediaType = vmime::mediaType
-- ("multipart", mpart->media_subtype()->value());
--}
--
--
--IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part)
-- : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
--{
-- if (part->body_type_text())
-- {
-- m_mediaType = vmime::mediaType
-- ("text", part->body_type_text()->
-- media_text()->media_subtype()->value());
--
-- m_size = part->body_type_text()->body_fields()->body_fld_octets()->value();
-- }
-- else if (part->body_type_msg())
-- {
-- m_mediaType = vmime::mediaType
-- ("message", part->body_type_msg()->
-- media_message()->media_subtype()->value());
-- }
-- else
-- {
-- m_mediaType = vmime::mediaType
-- (part->body_type_basic()->media_basic()->media_type()->value(),
-- part->body_type_basic()->media_basic()->media_subtype()->value());
--
-- m_size = part->body_type_basic()->body_fields()->body_fld_octets()->value();
-- }
--
-- m_structure = NULL;
--}
--
--
--ref <const structure> IMAPpart::getStructure() const
--{
-- if (m_structure != NULL)
-- return (m_structure);
-- else
-- return (IMAPstructure::emptyStructure());
--}
--
--
--ref <structure> IMAPpart::getStructure()
--{
-- if (m_structure != NULL)
-- return (m_structure);
-- else
-- return (IMAPstructure::emptyStructure());
--}
--
--
--
- #ifndef VMIME_BUILDING_DOC
-
- //
-@@ -400,7 +211,22 @@
-
- extract(p, ossAdapter, NULL, 0, -1, true, true);
-
-- p.dynamicCast <IMAPpart>()->getOrCreateHeader().parse(oss.str());
-+ p.dynamicCast <IMAPPart>()->getOrCreateHeader().parse(oss.str());
-+}
-+
-+
-+void IMAPMessage::fetchPartHeaderForStructure(ref <structure> str)
-+{
-+ for (int i = 0, n = str->getPartCount() ; i < n ; ++i)
-+ {
-+ ref <class part> part = str->getPartAt(i);
-+
-+ // Fetch header of current part
-+ fetchPartHeader(part);
-+
-+ // Fetch header of sub-parts
-+ fetchPartHeaderForStructure(part->getStructure());
-+ }
- }
-
-
-@@ -418,7 +244,7 @@
-
- if (p != NULL)
- {
-- ref <const IMAPpart> currentPart = p.dynamicCast <const IMAPpart>();
-+ ref <const IMAPPart> currentPart = p.dynamicCast <const IMAPPart>();
- std::vector <int> numbers;
-
- numbers.push_back(currentPart->getNumber());
-@@ -446,8 +272,17 @@
- command << "FETCH " << m_num << " BODY";
- if (peek) command << ".PEEK";
- command << "[";
-- command << section.str();
-- if (headerOnly) command << ".MIME"; // "MIME" not "HEADER" for parts
-+
-+ if (section.str().empty() && headerOnly)
-+ {
-+ command << "HEADER";
-+ }
-+ else
-+ {
-+ command << section.str();
-+ if (headerOnly) command << ".MIME"; // "MIME" not "HEADER" for parts
-+ }
-+
- command << "]";
-
- if (start != 0 || length != -1)
-@@ -621,7 +456,7 @@
- }
- case IMAPParser::msg_att_item::BODY_STRUCTURE:
- {
-- m_structure = vmime::create <IMAPstructure>((*it)->body());
-+ m_structure = vmime::create <IMAPStructure>((*it)->body());
- break;
- }
- case IMAPParser::msg_att_item::RFC822_HEADER:
-@@ -796,6 +631,80 @@
- }
-
-
-+void IMAPMessage::constructParsedMessage(ref <bodyPart> parentPart, ref <structure> str, int level)
-+{
-+ if (level == 0)
-+ {
-+ ref <class part> part = str->getPartAt(0);
-+
-+ // Copy header
-+ ref <const header> hdr = part->getHeader();
-+ parentPart->getHeader()->copyFrom(*hdr);
-+
-+ // Initialize body
-+ parentPart->getBody()->setContents
-+ (vmime::create <IMAPMessagePartContentHandler>
-+ (thisRef().dynamicCast <IMAPMessage>(),
-+ part, parentPart->getBody()->getEncoding()));
-+
-+ constructParsedMessage(parentPart, part->getStructure(), 1);
-+ }
-+ else
-+ {
-+ for (int i = 0, n = str->getPartCount() ; i < n ; ++i)
-+ {
-+ ref <class part> part = str->getPartAt(i);
-+
-+ ref <bodyPart> childPart = vmime::create <bodyPart>();
-+
-+ // Copy header
-+ ref <const header> hdr = part->getHeader();
-+ childPart->getHeader()->copyFrom(*hdr);
-+
-+ // Initialize body
-+ childPart->getBody()->setContents
-+ (vmime::create <IMAPMessagePartContentHandler>
-+ (thisRef().dynamicCast <IMAPMessage>(),
-+ part, childPart->getBody()->getEncoding()));
-+
-+ // Add child part
-+ parentPart->getBody()->appendPart(childPart);
-+
-+ // Construct sub parts
-+ constructParsedMessage(childPart, part->getStructure(), ++level);
-+ }
-+ }
-+}
-+
-+
-+ref <vmime::message> IMAPMessage::getParsedMessage()
-+{
-+ // Fetch structure
-+ ref <structure> structure = NULL;
-+
-+ try
-+ {
-+ structure = getStructure();
-+ }
-+ catch (exceptions::unfetched_object&)
-+ {
-+ fetch(m_folder.acquire(), IMAPFolder::FETCH_STRUCTURE);
-+ structure = getStructure();
-+ }
-+
-+ // Fetch header for each part
-+ fetchPartHeaderForStructure(structure);
-+
-+ // Construct message from structure
-+ ref <vmime::message> msg = vmime::create <vmime::message>();
-+
-+ constructParsedMessage(msg, structure);
-+
-+ return msg;
-+}
-+
-+
- } // imap
- } // net
- } // vmime
-+
-diff -urN a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp
---- a/src/net/imap/IMAPMessagePartContentHandler.cpp 1970-01-01 01:00:00.000000000 +0100
-+++ b/src/net/imap/IMAPMessagePartContentHandler.cpp 2010-05-21 09:07:53.363928193 +0200
-@@ -0,0 +1,179 @@
-+//
-+// VMime library (http://www.vmime.org)
-+// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
-+//
-+// This program is free software; you can redistribute it and/or
-+// modify it under the terms of the GNU General Public License as
-+// published by the Free Software Foundation; either version 3 of
-+// the License, or (at your option) any later version.
-+//
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+// General Public License for more details.
-+//
-+// You should have received a copy of the GNU General Public License along
-+// with this program; if not, write to the Free Software Foundation, Inc.,
-+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+//
-+// Linking this library statically or dynamically with other modules is making
-+// a combined work based on this library. Thus, the terms and conditions of
-+// the GNU General Public License cover the whole combination.
-+//
-+
-+#include "vmime/net/imap/IMAPMessagePartContentHandler.hpp"
-+
-+
-+namespace vmime {
-+namespace net {
-+namespace imap {
-+
-+
-+IMAPMessagePartContentHandler::IMAPMessagePartContentHandler
-+ (ref <IMAPMessage> msg, ref <class part> part, const vmime::encoding& encoding)
-+ : m_message(msg), m_part(part), m_encoding(encoding)
-+{
-+}
-+
-+
-+ref <contentHandler> IMAPMessagePartContentHandler::clone() const
-+{
-+ return create <IMAPMessagePartContentHandler>
-+ (m_message.acquire().constCast <IMAPMessage>(),
-+ m_part.acquire().constCast <part>(),
-+ m_encoding);
-+}
-+
-+
-+void IMAPMessagePartContentHandler::generate
-+ (utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength) const
-+{
-+ ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>();
-+ ref <part> part = m_part.acquire().constCast <class part>();
-+
-+ // Data is already encoded
-+ if (isEncoded())
-+ {
-+ // The data is already encoded but the encoding specified for
-+ // the generation is different from the current one. We need
-+ // to re-encode data: decode from input buffer to temporary
-+ // buffer, and then re-encode to output stream...
-+ if (m_encoding != enc)
-+ {
-+ // Extract part contents to temporary buffer
-+ std::ostringstream oss;
-+ utility::outputStreamAdapter tmp(oss);
-+
-+ msg->extractPart(part, tmp, NULL);
-+
-+ // Decode to another temporary buffer
-+ utility::inputStreamStringProxyAdapter in(oss.str());
-+
-+ std::ostringstream oss2;
-+ utility::outputStreamAdapter tmp2(oss2);
-+
-+ ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder();
-+ theDecoder->decode(in, tmp2);
-+
-+ // Reencode to output stream
-+ string str = oss2.str();
-+ utility::inputStreamStringAdapter tempIn(str);
-+
-+ ref <utility::encoder::encoder> theEncoder = enc.getEncoder();
-+ theEncoder->getProperties()["maxlinelength"] = maxLineLength;
-+ theEncoder->encode(tempIn, os);
-+ }
-+ // No encoding to perform
-+ else
-+ {
-+ msg->extractPart(part, os);
-+ }
-+ }
-+ // Need to encode data before
-+ else
-+ {
-+ // Extract part contents to temporary buffer
-+ std::ostringstream oss;
-+ utility::outputStreamAdapter tmp(oss);
-+
-+ msg->extractPart(part, tmp, NULL);
-+
-+ // Encode temporary buffer to output stream
-+ ref <utility::encoder::encoder> theEncoder = enc.getEncoder();
-+ theEncoder->getProperties()["maxlinelength"] = maxLineLength;
-+
-+ utility::inputStreamStringAdapter is(oss.str());
-+
-+ theEncoder->encode(is, os);
-+ }
-+}
-+
-+
-+void IMAPMessagePartContentHandler::extract
-+ (utility::outputStream& os, utility::progressListener* progress) const
-+{
-+ ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>();
-+ ref <part> part = m_part.acquire().constCast <class part>();
-+
-+ // No decoding to perform
-+ if (!isEncoded())
-+ {
-+ msg->extractPart(part, os, progress);
-+ }
-+ // Need to decode data
-+ else
-+ {
-+ // Extract part contents to temporary buffer
-+ std::ostringstream oss;
-+ utility::outputStreamAdapter tmp(oss);
-+
-+ msg->extractPart(part, tmp, NULL);
-+
-+ // Encode temporary buffer to output stream
-+ utility::inputStreamStringAdapter is(oss.str());
-+ utility::progressListenerSizeAdapter plsa(progress, getLength());
-+
-+ ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder();
-+ theDecoder->decode(is, os, &plsa);
-+ }
-+}
-+
-+
-+void IMAPMessagePartContentHandler::extractRaw
-+ (utility::outputStream& os, utility::progressListener* progress) const
-+{
-+ ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>();
-+ ref <part> part = m_part.acquire().constCast <class part>();
-+
-+ msg->extractPart(part, os, progress);
-+}
-+
-+
-+string::size_type IMAPMessagePartContentHandler::getLength() const
-+{
-+ return m_part.acquire()->getSize();
-+}
-+
-+
-+bool IMAPMessagePartContentHandler::isEncoded() const
-+{
-+ return m_encoding != NO_ENCODING;
-+}
-+
-+
-+const vmime::encoding& IMAPMessagePartContentHandler::getEncoding() const
-+{
-+ return m_encoding;
-+}
-+
-+
-+bool IMAPMessagePartContentHandler::isEmpty() const
-+{
-+ return getLength() == 0;
-+}
-+
-+
-+} // imap
-+} // net
-+} // vmime
-+
-diff -urN a/src/net/imap/IMAPPart.cpp b/src/net/imap/IMAPPart.cpp
---- a/src/net/imap/IMAPPart.cpp 1970-01-01 01:00:00.000000000 +0100
-+++ b/src/net/imap/IMAPPart.cpp 2010-05-21 09:07:53.367948000 +0200
-@@ -0,0 +1,152 @@
-+//
-+// VMime library (http://www.vmime.org)
-+// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
-+//
-+// This program is free software; you can redistribute it and/or
-+// modify it under the terms of the GNU General Public License as
-+// published by the Free Software Foundation; either version 3 of
-+// the License, or (at your option) any later version.
-+//
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+// General Public License for more details.
-+//
-+// You should have received a copy of the GNU General Public License along
-+// with this program; if not, write to the Free Software Foundation, Inc.,
-+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+//
-+// Linking this library statically or dynamically with other modules is making
-+// a combined work based on this library. Thus, the terms and conditions of
-+// the GNU General Public License cover the whole combination.
-+//
-+
-+#include "vmime/net/imap/IMAPPart.hpp"
-+#include "vmime/net/imap/IMAPStructure.hpp"
-+
-+
-+namespace vmime {
-+namespace net {
-+namespace imap {
-+
-+
-+IMAPPart::IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_mpart* mpart)
-+ : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
-+{
-+ m_mediaType = vmime::mediaType
-+ ("multipart", mpart->media_subtype()->value());
-+}
-+
-+
-+IMAPPart::IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_1part* part)
-+ : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
-+{
-+ if (part->body_type_text())
-+ {
-+ m_mediaType = vmime::mediaType
-+ ("text", part->body_type_text()->
-+ media_text()->media_subtype()->value());
-+
-+ m_size = part->body_type_text()->body_fields()->body_fld_octets()->value();
-+ }
-+ else if (part->body_type_msg())
-+ {
-+ m_mediaType = vmime::mediaType
-+ ("message", part->body_type_msg()->
-+ media_message()->media_subtype()->value());
-+ }
-+ else
-+ {
-+ m_mediaType = vmime::mediaType
-+ (part->body_type_basic()->media_basic()->media_type()->value(),
-+ part->body_type_basic()->media_basic()->media_subtype()->value());
-+
-+ m_size = part->body_type_basic()->body_fields()->body_fld_octets()->value();
-+ }
-+
-+ m_structure = NULL;
-+}
-+
-+
-+ref <const structure> IMAPPart::getStructure() const
-+{
-+ if (m_structure != NULL)
-+ return m_structure;
-+ else
-+ return IMAPStructure::emptyStructure();
-+}
-+
-+
-+ref <structure> IMAPPart::getStructure()
-+{
-+ if (m_structure != NULL)
-+ return m_structure;
-+ else
-+ return IMAPStructure::emptyStructure();
-+}
-+
-+
-+ref <const IMAPPart> IMAPPart::getParent() const
-+{
-+ return m_parent.acquire();
-+}
-+
-+
-+const mediaType& IMAPPart::getType() const
-+{
-+ return m_mediaType;
-+}
-+
-+
-+int IMAPPart::getSize() const
-+{
-+ return m_size;
-+}
-+
-+
-+int IMAPPart::getNumber() const
-+{
-+ return m_number;
-+}
-+
-+
-+ref <const header> IMAPPart::getHeader() const
-+{
-+ if (m_header == NULL)
-+ throw exceptions::unfetched_object();
-+ else
-+ return m_header;
-+}
-+
-+
-+// static
-+ref <IMAPPart> IMAPPart::create
-+ (ref <IMAPPart> parent, const int number, const IMAPParser::body* body)
-+{
-+ if (body->body_type_mpart())
-+ {
-+ ref <IMAPPart> part = vmime::create <IMAPPart>(parent, number, body->body_type_mpart());
-+ part->m_structure = vmime::create <IMAPStructure>(part, body->body_type_mpart()->list());
-+
-+ return part;
-+ }
-+ else
-+ {
-+ return vmime::create <IMAPPart>(parent, number, body->body_type_1part());
-+ }
-+}
-+
-+
-+header& IMAPPart::getOrCreateHeader()
-+{
-+ if (m_header != NULL)
-+ return *m_header;
-+ else
-+ return *(m_header = vmime::create <header>());
-+}
-+
-+
-+} // imap
-+} // net
-+} // vmime
-+
-diff -urN a/src/net/imap/IMAPStructure.cpp b/src/net/imap/IMAPStructure.cpp
---- a/src/net/imap/IMAPStructure.cpp 1970-01-01 01:00:00.000000000 +0100
-+++ b/src/net/imap/IMAPStructure.cpp 2010-05-21 09:07:53.363928193 +0200
-@@ -0,0 +1,85 @@
-+//
-+// VMime library (http://www.vmime.org)
-+// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
-+//
-+// This program is free software; you can redistribute it and/or
-+// modify it under the terms of the GNU General Public License as
-+// published by the Free Software Foundation; either version 3 of
-+// the License, or (at your option) any later version.
-+//
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+// General Public License for more details.
-+//
-+// You should have received a copy of the GNU General Public License along
-+// with this program; if not, write to the Free Software Foundation, Inc.,
-+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+//
-+// Linking this library statically or dynamically with other modules is making
-+// a combined work based on this library. Thus, the terms and conditions of
-+// the GNU General Public License cover the whole combination.
-+//
-+
-+#include "vmime/net/imap/IMAPStructure.hpp"
-+#include "vmime/net/imap/IMAPPart.hpp"
-+
-+
-+namespace vmime {
-+namespace net {
-+namespace imap {
-+
-+
-+IMAPStructure::IMAPStructure()
-+{
-+}
-+
-+
-+IMAPStructure::IMAPStructure(const IMAPParser::body* body)
-+{
-+ m_parts.push_back(IMAPPart::create(NULL, 0, body));
-+}
-+
-+
-+IMAPStructure::IMAPStructure(ref <IMAPPart> parent, const std::vector <IMAPParser::body*>& list)
-+{
-+ int number = 0;
-+
-+ for (std::vector <IMAPParser::body*>::const_iterator
-+ it = list.begin() ; it != list.end() ; ++it, ++number)
-+ {
-+ m_parts.push_back(IMAPPart::create(parent, number, *it));
-+ }
-+}
-+
-+
-+ref <const part> IMAPStructure::getPartAt(const int x) const
-+{
-+ return m_parts[x];
-+}
-+
-+
-+ref <part> IMAPStructure::getPartAt(const int x)
-+{
-+ return m_parts[x];
-+}
-+
-+
-+int IMAPStructure::getPartCount() const
-+{
-+ return m_parts.size();
-+}
-+
-+
-+// static
-+ref <IMAPStructure> IMAPStructure::emptyStructure()
-+{
-+ static ref <IMAPStructure> emptyStructure = vmime::create <IMAPStructure>();
-+ return emptyStructure;
-+}
-+
-+
-+} // imap
-+} // net
-+} // vmime
-+
-diff -urN a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
---- a/src/net/maildir/maildirMessage.cpp 2010-05-21 09:06:26.988432541 +0200
-+++ b/src/net/maildir/maildirMessage.cpp 2010-05-21 09:07:53.363928193 +0200
-@@ -524,6 +524,20 @@
- }
-
-
-+ref <vmime::message> maildirMessage::getParsedMessage()
-+{
-+ std::ostringstream oss;
-+ utility::outputStreamAdapter os(oss);
-+
-+ extract(os);
-+
-+ vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
-+ msg->parse(oss.str());
-+
-+ return msg;
-+}
-+
-+
- } // maildir
- } // net
- } // vmime
-diff -urN a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
---- a/src/net/pop3/POP3Message.cpp 2010-05-21 09:06:26.991933216 +0200
-+++ b/src/net/pop3/POP3Message.cpp 2010-05-21 09:07:53.363928193 +0200
-@@ -218,6 +218,20 @@
- }
-
-
-+ref <vmime::message> POP3Message::getParsedMessage()
-+{
-+ std::ostringstream oss;
-+ utility::outputStreamAdapter os(oss);
-+
-+ extract(os);
-+
-+ vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
-+ msg->parse(oss.str());
-+
-+ return msg;
-+}
-+
-+
- } // pop3
- } // net
- } // vmime
-diff -urN a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
---- a/src/net/tls/TLSSession.cpp 2010-05-21 09:06:26.999930787 +0200
-+++ b/src/net/tls/TLSSession.cpp 2010-05-21 09:07:53.367948000 +0200
-@@ -27,6 +27,7 @@
- #include "vmime/config.hpp"
-
- #if VMIME_HAVE_PTHREAD
-+# include <pthread.h>
- # include <gcrypt.h>
- # include <errno.h>
- #endif // VMIME_HAVE_PTHREAD
-diff -urN a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
---- a/src/security/digest/sha1/sha1MessageDigest.cpp 2010-05-21 09:06:27.012432100 +0200
-+++ b/src/security/digest/sha1/sha1MessageDigest.cpp 2010-05-21 09:07:53.367948000 +0200
-@@ -135,7 +135,7 @@
-
- void sha1MessageDigest::finalize()
- {
-- unsigned long i, j;
-+ unsigned int i, j;
- unsigned char finalcount[8];
-
- for (i = 0 ; i < 8 ; i++)
-@@ -162,8 +162,8 @@
- i = j = 0;
-
- std::memset(m_buffer, 0, 64);
-- std::memset(m_state, 0, 5 * sizeof(unsigned long));
-- std::memset(m_count, 0, 2 * sizeof(unsigned long));
-+ std::memset(m_state, 0, 5 * sizeof(unsigned int));
-+ std::memset(m_count, 0, 2 * sizeof(unsigned int));
- std::memset(&finalcount, 0, 8);
- }
-
-@@ -192,17 +192,17 @@
- * This is the core of the algorithm.
- */
- void sha1MessageDigest::transform
-- (unsigned long state[5], const unsigned char buffer[64])
-+ (unsigned int state[5], const unsigned char buffer[64])
- {
-- unsigned long a, b, c, d, e;
-+ unsigned int a, b, c, d, e;
-
- typedef union
- {
- unsigned char c[64];
-- unsigned long l[16];
-+ unsigned int l[16];
- } CHAR64LONG16;
-
-- assert(sizeof(unsigned long) == 4);
-+ assert(sizeof(unsigned int) == 4);
-
- CHAR64LONG16* block;
- static unsigned char workspace[64];
-diff -urN a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
---- a/vmime/bodyPart.hpp 2010-05-21 09:06:27.043934681 +0200
-+++ b/vmime/bodyPart.hpp 2010-05-21 09:07:53.375934467 +0200
-@@ -46,6 +46,7 @@
- public:
-
- bodyPart();
-+ bodyPart(weak_ref <vmime::bodyPart> parentPart);
-
- /** Return the header section of this part.
- *
-diff -urN a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
---- a/vmime/contentHandler.hpp 2010-05-21 09:06:27.043934681 +0200
-+++ b/vmime/contentHandler.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -87,7 +87,8 @@
- virtual void extractRaw(utility::outputStream& os, utility::progressListener* progress = NULL) const = 0;
-
- /** Returns the actual length of data. WARNING: this can return 0 if no
-- * length was specified when setting data of this object.
-+ * length was specified when setting data of this object, or if the
-+ * length is not known).
- *
- * @return length of data
- */
-diff -urN a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
---- a/vmime/net/imap/IMAPMessage.hpp 2010-05-21 09:06:27.060431845 +0200
-+++ b/vmime/net/imap/IMAPMessage.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -28,6 +28,8 @@
- #include "vmime/net/message.hpp"
- #include "vmime/net/folder.hpp"
-
-+#include "vmime/net/imap/IMAPParser.hpp"
-+
-
- namespace vmime {
- namespace net {
-@@ -75,12 +77,29 @@
-
- void fetchPartHeader(ref <part> p);
-
-+ ref <vmime::message> getParsedMessage();
-+
- private:
-
- void fetch(ref <IMAPFolder> folder, const int options);
-
- void processFetchResponse(const int options, const IMAPParser::msg_att* msgAtt);
-
-+ /** Recursively fetch part header for all parts in the structure.
-+ *
-+ * @param str structure for which to fetch parts headers
-+ */
-+ void fetchPartHeaderForStructure(ref <structure> str);
-+
-+ /** Recursively contruct parsed message from structure.
-+ * Called by getParsedMessage().
-+ *
-+ * @param parentPart root body part (the message)
-+ * @param str structure for which to construct part
-+ * @param level current nesting level (0 is root)
-+ */
-+ void constructParsedMessage(ref <bodyPart> parentPart, ref <structure> str, int level = 0);
-+
- void extract(ref <const part> p, utility::outputStream& os, utility::progressListener* progress, const int start, const int length, const bool headerOnly, const bool peek) const;
-
-
-diff -urN a/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
---- a/vmime/net/imap/IMAPMessagePartContentHandler.hpp 1970-01-01 01:00:00.000000000 +0100
-+++ b/vmime/net/imap/IMAPMessagePartContentHandler.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -0,0 +1,73 @@
-+//
-+// VMime library (http://www.vmime.org)
-+// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
-+//
-+// This program is free software; you can redistribute it and/or
-+// modify it under the terms of the GNU General Public License as
-+// published by the Free Software Foundation; either version 3 of
-+// the License, or (at your option) any later version.
-+//
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+// General Public License for more details.
-+//
-+// You should have received a copy of the GNU General Public License along
-+// with this program; if not, write to the Free Software Foundation, Inc.,
-+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+//
-+// Linking this library statically or dynamically with other modules is making
-+// a combined work based on this library. Thus, the terms and conditions of
-+// the GNU General Public License cover the whole combination.
-+//
-+
-+#ifndef VMIME_NET_IMAP_IMAPMESSAGEPARTCONTENTHANDLER_HPP_INCLUDED
-+#define VMIME_NET_IMAP_IMAPMESSAGEPARTCONTENTHANDLER_HPP_INCLUDED
-+
-+
-+#include "vmime/contentHandler.hpp"
-+#include "vmime/net/imap/IMAPMessage.hpp"
-+
-+
-+namespace vmime {
-+namespace net {
-+namespace imap {
-+
-+
-+class IMAPMessagePartContentHandler : public contentHandler
-+{
-+public:
-+
-+ IMAPMessagePartContentHandler(ref <IMAPMessage> msg, ref <class part> part, const vmime::encoding& encoding);
-+
-+ ref <contentHandler> clone() const;
-+
-+ void generate(utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength = lineLengthLimits::infinite) const;
-+
-+ void extract(utility::outputStream& os, utility::progressListener* progress = NULL) const;
-+ void extractRaw(utility::outputStream& os, utility::progressListener* progress = NULL) const;
-+
-+ string::size_type getLength() const;
-+
-+ bool isEncoded() const;
-+
-+ const vmime::encoding& getEncoding() const;
-+
-+ bool isEmpty() const;
-+
-+private:
-+
-+ weak_ref <IMAPMessage> m_message;
-+ weak_ref <part> m_part;
-+
-+ vmime::encoding m_encoding;
-+};
-+
-+
-+} // imap
-+} // net
-+} // vmime
-+
-+
-+#endif // VMIME_NET_IMAP_IMAPMESSAGEPARTCONTENTHANDLER_HPP_INCLUDED
-+
-diff -urN a/vmime/net/imap/IMAPPart.hpp b/vmime/net/imap/IMAPPart.hpp
---- a/vmime/net/imap/IMAPPart.hpp 1970-01-01 01:00:00.000000000 +0100
-+++ b/vmime/net/imap/IMAPPart.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -0,0 +1,88 @@
-+//
-+// VMime library (http://www.vmime.org)
-+// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
-+//
-+// This program is free software; you can redistribute it and/or
-+// modify it under the terms of the GNU General Public License as
-+// published by the Free Software Foundation; either version 3 of
-+// the License, or (at your option) any later version.
-+//
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+// General Public License for more details.
-+//
-+// You should have received a copy of the GNU General Public License along
-+// with this program; if not, write to the Free Software Foundation, Inc.,
-+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+//
-+// Linking this library statically or dynamically with other modules is making
-+// a combined work based on this library. Thus, the terms and conditions of
-+// the GNU General Public License cover the whole combination.
-+//
-+
-+#ifndef VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED
-+#define VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED
-+
-+
-+#include "vmime/net/message.hpp"
-+
-+#include "vmime/net/imap/IMAPParser.hpp"
-+
-+
-+namespace vmime {
-+namespace net {
-+namespace imap {
-+
-+
-+class IMAPStructure;
-+
-+
-+class IMAPPart : public part
-+{
-+private:
-+
-+ friend class vmime::creator;
-+
-+ IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
-+ IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_1part* part);
-+
-+public:
-+
-+ ref <const structure> getStructure() const;
-+ ref <structure> getStructure();
-+
-+ ref <const IMAPPart> getParent() const;
-+
-+ const mediaType& getType() const;
-+ int getSize() const;
-+ int getNumber() const;
-+
-+ ref <const header> getHeader() const;
-+
-+
-+ static ref <IMAPPart> create
-+ (ref <IMAPPart> parent, const int number, const IMAPParser::body* body);
-+
-+
-+ header& getOrCreateHeader();
-+
-+private:
-+
-+ ref <IMAPStructure> m_structure;
-+ weak_ref <IMAPPart> m_parent;
-+ ref <header> m_header;
-+
-+ int m_number;
-+ int m_size;
-+ mediaType m_mediaType;
-+};
-+
-+
-+} // imap
-+} // net
-+} // vmime
-+
-+
-+#endif // VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED
-+
-diff -urN a/vmime/net/imap/IMAPStructure.hpp b/vmime/net/imap/IMAPStructure.hpp
---- a/vmime/net/imap/IMAPStructure.hpp 1970-01-01 01:00:00.000000000 +0100
-+++ b/vmime/net/imap/IMAPStructure.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -0,0 +1,67 @@
-+//
-+// VMime library (http://www.vmime.org)
-+// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
-+//
-+// This program is free software; you can redistribute it and/or
-+// modify it under the terms of the GNU General Public License as
-+// published by the Free Software Foundation; either version 3 of
-+// the License, or (at your option) any later version.
-+//
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+// General Public License for more details.
-+//
-+// You should have received a copy of the GNU General Public License along
-+// with this program; if not, write to the Free Software Foundation, Inc.,
-+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+//
-+// Linking this library statically or dynamically with other modules is making
-+// a combined work based on this library. Thus, the terms and conditions of
-+// the GNU General Public License cover the whole combination.
-+//
-+
-+#ifndef VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED
-+#define VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED
-+
-+
-+#include "vmime/net/message.hpp"
-+
-+#include "vmime/net/imap/IMAPParser.hpp"
-+
-+
-+namespace vmime {
-+namespace net {
-+namespace imap {
-+
-+
-+class IMAPPart;
-+
-+
-+class IMAPStructure : public structure
-+{
-+public:
-+
-+ IMAPStructure();
-+ IMAPStructure(const IMAPParser::body* body);
-+ IMAPStructure(ref <IMAPPart> parent, const std::vector <IMAPParser::body*>& list);
-+
-+ ref <const part> getPartAt(const int x) const;
-+ ref <part> getPartAt(const int x);
-+ int getPartCount() const;
-+
-+ static ref <IMAPStructure> emptyStructure();
-+
-+private:
-+
-+ std::vector <ref <IMAPPart> > m_parts;
-+};
-+
-+
-+} // imap
-+} // net
-+} // vmime
-+
-+
-+#endif // VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED
-+
-diff -urN a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp
---- a/vmime/net/maildir/maildirMessage.hpp 2010-05-21 09:06:27.064432936 +0200
-+++ b/vmime/net/maildir/maildirMessage.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -75,6 +75,8 @@
-
- void fetchPartHeader(ref <part> p);
-
-+ ref <vmime::message> getParsedMessage();
-+
- private:
-
- void fetch(ref <maildirFolder> folder, const int options);
-diff -urN a/vmime/net/message.hpp b/vmime/net/message.hpp
---- a/vmime/net/message.hpp 2010-05-21 09:06:27.067930607 +0200
-+++ b/vmime/net/message.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -31,6 +31,8 @@
- #include "vmime/utility/progressListener.hpp"
- #include "vmime/utility/stream.hpp"
-
-+#include "vmime/message.hpp"
-+
-
- namespace vmime {
- namespace net {
-@@ -286,6 +288,16 @@
- * @param p the part for which to fetch the header
- */
- virtual void fetchPartHeader(ref <part> p) = 0;
-+
-+ /** Get the RFC-822 message for this abstract message.
-+ * Warning: This may require getting some data (ie: structure and headers) from
-+ * the server, which is done automatically. Actual message contents (ie: body)
-+ * will not be fetched if possible (IMAP allows it, whereas POP3 will require
-+ * to fetch the whole message).
-+ *
-+ * @return a RFC-822-parsed message
-+ */
-+ virtual ref <vmime::message> getParsedMessage() = 0;
- };
-
-
-diff -urN a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
---- a/vmime/net/pop3/POP3Message.hpp 2010-05-21 09:06:27.067930607 +0200
-+++ b/vmime/net/pop3/POP3Message.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -77,6 +77,8 @@
-
- void fetchPartHeader(ref <part> p);
-
-+ ref <vmime::message> getParsedMessage();
-+
- private:
-
- void fetch(ref <POP3Folder> folder, const int options);
-diff -urN a/vmime/security/digest/sha1/sha1MessageDigest.hpp b/vmime/security/digest/sha1/sha1MessageDigest.hpp
---- a/vmime/security/digest/sha1/sha1MessageDigest.hpp 2010-05-21 09:06:27.088435636 +0200
-+++ b/vmime/security/digest/sha1/sha1MessageDigest.hpp 2010-05-21 09:07:53.371933656 +0200
-@@ -59,10 +59,10 @@
-
- void init();
-
-- static void transform(unsigned long state[5], const byte_t buffer[64]);
-+ static void transform(unsigned int state[5], const byte_t buffer[64]);
-
-- unsigned long m_state[5];
-- unsigned long m_count[2];
-+ unsigned int m_state[5];
-+ unsigned int m_count[2];
- byte_t m_buffer[64];
-
- byte_t m_digest[20];
diff --git a/src/vmime-0.9.1-svn-r553-20100521.patch b/src/vmime-0.9.1-svn-r553-20100521.patch
deleted file mode 100644
index 7696ffe..0000000
--- a/src/vmime-0.9.1-svn-r553-20100521.patch
+++ /dev/null
@@ -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;
diff --git a/src/vmime-0.9.1-svn-r555-20100523.patch b/src/vmime-0.9.1-svn-r555-20100523.patch
deleted file mode 100644
index 446740c..0000000
--- a/src/vmime-0.9.1-svn-r555-20100523.patch
+++ /dev/null
@@ -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
diff --git a/src/vmime-0.9.1-svn-r529-20100210.patch b/src/vmime-1-fastforward.patch
index 1ae25fd..e3f5852 100644
--- a/src/vmime-0.9.1-svn-r529-20100210.patch
+++ b/src/vmime-1-fastforward.patch
@@ -1,9 +1,3492 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
-diff -urN a/AUTHORS b/AUTHORS
---- a/AUTHORS 2008-07-11 20:42:32.000000000 +0200
-+++ b/AUTHORS 2010-02-09 14:34:54.000000000 +0100
+Fast-forward to latest vmime 0.9.1 from svn
+http://sourceforge.net/projects/vmime/develop
+
+Produced with this script:
+#--------------------------------------------------------------------#
+#!/bin/bash
+
+(
+ echo "This file is part of mingw-cross-env."
+ echo "See doc/index.html for further information."
+ echo
+ echo "Fast-forward to latest vmime 0.9.1 from svn"
+ echo "http://sourceforge.net/projects/vmime/develop"
+ echo
+ echo "Produced with this script:"
+ echo "#--------------------------------------------------------------------#"
+ cat "$0"
+ echo "#--------------------------------------------------------------------#"
+) > src/vmime-1-fastforward.patch
+
+# setup git svn clone
+#cd ~/projects/vmime/git
+#git svn clone -s https://vmime.svn.sourceforge.net/svnroot/vmime
+#git reset --hard
+#git tag -f v0.9.1-start `git svn log --show-commit | grep r482 | cut -d "|" -f 2`
+# get updates
+#git svn fetch
+#git svn rebase
+
+GITDIR=~/projects/vmime/git/vmime/vmime
+PKGDIR=libvmime-0.9.0
+
+rm -rf $PKGDIR
+tar xf pkg/$PKGDIR.tar.bz2
+
+(
+ cd $GITDIR
+ git reset --hard
+ git checkout master
+)
+
+# Create patch to reset the tarball tree to the
+# starting state in svn. This is actually one commit
+# before 0.9.1 started. This compensates for left out
+# and touched files. Only for files known to need it.
+lst="bootstrap \
+ doc/book/intro.tex \
+ doc/book/net.tex \
+ examples/viewer/viewer.cpp \
+ m4/acx_pthread.m4 \
+ m4/ost_posix.m4 \
+ m4/ost_prog.m4 \
+ m4/ost_pthread.m4 \
+ m4/ost_systime.m4"
+
+for a in $lst; do
+ if [ -f $PKGDIR/$a ]; then
+ cp $PKGDIR/$a $GITDIR/$a
+ else
+ rm $GITDIR/$a
+ fi
+done
+
+# write reset patch
+(
+ cd $GITDIR
+ echo
+ git diff --relative -R v0.9.1-start^ -- $lst
+) >> src/vmime-1-fastforward.patch
+
+(
+ cd $GITDIR
+ git reset --hard
+)
+
+# write fast forward commits
+(
+ cd $GITDIR
+ echo
+ git log --relative --reverse -p ^v0.9.1-start^ HEAD
+) >> src/vmime-1-fastforward.patch
+
+# check the results
+patch -d $PKGDIR -p1 -s < src/vmime-1-fastforward.patch
+diff -rq $GITDIR $PKGDIR
+#--------------------------------------------------------------------#
+
+diff --git b/bootstrap a/bootstrap
+index cef3171..457eaa8 100755
+--- b/bootstrap
++++ a/bootstrap
+@@ -40,6 +40,7 @@ if test $DIE = 0 ; then
+ || (echo "[NO]" ; cat bootstrap.tmpout ; rm -f bootstrap.tmpout ; not_a_command >& /dev/null) || DIE=1
+ fi
+
++# Bug with automake 1.10?
+ touch autotools/config.rpath
+
+ if test $DIE = 0 ; then
+diff --git b/doc/book/intro.tex a/doc/book/intro.tex
+new file mode 100644
+index 0000000..93a3675
+--- /dev/null
++++ a/doc/book/intro.tex
+@@ -0,0 +1,90 @@
++\chapter{Introduction}
++
++% ============================================================================
++\section{Overview}
++
++VMime is a powerful C++ class library for working with MIME messages and
++Internet messaging services like IMAP, POP or SMTP.
++
++With VMime you can parse, generate and modify messages, and also connect to
++store and transport services to receive or send messages over the Internet.
++The library offers all the features to build a complete mail client.
++
++The main objectives of this library are:
++
++\begin{itemize}
++\item fully RFC-compliant implementation;
++\item object-oriented and modular design;
++\item very easy-to-use (intuitive design);
++\item well documented code;
++\item very high reliability;
++\item maximum portability.
++\end{itemize}
++
++
++% ============================================================================
++\section{Features}
++
++\noindent MIME features:
++
++\begin{itemize}
++\item Full support for RFC-2822 and multipart messages (RFC-1521)
++\item Aggregate documents (MHTML) and embedded objects (RFC-2557)
++\item Message Disposition Notification (RFC-3798)
++\item 8-bit MIME (RFC-2047)
++\item Encoded word extensions (RFC-2231)
++\item Attachments
++\end{itemize}
++
++\noindent Network features:
++
++\begin{itemize}
++\item Support for IMAP, POP3 and maildir stores
++\item Support for SMTP and sendmail transport methods
++\item Extraction of whole message or specific parts
++\item TLS/SSL security layer
++\item SASL authentication
++\end{itemize}
++
++
++% ============================================================================
++\section{Copyright and license}
++
++VMime library is Free Software and is licensed under the terms of the GNU
++General Public License\footnote{See Appendix \ref{appendix_license} and
++\url{http://www.gnu.org/copyleft/gpl.html}} (GPL):
++
++\begin{verbatim}
++ Copyright (C) 2002-2008 Vincent Richard
++
++ VMime library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU General Public License as
++ published by the Free Software Foundation; either version 2 of
++ the License, or (at your option) any later version.
++
++ VMime is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ Linking this library statically or dynamically with other
++ modules is making a combined work based on this library.
++ Thus, the terms and conditions of the GNU General Public
++ License cover the whole combination.
++\end{verbatim}
++
++\newpage
++\noindent This document is released under the terms of the
++GNU Free Documentation
++License\footnote{See \url{http://www.gnu.org/copyleft/fdl.html}} (FDL):
++
++\begin{verbatim}
++ Copyright (C) 2004-2007 Vincent Richard
++
++ Permission is granted to copy, distribute and/or modify
++ this document under the terms of the GNU Free Documentation
++ License, Version 1.2 or any later version published by the
++ Free Software Foundation; with no Invariant Sections, no
++ Front-Cover Texts, and no Back-Cover Texts.
++\end{verbatim}
++
+diff --git b/doc/book/net.tex a/doc/book/net.tex
+new file mode 100644
+index 0000000..08b7df5
+--- /dev/null
++++ a/doc/book/net.tex
+@@ -0,0 +1,976 @@
++\chapter{Working with Messaging Services}
++
++% ============================================================================
++\section{Introduction}
++
++In addition to parsing and building MIME messages, VMime also offers a lot of
++features to work with messaging services. This includes connecting to remote
++messaging stores (like IMAP or POP3), local stores (maildir) and transport
++services (send messages over SMTP or local sendmail), through an unified
++interface (see Figure \ref{uml_messaging_module}). That means that you can
++use independently IMAP of POP3 without having to change any line of code.
++
++Source code of {\vexample Example6} covers all features presented in this
++chapter, so it is important you take some time to read it.
++
++\begin{figure}
++ \center\includegraphics[width=0.9\textwidth]
++ {images/messaging-services.png}
++ \caption{Overall structure of the messaging module}
++ \label{uml_messaging_module}
++\end{figure}
++
++The interface is composed of five classes:
++
++\begin{itemize}
++\item {\vcode vmime::net::service}: this is the base interface for a
++messaging service. It can be either a store service or a transport
++service.
++
++\item {\vcode vmime::net::serviceFactory}: create instances of a service.
++This is used internally by the session object (see below).
++
++\item {\vcode vmime::net::store}: interface for a store service. A store
++service offers access to a set of folders containing messages. This is
++used for IMAP, POP3 and maildir.
++
++\item {\vcode vmime::net::transport}: interface for a transport service.
++A transport service is capable of sending messages. This is used for
++SMTP and sendmail.
++
++\item {\vcode vmime::net::session}: a session oject is used to store the
++parameters used by a service (eg. connection parameters). Each service
++instance is associated with only one session. The session object is capable
++of creating instances of services.
++\end{itemize}
++
++The following classes are specific to store services:
++
++\begin{itemize}
++\item {\vcode vmime::net::folder}: a folder can either contain other folders
++or messages, or both.
++
++\item {\vcode vmime::net::message}: this is the interface for dealing with
++messages. For a given message, you can have access to its flags, its MIME
++structure and you can also extract the whole message data or given parts (if
++supported by the underlying protocol).
++\end{itemize}
++
++
++% ============================================================================
++\section{Working with sessions}
++
++\subsection{Setting properties} % --------------------------------------------
++
++Sessions are used to store configuration parameters for services. They
++contains a set of typed properties that can modify the behaviour of the
++services. Before using a messaging service, you must create and
++initialize a session object:
++
++\begin{lstlisting}
++vmime::ref <net::session> theSession = vmime::create <net::session>();
++\end{lstlisting}
++
++Session properties include:
++
++\begin{itemize}
++\item connection parameters: host and port to connect to;
++\item authentication parameters: user credentials required to use the
++service (if any);
++\item protocol-specific parameters: enable or disable extensions (eg. APOP
++support in POP3).
++\end{itemize}
++
++Properties are stored using a dotted notation, to specify the service type,
++the protocol name, the category and the name of the property:
++
++\begin{verbatim}
++ {service_type}.{protocol}.category.name
++\end{verbatim}
++
++An example of property is \emph{store.pop3.options.apop} (used to enable or
++disable the use of APOP authentication). The \emph{store.pop3} part is called
++the \emph{prefix}. This allow specifying different values for the same
++property depending on the protocol used.
++
++The session properties are stored in a {\vcode vmime::propertySet} object.
++To set the value of a property, you can use either:
++
++\begin{lstlisting}
++theSession->getProperties().setProperty("property-name", value);
++\end{lstlisting}
++
++or:
++
++\begin{lstlisting}
++theSession->getProperties()["property-name"] = value;
++\end{lstlisting}
++
++
++\subsection{Available properties} % ------------------------------------------
++
++Following is a list of available properties and the protocols they apply to,
++as the time of writing this documentation\footnote{You can get an up-to-date
++list of the properties by running \vexample{Example7}}. For better clarity,
++the prefixes do not appear in this table.
++
++\begin{table}[!ht]
++\noindent\begin{tabularx}{1.0\textwidth}{|l|c|X|c|c|c|c|c|c|c|c|}
++\hline
++ {\bf Property name} &
++ {\bf Type} &
++ {\bf Description} &
++ \verti{\bf POP3} &
++ \verti{\bf POP3S} &
++ \verti{\bf IMAP} &
++ \verti{\bf IMAPS} &
++ \verti{\bf SMTP} &
++ \verti{\bf SMTPS} &
++ \verti{\bf maildir} &
++ \verti{\bf sendmail} \\
++\hline
++\hline
++options.sasl & bool & Set to {\vcode true} to use SASL authentication, if
++available. & \vdot & \vdot & \vdot & \vdot & \vdot & \vdot & & \\
++\hline
++options.sasl.fallback & bool & Fail if SASL authentication failed (do not
++try other authentication mechanisms). & \vdot & \vdot & \vdot & \vdot &
++\vdot & \vdot & & \\
++\hline
++auth.username\footnote{You should use authenticators
++instead.\label{fn_auth_username}} & string & Set the username of the account
++to connect to. & \vdot & \vdot & \vdot & \vdot & \vdot & \vdot & & \\
++\hline
++auth.password\footref{fn_auth_username} & string & Set the password of the
++account. & \vdot & \vdot & \vdot & \vdot & \vdot & \vdot & & \\
++\hline
++connection.tls & bool & Set to {\vcode true} to start a secured connection
++using STARTTLS extension, if available. & \vdot & & \vdot & & \vdot & & & \\
++\hline
++connection.tls.required & bool & Fail if a secured connection cannot be
++started. & \vdot & & \vdot & & \vdot & & & \\
++\hline
++server.address & string & Server host name or IP address. &\vdot & \vdot &
++\vdot & \vdot & \vdot & \vdot & & \\
++\hline
++server.port & int & Server port. & \vdot & \vdot & \vdot & \vdot &
++\vdot & \vdot & & \\
++\hline
++server.rootpath & string & Root directory for mail repository (eg.
++\emph{/home/vincent/Mail}). & & & & & & & \vdot & \\
++\hline
++\end{tabularx}
++\caption{Properties common to all protocols}
++\end{table}
++
++\newpage
++These are the protocol-specific options:
++
++\begin{table}[!ht]
++\noindent\begin{tabularx}{1.0\textwidth}{|l|c|X|}
++\hline
++ {\bf Property name} &
++ {\bf Type} &
++ {\bf Description} \\
++% POP3/POP3S
++\hline
++\multicolumn{3}{|c|}{POP3, POP3S} \\
++\hline
++store.pop3.options.apop & bool & Enable or disable authentication with
++APOP (if SASL is enabled, this occurs after all SASL mechanisms have been
++tried). \\
++\hline
++store.pop3.options.apop.fallback & bool & If set to {\vcode true} and
++APOP fails, the authentication process fails (ie. unsecure plain text
++authentication is not used). \\
++\hline
++% SMTP
++\multicolumn{3}{|c|}{SMTP, SMTPS} \\
++\hline
++transport.smtp.options.need-authentication & bool & Set to \emph{true} if
++the server requires to authenticate before sending messages. \\
++\hline
++% sendmail
++\multicolumn{3}{|c|}{sendmail} \\
++\hline
++transport.sendmail.binpath & string & The path to the \emph{sendmail}
++executable on your system. The default is the one found by the configuration
++script when VMime was built. \\
++\hline
++\end{tabularx}
++\caption{Protocol-specific options}
++\end{table}
++
++
++\subsection{Instanciating services} % ----------------------------------------
++
++You can create a service either by specifying its protocol name, or by
++specifying the URL of the service. Creation by name is deprecated so
++this chapter only presents the latter option.
++
++The URL scheme for connecting to services is:
++
++\begin{verbatim}
++ protocol://[username[:password]@]host[:port]/[root-path]
++\end{verbatim}
++
++\vnote{For local services (ie. \emph{sendmail} and \emph{maildir}), the host
++part is not used, but it must not be empty (you can use "localhost").}
++
++The following table shows an example URL for each service:
++
++\noindent\begin{tabularx}{1.0\textwidth}{|c|X|}
++\hline
++ {\bf Service} &
++ {\bf Connection URL} \\
++\hline
++imap, imaps & {\tt imap://imap.example.com},
++{\tt imaps://vincent:pass@example.com} \\
++\hline
++pop3, pop3s & {\tt pop3://pop3.example.com} \\
++\hline
++smtp, smtps & {\tt smtp://smtp.example.com} \\
++\hline
++maildir & {\tt maildir://localhost/home/vincent/Mail} (host not used) \\
++\hline
++sendmail & {\tt sendmail://localhost} (host not used, always localhost) \\
++\hline
++\end{tabularx}
++
++\newpage
++
++When you have the connection URL, instanciating the service is quite simple.
++Depending on the type of service, you will use either {\vcode getStore()} or
++{\vcode getTransport()}. For example, for store services, use:
++
++\begin{lstlisting}
++vmime::utility:url url("imap://user:pass@imap.example.com");
++vmime::ref <vmime::net::store> st = sess->getStore(url);
++\end{lstlisting}
++
++and for transport services:
++
++\begin{lstlisting}
++vmime::utility:url url("smtp://smtp.example.com");
++vmime::ref <vmime::net::transport> tr = sess->getTransport(url);
++\end{lstlisting}
++
++
++% ============================================================================
++\section{User credentials and authenticators}
++
++Some services need some user credentials (eg. username and password) to open
++a session. In VMime, user credentials can be specified in the session
++properties or by using a custom authenticator (callback).
++
++\begin{lstlisting}[caption={Setting user credentials using session
++properties}]
++vmime::ref <vmime::net::session> sess; // Suppose we have a session
++
++sess->getProperties()["store.imap.auth.username"] = "vincent";
++sess->getProperties()["store.imap.auth.password"] = "my-password";
++\end{lstlisting}
++
++Although not recommended, you can also specify username and password
++directly in the connection URL,
++ie: \emph{imap://username:password@imap.example.com/}. This works only for
++services requiring an username and a password as user credentials, and no
++other information.
++
++Sometimes, it may not be very convenient to set username/password in the
++session properties, or not possible (eg. extended SASL mechanisms) . That's
++why VMime offers an alternate way of getting user credentials: the
++{\vcode authenticator} object. Basically, an authenticator is an object that
++can return user credentials on-demand (like a callback).
++
++Currently, there are two types of authenticator in VMime: a basic
++authenticator (class {\vcode vmime::security::authenticator}) and, if SASL
++support is enabled, a SASL authenticator
++(class {\vcode vmime::security::sasl::SASLAuthenticator}). Usually, you
++should use the default implementations, or at least make your own
++implementation inherit from them.
++
++The following example shows how to use a custom authenticator to request
++the user to enter her/his credentials:
++
++\begin{lstlisting}[caption={A simple interactive authenticator}]
++class myAuthenticator : public vmime::security::defaultAuthenticator
++{
++ const string getUsername() const
++ {
++ std::cout << "Enter your username: " << std::endl;
++
++ vmime::string res;
++ std::getline(std::cin, res);
++
++ return res;
++ }
++
++ const string getPassword() const
++ {
++ std::cout << "Enter your password: " << std::endl;
++
++ vmime::string res;
++ std::getline(std::cin, res);
++
++ return res;
++ }
++};
++\end{lstlisting}
++
++This is how to use it:
++
++\begin{lstlisting}
++// First, create a session
++vmime::ref <vmime::net::session> sess =
++ vmime::create <vmime::net::session>();
++
++// Next, initialize a service which will use our authenticator
++vmime::ref <vmime::net::store> st =
++ sess->getStore(vmime::utility::url("imap://imap.example.com"),
++ /* use our authenticator */ vmime::create <myAuthenticator>());
++\end{lstlisting}
++
++\vnote{An authenticator object should be used with one and only one service
++at a time. This is required because the authentication process may need to
++retrieve the service name (SASL).}
++
++Of course, this example is quite simplified. For example, if several
++authentication mechanisms are tried, the user may be requested to enter the
++same information multiple times. See {\vexample Example6} for a more complex
++implementation of an authenticator, with caching support.
++
++If you want to use SASL (ie. if \emph{options.sasl} is set to \emph{true}),
++your authenticator must inherit from
++{\vcode vmime::security::sasl::SASLAuthenticator} or
++{\vcode vmime::security::sasl::defaultSASLAuthenticator}, even if you do not
++use the SASL-specific methods {\vcode getAcceptableMechanisms()} and
++{\vcode setSASLMechanism()}. Have a look at {\vexample Example6} to see an
++implementation of an SASL authenticator.
++
++\begin{lstlisting}[caption={A simple SASL authenticator}]
++class mySASLAuthenticator : public vmime::security::sasl::defaultSASLAuthenticator
++{
++ typedef vmime::security::sasl::SASLMechanism mechanism; // save us typing
++
++ const std::vector <vmime::ref <mechanism > getAcceptableMechanisms
++ (const std::vector <vmime::ref <mechanism> >& available,
++ vmime::ref <mechanism> suggested) const
++ {
++ // Here, you can sort the SASL mechanisms in the order they will be
++ // tried. If no SASL mechanism is acceptable (ie. for example, not
++ // enough secure), you can return an empty list.
++ //
++ // If you do not want to bother with this, you can simply return
++ // the default list, which is ordered by security strength.
++ return defaultSASLAuthenticator::
++ getAcceptableMechanisms(available, suggested);
++ }
++
++ void setSASLMechanism(vmime::ref <mechanism> mech)
++ {
++ // This is called when the authentication process is going to
++ // try the specified mechanism.
++ //
++ // The mechanism name is in mech->getName()
++
++ defaultSASLAuthenticator::setSASLMechanism(mech);
++ }
++
++ // ...implement getUsername() and getPassword()...
++};
++\end{lstlisting}
++
++
++% ============================================================================
++\section{Using transport service}
++
++You have two possibilities for giving message data to the service when you
++want to send a message:
++
++\begin{itemize}
++\item either you have a reference to a message (type {\vcode vmime::message})
++and you can simply call {\vcode send(msg)};
++\item or you only have raw message data (as a string, for example), and you
++have to call the second overload of {\vcode send()}, which takes additional
++parameters (corresponding to message envelope);
++\end{itemize}
++
++The following example illustrates the use of a transport service to send a
++message using the second method:
++
++\begin{lstlisting}[caption={Using a transport service}]
++const vmime::string msgData =
++ "From: me@example.org \r\n"
++ "To: you@example.org \r\n"
++ "Date: Sun, Oct 30 2005 17:06:42 +0200 \r\n"
++ "Subject: Test \r\n"
++ "\r\n"
++ "Message body";
++
++// Create a new session
++vmime::utility::url url("smtp://example.com");
++
++vmime::ref <vmime::net::session> sess =
++ vmime::create <vmime::net::session>();
++
++// Create an instance of the transport service
++vmime::ref <vmime::net::transport> tr = sess->getTransport(url);
++
++// Connect it
++tr->connect();
++
++// Send the message
++vmime::utility::inputStreamStringAdapter is(msgData);
++
++vmime::mailbox from("me@example.org");
++vmime::mailboxList to;
++to.appendMailbox(vmime::create <vmime::mailbox>("you@example.org"));
++
++tr->send(
++ /* expeditor */ from,
++ /* recipient(s) */ to,
++ /* data */ is,
++ /* total length */ msgData.length());
++
++// We have finished using the service
++tr->disconnect();
++\end{lstlisting}
++
++\vnote{Exceptions can be thrown at any time when using a service. For better
++clarity, exceptions are not caught here, but be sure to catch them in your own
++application to provide error feedback to the user.}
++
++If you use SMTP, you can enable authentication by setting some properties
++on the session object ({\vcode service::setProperty()} is a shortcut for
++setting properties on the session with the correct prefix):
++
++\begin{lstlisting}
++tr->setProperty("options.need-authentication", true);
++tr->setProperty("auth.username", "user");
++tr->setProperty("auth.password", "password");
++\end{lstlisting}
++
++
++% ============================================================================
++\section{Using store service}
++
++\subsection{Connecting to a store} % -----------------------------------------
++
++The first basic step for using a store service is to connect to it. The
++following example shows how to initialize a session and instanciate the
++store service:
++
++\begin{lstlisting}[caption={Connecting to a store service}]
++// Create a new session
++vmime::utility::url url("imap://vincent:password@imap:example.org");
++
++vmime::ref <vmime::net::session> sess =
++ vmime::create <vmime::net::session>();
++
++// Create an instance of the transport service
++vmime::ref <vmime::net::store> store = sess->getStore(url);
++
++// Connect it
++store->connect();
++\end{lstlisting}
++
++\vnote{{\vexample Example6} contains a more complete example for connecting
++to a store service, with support for a custom authenticator.}
++
++\subsection{Opening a folder} % ----------------------------------------------
++
++You can open a folder using two different access modes: either in
++\emph{read-only} mode (where you can only read message flags and contents), or
++in \emph{read-write} mode (where you can read messages, but also delete them
++or add new ones). When you have a reference to a folder, simply call the
++{\vcode open()} method with the desired access mode:
++
++\begin{lstlisting}
++folder->open(vmime::net::folder::MODE_READ_WRITE);
++\end{lstlisting}
++
++\vnote{Not all stores support the \emph{read-write} mode. By default, if the
++\emph{read-write} mode is not available, the folder silently fall backs on
++the \emph{read-only} mode, unless the \emph{failIfModeIsNotAvailable} argument
++to {\vcode open()} is set to true.}
++
++Call {\vcode getDefaultFolder()} on the store to obtain a reference to the
++default folder, which is usually the INBOX folder (where messages arrive when
++they are received).
++
++You can also open a specific folder by specifying its path. The following
++example will open a folder named \emph{bar}, which is a child of \emph{foo}
++in the root folder:
++
++\begin{lstlisting}[caption={Opening a folder from its path}]
++vmime::net::folder::path path;
++path /= vmime::net::folder::path::component("foo");
++path /= vmime::net::folder::path::component("bar");
++
++vmime::ref <vmime::net::folder> fld = store->getFolder(path);
++fld->open(vmime::net::folder::MODE_READ_WRITE);
++\end{lstlisting}
++
++\vnote{You can specify a path as a string as there is no way to get the
++separator used to delimitate path components. Always use {\vcode operator/=}
++or {\vcode appendComponent}.}
++
++\vnote{Path components are of type {\vcode vmime::word}, which means that
++VMime supports folder names with extended characters, not only 7-bit
++US-ASCII. However, be careful that this may not be supported by the
++underlying store protocol (IMAP supports it, because it uses internally a
++modified UTF-7 encoding).}
++
++\subsection{Fetching messages} % ---------------------------------------------
++
++You can fetch some information about a message without having to download the
++whole message. Moreover, folders support fetching for multiple messages in
++a single request, for better performance. The following items are currently
++available for fetching:
++
++\begin{itemize}
++\item {\bf envelope}: sender, recipients, date and subject;
++\item {\bf structure}: MIME structure of the message;
++\item {\bf content-info}: content-type of the root part;
++\item {\bf flags}: message flags;
++\item {\bf size}: message size;
++\item {\bf header}: retrieve all the header fields of a message;
++\item {\bf uid}: unique identifier of a message;
++\item {\bf importance}: fetch header fields suitable for use with
++{\vcode misc::importanceHelper}.
++\end{itemize}
++
++\vnote{Not all services support all fetchable items. Call
++{\vcode getFetchCapabilities()} on a folder to know which information can be
++fetched by a service.}
++
++The following code shows how to list all the messages in a folder, and
++retrieve basic information to show them to the user:
++
++\begin{lstlisting}[caption={Fetching information about multiple messages}]
++std::vector <ref <vmime::net::message> > allMessages = folder->getMessages();
++
++folder->fetchMessages(allMessages,
++ vmime::net::folder::FETCH_FLAGS |
++ vmime::net::folder::FETCH_ENVELOPE);
++
++for (unsigned int i = 0 ; i < allMessages.size() ; ++i)
++{
++ vmime::ref <vmime::net::message> msg = allMessages[i];
++
++ const int flags = msg->getFlags();
++
++ std::cout << "Message " << i << ":" << std::endl;
++
++ if (flags & vmime::net::message::FLAG_SEEN)
++ std::cout << " - is read" << std::endl;
++ if (flags & vmime::net::message::FLAG_DELETED)
++ std::cout << " - is deleted" << std::endl;
++
++ vmime::ref <const vmime::header> hdr = msg->getHeader();
++
++ std::cout << " - sent on " << hdr->Date()->generate() << std::endl;
++ std::cout << " - sent by " << hdr->From()->generate() << std::endl;
++}
++\end{lstlisting}
++
++\subsection{Extracting messages and parts}
++
++To extract the whole contents of a message (including headers), use the
++{\vcode extract()} method on a {\vcode vmime::net::message} object. The
++following example extracts the first message in the default folder:
++
++\begin{lstlisting}[caption={Extracting messages}]
++// Get a reference to the folder and to its first message
++vmime::ref <vmime::net::folder> folder = store->getDefaultFolder();
++vmime::ref <vmime::net::message> msg = folder->getMessage(1);
++
++// Write the message contents to the standard output
++vmime::utility::outputStreamAdapter out(std::cout);
++msg->extract(out);
++\end{lstlisting}
++
++Some protocols (like IMAP) also support the extraction of specific MIME parts
++of a message without downloading the whole message. This can save bandwidth
++and time. The method {\vcode extractPart()} is used in this case:
++
++\begin{lstlisting}[caption={Extracting a specific MIME part of a message}]
++// Fetching structure is required before extracting a part
++folder->fetchMessage(msg, vmime::net::folder::FETCH_STRUCTURE);
++
++// Now, we can extract the part
++msg->extractPart(msg->getStructure()->getPartAt(0)->getPartAt(1));
++\end{lstlisting}
++
++Suppose we have a message with the following structure:
++
++\begin{verbatim}
++ multipart/mixed
++ text/html
++ image/jpeg [*]
++\end{verbatim}
++
++The previous example will extract the header and body of the \emph{image/jpeg}
++part.
++
++\subsection{Events} % --------------------------------------------------------
++
++As a result of executing some operation (or from time to time, even if no
++operation has been performed), a store service can send events to notify you
++that something has changed (eg. the number of messages in a folder). These
++events may allow you to update the user interface associated to a message
++store.
++
++Currently, there are three types of event:
++
++\begin{itemize}
++\item {\bf message change}: sent when the number of messages in a folder
++has changed (ie. some messages have been added or removed);
++\item {\bf message count change}: sent when one or more message(s) have
++changed (eg. flags or deleted status);
++\item {\bf folder change}: sent when a folder has been created, renamed or
++deleted.
++\end{itemize}
++
++You can register a listener for each event type by using the corresponding
++methods on a {\vcode folder} object: {\vcode addMessageChangedListener()},
++{\vcode addMessageCountListener()} or {\vcode addFolderListener()}. For more
++information, please read the class documentation for
++{\vcode vmime::net::events} namespace.
++
++
++% ============================================================================
++\section{Handling time-outs}
++
++Unexpected errors can occur while messaging services are performing
++operations and waiting a response from the server (eg. server stops
++responding, network link falls down). As all operations as synchronous,
++they can be ``blocked'' a long time before returning (in fact, they loop
++until they either receive a response from the server, or the underlying
++socket system returns an error).
++
++VMime provides a mechanism to control the duration of operations. This
++mechanism allows the program to cancel an operation that is currently
++running.
++
++An interface called {\vcode timeoutHandler} is provided:
++
++\begin{lstlisting}
++class timeoutHandler : public object
++{
++ /** Called to test if the time limit has been reached.
++ *
++ * @return true if the time-out delay is elapsed
++ */
++ virtual const bool isTimeOut() = 0;
++
++ /** Called to reset the time-out counter.
++ */
++ virtual void resetTimeOut() = 0;
++
++ /** Called when the time limit has been reached (when
++ * isTimeOut() returned true).
++ *
++ * @return true to continue (and reset the time-out)
++ * or false to cancel the current operation
++ */
++ virtual const bool handleTimeOut() = 0;
++};
++\end{lstlisting}
++
++While the operation runs, the service calls {\vcode isTimeout()} at variable
++intervals. If the function returns {\vcode true}, then
++{\vcode handleTimeout()} is called. If it also returns {\vcode true}, the
++operation is cancelled and an {\vcode operation\_timed\_out} exception is
++thrown. The function {\vcode resetTimeout()} is called each time data has
++been received from the server to reset time-out delay.
++
++The following example shows how to implement a simple time-out handler:
++
++\begin{lstlisting}[caption={Implementing a simple time-out handler}]
++class myTimeoutHandler : public vmime::net::timeoutHandler
++{
++public:
++
++ const bool isTimeOut()
++ {
++ return (getTime() >= m_last + 30); // 30 seconds time-out
++ }
++
++ void resetTimeOut()
++ {
++ m_last = getTime();
++ }
++
++ const bool handleTimeOut()
++ {
++ std::cout << "Operation timed out." << std::endl;
++ << "Press [Y] to continue, or [N] to "
++ << "cancel the operation." << std::endl;
++
++ std::string response;
++ std::cin >> response;
++
++ return (response == "y" || response == "Y");
++ }
++
++private:
++
++ const unsigned int getTime() const
++ {
++ return vmime::platform::getHandler()->getUnixTime();
++ }
++
++ unsigned int m_last;
++};
++\end{lstlisting}
++
++To make the service use your time-out handler, you need to write a factory
++class, to allow the service to create instances of the handler class. This
++is required because the service can use several connections to the server
++simultaneously, and each connection needs its own time-out handler.
++
++\begin{lstlisting}
++class myTimeoutHandlerFactory : public vmime::net::timeoutHandlerFactory
++{
++public:
++
++ ref <timeoutHandler> create()
++ {
++ return vmime::create <myTimeoutHandler>();
++ }
++};
++\end{lstlisting}
++
++Then, call the {\vcode setTimeoutHandlerFactory()} method on the service object
++to set the time-out handler factory to use during the session:
++
++\begin{lstlisting}
++theService->setTimeoutHandlerFactory(vmime::create <myTimeoutHandlerFactory>());
++\end{lstlisting}
++
++
++% ============================================================================
++\newpage
++\section{Secured connection using TLS/SSL}
++
++\subsection{Introduction} % --------------------------------------------------
++
++If you have enabled TLS support in VMime, you can configure messaging services
++so that they use a secured connection.
++
++Quoting from RFC-2246 - the TLS 1.0 protocol specification: \emph{`` The TLS
++protocol provides communications privacy over the Internet. The protocol
++allows client/server applications to communicate in a way that is designed
++to prevent eavesdropping, tampering, or message forgery.''}
++
++TLS has the following advantages:
++
++\begin{itemize}
++\item authentication: server identity can be verified;
++\item privacy: transmission of data between client and server cannot be read
++by someone in the middle of the connection;
++\item integrity: original data which is transferred between a client and a
++server can not be modified by an attacker without being detected.
++\end{itemize}
++
++\vnote{What is the difference between SSL and TLS? SSL is a protocol designed
++by Netscape. TLS is a standard protocol, and is partly based on version 3 of
++the SSL protocol. The two protocols are not interoperable, but TLS does
++support a mechanism to back down to SSL 3.}
++
++VMime offers two possibilities for using a secured connection:
++
++\begin{itemize}
++\item you can connect to a server listening on a special port (eg. IMAPS
++instead of IMAP): this is the classical use of SSL, but is now deprecated;
++\item connect to a server listening on the default port, and then begin a
++secured connection: this is STARTTLS.
++\end{itemize}
++
++
++\subsection{Setting up a secured connection} % -------------------------------
++
++\subsubsection{Connecting to a ``secured'' port} % ...........................
++
++To use the classical SSL/TLS way, simply use the ``S'' version of the protocol
++to connect to the server (eg. \emph{imaps} instead of \emph{imap}). This is
++currently available for SMTP, POP3 and IMAP.
++
++\begin{lstlisting}
++vmime::ref <vmime::net::store> store =
++ theSession->getStore(vmime::utility::url("imaps://example.org"));
++\end{lstlisting}
++
++\subsubsection{Using STARTTLS} % .............................................
++
++To make the service start a secured session using the STARTTLS method, simply
++set the \emph{connection.tls} property:
++
++\begin{lstlisting}
++theService->setProperty("connection.tls", true);
++\end{lstlisting}
++
++\vnote{If, for some reason, a secured connection cannot be started, the
++default behaviour is to fallback on a normal connection. To make
++{\vcode connect()} fail if STARTTLS fails, set the
++\emph{connection.tls.required} to \emph{true}.}
++
++\subsection{Certificate verification} % --------------------------------------
++
++\subsubsection{How it works} % ...............................................
++
++If you tried the previous examples, a
++{\vcode certificate\_verification\_exception} might have been thrown.
++This is because the default certificate verifier in VMime did not manage to
++verify the certificate, and so could not trust it.
++
++Basically, when you connect to a server using TLS, the server responds with
++a list of certificates, called a certificate chain (usually, certificates are
++of type X.509\footnote{And VMime currently supports only X.509 certificates}).
++The certificate chain is ordered so that the first certificate is the subject
++certificate, the second is the subject's issuer one, the third is the issuer's
++issuer, and so on.
++
++To decide whether the server can be trusted or not, you have to verify that
++\emph{each} certificate is valid (ie. is trusted). For more information
++about X.509 and certificate verification, see related articles on Wikipedia
++\footnote{See \url{http://wikipedia.org/wiki/Public\_key\_certificate}}.
++
++\subsubsection{Using the default certificate verifier} % .....................
++
++The default certificate verifier maintains a list of root (CAs) and user
++certificates that are trusted. By default, the list is empty. So, you have
++to initialize it before using the verifier.
++
++The algorithm\footnote{See
++\url{http://wikipedia.org/wiki/Certification\_path\_validation\_algorithm}}
++used is quite simple:
++
++\begin{enumerate}
++\item for every certificate in the chain, verify that the certificate has been
++issued by the next certificate in the chain;
++\item for every certificate in the chain, verify that the certificate is valid
++at the current time;
++\item decide whether the subject's certificate can be trusted:
++ \begin{itemize}
++ \item first, verify that the the last certificate in the chain was
++ issued by a third-party that we trust (root CAs);
++ \item if the issuer certificate cannot be verified against root CAs,
++ compare the subject's certificate against the trusted certificates
++ (the certificates the user has decided to trust).
++ \end{itemize}
++\end{enumerate}
++
++First, we need some code to load existing X.509 certificates:
++
++\begin{lstlisting}[caption={Reading a X.509 certificate from a file}]
++vmime::ref <vmime::security::cert::X509Certificate>
++ loadX509CertificateFromFile(const std::string& path)
++{
++ std::ifstream certFile;
++ certFile.open(path.c_str(), std::ios::in | std::ios::binary);
++
++ if (!certFile)
++ {
++ // ...handle error...
++ }
++
++ vmime::utility::inputStreamAdapter is(certFile);
++ vmime::ref <vmime::security::cert::X509Certificate> cert;
++
++ // Try DER format
++ cert = vmime::security::cert::X509Certificate::import
++ (is, vmime::security::cert::X509Certificate::FORMAT_DER);
++
++ if (cert != NULL)
++ return cert;
++
++ // Try PEM format
++ is.reset();
++ cert = vmime::security::cert::X509Certificate::import
++ (is, vmime::security::cert::X509Certificate::FORMAT_PEM);
++
++ return cert;
++}
++\end{lstlisting}
++
++Then, we can use the {\vcode loadX509CertificateFromFile} function to load
++certificates and initialize the certificate verifier:
++
++\begin{lstlisting}[caption={Using the default certificate verifier}]
++vmime::ref <vmime::security::cert::defaultCertificateVerifier> vrf =
++ vmime::create <vmime::security::cert::defaultCertificateVerifier>();
++
++// Load root CAs (such as Verisign or Thawte)
++std::vector <vmime::ref <vmime::security::cert::X509Certificate> > rootCAs;
++
++rootCAs.push_back(loadX509CertificateFromFile("/path/to/root-ca1.cer");
++rootCAs.push_back(loadX509CertificateFromFile("/path/to/root-ca2.cer");
++rootCAs.push_back(loadX509CertificateFromFile("/path/to/root-ca3.cer");
++
++vrf->setX509RootCAs(rootCAs);
++
++// Then, load certificates that the user explicitely chose to trust
++std::vector <vmime::ref <vmime::security::cert::X509Certificate> > trusted;
++
++trusted.push_back(loadX509CertificateFromFile("/path/to/trusted-site1.cer");
++trusted.push_back(loadX509CertificateFromFile("/path/to/trusted-site2.cer");
++
++vrf->setX509TrustedCerts(trusted);
++\end{lstlisting}
++
++
++\subsubsection{Writing your own certificate verifier} % ......................
++
++If you need to do more complex verifications on certificates, you will have to
++write your own verifier. Your verifier should inherit from the
++{\vcode vmime::security::cert::certificateVerifier} class and implement the
++method {\vcode verify()}. Then, if the specified certificate chain is trusted,
++simply return from the function, or else throw a
++{\vcode certificate\_verification\_exception}.
++
++The following example shows how to implement an interactive certificate
++verifier which relies on the user's decision, and nothing else (you SHOULD NOT
++use this in a production application as this is obviously a serious security
++issue):
++
++\begin{lstlisting}[caption={A custom certificate verifier}]
++class myCertVerifier : public vmime::security::cert::certificateVerifier
++{
++public:
++
++ void verify(vmime::ref <certificateChain> certs)
++ {
++ // Obtain the subject's certificate
++ vmime::ref <vmime::security::cert::certificate> cert = chain->getAt(0);
++
++ std::cout << std::endl;
++ std::cout << "Server sent a '" << cert->getType() << "'"
++ << " certificate." << std::endl;
++ std::cout << "Do you want to accept this certificate? (Y/n) ";
++ std::cout.flush();
++
++ std::string answer;
++ std::getline(std::cin, answer);
++
++ if (answer.length() != 0 && (answer[0] == 'Y' || answer[0] == 'y'))
++ return; // OK, we trust the certificate
++
++ // Don't trust this certificate
++ throw exceptions::certificate_verification_exception();
++ }
++};
++\end{lstlisting}
++
++\vnote{In production code, it may be a good idea to remember user's decisions
++about which certificates to trust and which not. See {\vexample Example6} for
++a basic cache implementation.}
++
++Finally, to make the service use your own certificate verifier, simply write:
++
++\begin{lstlisting}
++theService->setCertificateVerifier(vmime::create <myCertVerifier>());
++\end{lstlisting}
++
+diff --git b/examples/viewer/viewer.cpp a/examples/viewer/viewer.cpp
+new file mode 100644
+index 0000000..50862b3
+--- /dev/null
++++ a/examples/viewer/viewer.cpp
+@@ -0,0 +1,293 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 2 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++//
++// EXAMPLE DESCRIPTION:
++// ====================
++// A simple MIME viewer to show all the components of a message.
++// The user interface is written using GTK+ 2.6.
++//
++// For more information, please visit:
++// http://www.vmime.org/
++//
++
++#include <iostream>
++#include <fstream>
++#include <vector>
++
++#include <gtk/gtk.h>
++
++#include "vmime/vmime.hpp"
++#include "vmime/platforms/posix/posixHandler.hpp"
++
++
++
++GtkWidget* window = NULL;
++GtkWidget* treeView = NULL;
++GtkWidget* textArea = NULL;
++
++GtkTreeStore* treeModel = NULL;
++
++vmime::ref <vmime::message> currentMessage = NULL;
++
++
++
++void insertRowInModel(GtkTreeStore* model, vmime::ref <const vmime::component> comp, GtkTreeIter* parent = NULL)
++{
++ GtkTreeIter iter;
++
++ gtk_tree_store_append(model, &iter, parent);
++ gtk_tree_store_set(model, &iter, 0, typeid(*comp).name(), 1, comp.get(), -1);
++
++ const std::vector <vmime::ref <const vmime::component> > children = comp->getChildComponents();
++
++ for (int i = 0 ; i < children.size() ; ++i)
++ {
++ insertRowInModel(model, children[i], &iter);
++ }
++}
++
++
++void updateTreeView()
++{
++ GtkTreeStore* model = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(treeView)));
++
++ g_object_ref(model);
++ gtk_tree_view_set_model(GTK_TREE_VIEW(treeView), NULL);
++
++ gtk_tree_store_clear(model);
++
++ insertRowInModel(model, currentMessage);
++
++ gtk_tree_view_set_model(GTK_TREE_VIEW(treeView), GTK_TREE_MODEL(model));
++ g_object_unref(model);
++}
++
++
++static void treeViewSelChanged(GtkTreeView* treeView, gpointer userData)
++{
++ GtkTreePath* path = NULL;
++ GtkTreeViewColumn* col = NULL;
++
++ gtk_tree_view_get_cursor(treeView, &path, &col);
++
++ GtkTreeIter iter;
++ gtk_tree_model_get_iter(GTK_TREE_MODEL(treeModel), &iter, path);
++
++ vmime::component* comp = NULL;
++ gtk_tree_model_get(GTK_TREE_MODEL(treeModel), &iter, 1, &comp, -1);
++
++ GtkTextBuffer* textBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textArea));
++ GtkTextIter start, end;
++
++ gtk_text_buffer_get_iter_at_offset(textBuffer, &start, comp->getParsedOffset());
++ gtk_text_buffer_get_iter_at_offset(textBuffer, &end, comp->getParsedOffset() + comp->getParsedLength());
++
++ gtk_text_buffer_select_range(textBuffer, &start, &end);
++
++ gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(textArea), &start, 0.0, FALSE, 0.0, 0.0);
++
++ gtk_tree_path_free(path);
++}
++
++
++static void destroy(GtkWidget* widget, gpointer data)
++{
++ gtk_main_quit();
++}
++
++
++void openFile(const std::string& filename)
++{
++ std::ifstream file;
++ file.open(filename.c_str(), std::ios::in | std::ios::binary);
++
++ if (!file)
++ {
++ std::cerr << "Can't open file '" << filename << "'." << std::endl;
++ return;
++ }
++
++ vmime::string data;
++ char buffer[16384];
++
++ do
++ {
++ file.read(buffer, sizeof(buffer));
++ data += vmime::string(buffer, file.gcount());
++ }
++ while (file.gcount());
++
++ vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
++ msg->parse(data);
++
++ currentMessage = msg;
++
++ char* convData = g_convert_with_fallback(data.c_str(), data.length(),
++ "UTF-8", "ISO-8859-1", "?", NULL, NULL, NULL);
++
++ if (convData == NULL)
++ {
++ gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(textArea)),
++ "GLib UTF-8 conversion error.", -1);
++ }
++ else
++ {
++ gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(textArea)),
++ convData, strlen(convData));
++
++ g_free(convData);
++ }
++
++ updateTreeView();
++}
++
++
++static void onFileOpen()
++{
++ GtkWidget* dlg = gtk_file_chooser_dialog_new
++ ("Open Message File", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN,
++ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
++ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
++ NULL);
++
++ if (gtk_dialog_run(GTK_DIALOG(dlg)) == GTK_RESPONSE_ACCEPT)
++ {
++ char* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dlg));
++
++ openFile(filename);
++
++ g_free(filename);
++ }
++
++ gtk_widget_destroy(dlg);
++}
++
++
++
++// UI definitions
++static const GtkActionEntry uiActions[] =
++{
++ { "FileMenu", NULL, "_File" },
++ { "FileOpen", GTK_STOCK_OPEN, "_Open...", "<control>O", NULL, G_CALLBACK(onFileOpen) },
++ { "FileExit", GTK_STOCK_QUIT, "_Exit", "<control>Q", NULL, G_CALLBACK(gtk_main_quit) }
++};
++
++static const char* uiDefinition =
++ "<ui>" \
++ " <menubar name=\"MainMenuBar\">" \
++ " <menu action=\"FileMenu\">" \
++ " <menuitem action=\"FileOpen\"/>" \
++ " <menuitem action=\"FileExit\"/>" \
++ " </menu>" \
++ " </menubar>" \
++ "</ui>";
++
++
++int main(int argc, char* argv[])
++{
++ // VMime initialization
++ vmime::platform::setHandler<vmime::platforms::posix::posixHandler>();
++
++ // GTK+ initialization
++ gtk_init(&argc, &argv);
++
++ // Create a new window
++ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
++
++ gtk_window_set_default_size(GTK_WINDOW(window), 800, 550);
++ gtk_window_set_title(GTK_WINDOW(window), "VMime Viewer Example");
++
++ g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL);
++
++ GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
++ gtk_container_add(GTK_CONTAINER(window), vbox);
++
++ // Menubar
++ GtkActionGroup* actionGroup = gtk_action_group_new ("Actions");
++ gtk_action_group_add_actions(actionGroup, uiActions, G_N_ELEMENTS(uiActions), NULL);
++
++ GtkUIManager* uiManager = gtk_ui_manager_new();
++ gtk_ui_manager_insert_action_group(uiManager, actionGroup, 1);
++ gtk_ui_manager_add_ui_from_string(uiManager, uiDefinition, -1, NULL);
++
++ GtkWidget* menuBar = gtk_ui_manager_get_widget(uiManager, "/MainMenuBar");
++
++ gtk_box_pack_start(GTK_BOX(vbox), menuBar, FALSE, FALSE, 0);
++
++ // Horizontal Pane
++ GtkWidget* hpane = gtk_hpaned_new();
++ gtk_box_pack_start(GTK_BOX(vbox), hpane, TRUE, TRUE, 0);
++
++ // Tree View
++ treeModel = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
++
++ treeView = gtk_tree_view_new();
++
++ g_signal_connect(G_OBJECT(treeView), "cursor-changed", G_CALLBACK(treeViewSelChanged), NULL);
++
++ GtkWidget* scroll = gtk_scrolled_window_new(NULL, NULL);
++
++ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
++ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
++ gtk_container_add(GTK_CONTAINER(scroll), treeView);
++
++ gtk_paned_add1(GTK_PANED(hpane), scroll);
++
++ GtkTreeViewColumn* col = gtk_tree_view_column_new();
++ gtk_tree_view_column_set_title(col, "Component Name");
++ gtk_tree_view_append_column(GTK_TREE_VIEW(treeView), col);
++
++ GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
++
++ gtk_tree_view_column_pack_start(col, renderer, TRUE);
++ gtk_tree_view_column_add_attribute(col, renderer, "text", 0);
++
++ gtk_tree_view_set_model(GTK_TREE_VIEW(treeView), GTK_TREE_MODEL(treeModel));
++ g_object_unref(treeModel);
++
++ gtk_widget_set_size_request(treeView, 200, 100);
++
++ // Text Area
++ textArea = gtk_text_view_new();
++
++ gtk_text_view_set_editable(GTK_TEXT_VIEW(textArea), FALSE);
++
++ scroll = gtk_scrolled_window_new(NULL, NULL);
++
++ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
++ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
++ gtk_container_add(GTK_CONTAINER(scroll), textArea);
++
++ gtk_paned_add2(GTK_PANED(hpane), scroll);
++
++ // Show main window
++ gtk_widget_show_all(window);
++
++ // GTK main loop
++ gtk_main();
++
++ return 0;
++}
++
++
+diff --git b/m4/acx_pthread.m4 a/m4/acx_pthread.m4
+new file mode 100644
+index 0000000..b7f692a
+--- /dev/null
++++ a/m4/acx_pthread.m4
+@@ -0,0 +1,235 @@
++dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
++dnl
++dnl This macro figures out how to build C programs using POSIX threads.
++dnl It sets the PTHREAD_LIBS output variable to the threads library and
++dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
++dnl C compiler flags that are needed. (The user can also force certain
++dnl compiler flags/libs to be tested by setting these environment
++dnl variables.)
++dnl
++dnl Also sets PTHREAD_CC to any special C compiler that is needed for
++dnl multi-threaded programs (defaults to the value of CC otherwise).
++dnl (This is necessary on AIX to use the special cc_r compiler alias.)
++dnl
++dnl NOTE: You are assumed to not only compile your program with these
++dnl flags, but also link it with them as well. e.g. you should link
++dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
++dnl $LIBS
++dnl
++dnl If you are only building threads programs, you may wish to use
++dnl these variables in your default LIBS, CFLAGS, and CC:
++dnl
++dnl LIBS="$PTHREAD_LIBS $LIBS"
++dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++dnl CC="$PTHREAD_CC"
++dnl
++dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
++dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
++dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
++dnl
++dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
++dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
++dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
++dnl default action will define HAVE_PTHREAD.
++dnl
++dnl Please let the authors know if this macro fails on any platform, or
++dnl if you have any other suggestions or comments. This macro was based
++dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
++dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
++dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
++dnl We are also grateful for the helpful feedback of numerous users.
++dnl
++dnl @category InstalledPackages
++dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
++dnl @version 2005-01-14
++dnl @license GPLWithACException
++
++AC_DEFUN([ACX_PTHREAD], [
++AC_REQUIRE([AC_CANONICAL_HOST])
++AC_LANG_SAVE
++AC_LANG_C
++acx_pthread_ok=no
++
++# We used to check for pthread.h first, but this fails if pthread.h
++# requires special compiler flags (e.g. on True64 or Sequent).
++# It gets checked for in the link test anyway.
++
++# First of all, check if the user has set any of the PTHREAD_LIBS,
++# etcetera environment variables, and if threads linking works using
++# them:
++if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
++ save_CFLAGS="$CFLAGS"
++ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++ save_LIBS="$LIBS"
++ LIBS="$PTHREAD_LIBS $LIBS"
++ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
++ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
++ AC_MSG_RESULT($acx_pthread_ok)
++ if test x"$acx_pthread_ok" = xno; then
++ PTHREAD_LIBS=""
++ PTHREAD_CFLAGS=""
++ fi
++ LIBS="$save_LIBS"
++ CFLAGS="$save_CFLAGS"
++fi
++
++# We must check for the threads library under a number of different
++# names; the ordering is very important because some systems
++# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
++# libraries is broken (non-POSIX).
++
++# Create a list of thread flags to try. Items starting with a "-" are
++# C compiler flags, and other items are library names, except for "none"
++# which indicates that we try without any flags at all, and "pthread-config"
++# which is a program returning the flags for the Pth emulation library.
++
++acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
++
++# The ordering *is* (sometimes) important. Some notes on the
++# individual items follow:
++
++# pthreads: AIX (must check this before -lpthread)
++# none: in case threads are in libc; should be tried before -Kthread and
++# other compiler flags to prevent continual compiler warnings
++# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
++# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
++# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
++# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
++# -pthreads: Solaris/gcc
++# -mthreads: Mingw32/gcc, Lynx/gcc
++# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
++# doesn't hurt to check since this sometimes defines pthreads too;
++# also defines -D_REENTRANT)
++# pthread: Linux, etcetera
++# --thread-safe: KAI C++
++# pthread-config: use pthread-config program (for GNU Pth library)
++
++case "${host_cpu}-${host_os}" in
++ *solaris*)
++
++ # On Solaris (at least, for some versions), libc contains stubbed
++ # (non-functional) versions of the pthreads routines, so link-based
++ # tests will erroneously succeed. (We need to link with -pthread or
++ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
++ # a function called by this macro, so we could check for that, but
++ # who knows whether they'll stub that too in a future libc.) So,
++ # we'll just look for -pthreads and -lpthread first:
++
++ acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
++ ;;
++esac
++
++if test x"$acx_pthread_ok" = xno; then
++for flag in $acx_pthread_flags; do
++
++ case $flag in
++ none)
++ AC_MSG_CHECKING([whether pthreads work without any flags])
++ ;;
++
++ -*)
++ AC_MSG_CHECKING([whether pthreads work with $flag])
++ PTHREAD_CFLAGS="$flag"
++ ;;
++
++ pthread-config)
++ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
++ if test x"$acx_pthread_config" = xno; then continue; fi
++ PTHREAD_CFLAGS="`pthread-config --cflags`"
++ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
++ ;;
++
++ *)
++ AC_MSG_CHECKING([for the pthreads library -l$flag])
++ PTHREAD_LIBS="-l$flag"
++ ;;
++ esac
++
++ save_LIBS="$LIBS"
++ save_CFLAGS="$CFLAGS"
++ LIBS="$PTHREAD_LIBS $LIBS"
++ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++
++ # Check for various functions. We must include pthread.h,
++ # since some functions may be macros. (On the Sequent, we
++ # need a special flag -Kthread to make this header compile.)
++ # We check for pthread_join because it is in -lpthread on IRIX
++ # while pthread_create is in libc. We check for pthread_attr_init
++ # due to DEC craziness with -lpthreads. We check for
++ # pthread_cleanup_push because it is one of the few pthread
++ # functions on Solaris that doesn't have a non-functional libc stub.
++ # We try pthread_create on general principles.
++ AC_TRY_LINK([#include <pthread.h>],
++ [pthread_t th; pthread_join(th, 0);
++ pthread_attr_init(0); pthread_cleanup_push(0, 0);
++ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
++ [acx_pthread_ok=yes])
++
++ LIBS="$save_LIBS"
++ CFLAGS="$save_CFLAGS"
++
++ AC_MSG_RESULT($acx_pthread_ok)
++ if test "x$acx_pthread_ok" = xyes; then
++ break;
++ fi
++
++ PTHREAD_LIBS=""
++ PTHREAD_CFLAGS=""
++done
++fi
++
++# Various other checks:
++if test "x$acx_pthread_ok" = xyes; then
++ save_LIBS="$LIBS"
++ LIBS="$PTHREAD_LIBS $LIBS"
++ save_CFLAGS="$CFLAGS"
++ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++
++ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
++ AC_MSG_CHECKING([for joinable pthread attribute])
++ attr_name=unknown
++ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
++ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
++ [attr_name=$attr; break])
++ done
++ AC_MSG_RESULT($attr_name)
++ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
++ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
++ [Define to necessary symbol if this constant
++ uses a non-standard name on your system.])
++ fi
++
++ AC_MSG_CHECKING([if more special flags are required for pthreads])
++ flag=no
++ case "${host_cpu}-${host_os}" in
++ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
++ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
++ esac
++ AC_MSG_RESULT(${flag})
++ if test "x$flag" != xno; then
++ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
++ fi
++
++ LIBS="$save_LIBS"
++ CFLAGS="$save_CFLAGS"
++
++ # More AIX lossage: must compile with cc_r
++ AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
++else
++ PTHREAD_CC="$CC"
++fi
++
++AC_SUBST(PTHREAD_LIBS)
++AC_SUBST(PTHREAD_CFLAGS)
++AC_SUBST(PTHREAD_CC)
++
++# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
++if test x"$acx_pthread_ok" = xyes; then
++ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
++ :
++else
++ acx_pthread_ok=no
++ $2
++fi
++AC_LANG_RESTORE
++])dnl ACX_PTHREAD
+diff --git b/m4/ost_posix.m4 a/m4/ost_posix.m4
+new file mode 100644
+index 0000000..6572b1e
+--- /dev/null
++++ a/m4/ost_posix.m4
+@@ -0,0 +1,87 @@
++dnl Copyright (C) 1999-2001 Open Source Telecom Corporation.
++dnl
++dnl This program is free software; you can redistribute it and/or modify
++dnl it under the terms of the GNU General Public License as published by
++dnl the Free Software Foundation; either version 2 of the License, or
++dnl (at your option) any later version.
++dnl
++dnl This program is distributed in the hope that it will be useful,
++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++dnl GNU General Public License for more details.
++dnl
++dnl You should have received a copy of the GNU General Public License
++dnl along with this program; if not, write to the Free Software
++dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++dnl
++dnl As a special exception to the GNU General Public License, if you
++dnl distribute this file as part of a program that contains a configuration
++dnl script generated by Autoconf, you may include it under the same
++dnl distribution terms that you use for the rest of that program.
++
++AC_DEFUN(OST_SYS_POSIX,[
++ AC_REQUIRE([OST_PROG_CC_POSIX])
++ AC_CACHE_CHECK(whether system meets Posix.1,
++ ost_cv_sys_posix1,
++ AC_TRY_COMPILE([
++ #include <sys/types.h>
++ #include <unistd.h>
++ ],[
++ #ifndef _POSIX_VERSION
++ fatal
++ #endif
++ ],
++ ost_cv_sys_posix1=yes,
++ ost_cv_sys_posix1=no
++ )
++ )
++ if test $ost_cv_sys_posix1 = no ; then
++ AC_CHECK_HEADERS(unistd.h)
++ else
++ AC_DEFINE(HAVE_UNISTD_H, [1], [have unix header])
++ fi
++ AC_CHECK_HEADERS(features.h)
++ AH_TOP([
++/* hack for BROKEN autoheader, since it will not predicitably order
++ macros by any obvious means. */
++
++#undef HAVE_UNISTD_H
++#undef HAVE_FEATURES_H
++#undef HAVE_SYS_TYPES_H
++
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#ifndef WIN32
++#ifdef HAVE_FEATURES_H
++#include <features.h>
++#endif
++#endif
++
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++ ])
++])
++
++AC_DEFUN(OST_CC_FCNTL,[
++ AC_REQUIRE([OST_SYS_POSIX])
++ AC_CHECK_HEADERS(fcntl.h sys/fcntl.h)
++AH_BOTTOM([
++
++#ifndef HAVE_FCNTL_H
++#ifdef HAVE_SYS_FCNTL_H
++#include <sys/fcntl.h>
++#endif
++#else
++#include <fcntl.h>
++#ifndef O_NDELAY
++#ifdef HAVE_SYS_FCNTL_H
++#include <sys/fcntl.h>
++#endif
++#endif
++#endif
++ ])
++])
++
+diff --git b/m4/ost_prog.m4 a/m4/ost_prog.m4
+new file mode 100644
+index 0000000..c9e66f5
+--- /dev/null
++++ a/m4/ost_prog.m4
+@@ -0,0 +1,61 @@
++dnl Copyright (C) 1999-2001 Open Source Telecom Corporation.
++dnl
++dnl This program is free software; you can redistribute it and/or modify
++dnl it under the terms of the GNU General Public License as published by
++dnl the Free Software Foundation; either version 2 of the License, or
++dnl (at your option) any later version.
++dnl
++dnl This program is distributed in the hope that it will be useful,
++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++dnl GNU General Public License for more details.
++dnl
++dnl You should have received a copy of the GNU General Public License
++dnl along with this program; if not, write to the Free Software
++dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++dnl
++dnl As a special exception to the GNU General Public License, if you
++dnl distribute this file as part of a program that contains a configuration
++dnl script generated by Autoconf, you may include it under the same
++dnl distribution terms that you use for the rest of that program.
++
++AC_DEFUN(OST_PROG_CC_POSIX,[
++ AC_PROG_CC
++ AC_PROG_CPP
++ AC_ISC_POSIX]
++)
++
++AC_DEFUN(OST_PROG_COMMON,[
++ AC_REQUIRE([AC_PROG_INSTALL])
++ AC_REQUIRE([AC_PROG_MAKE_SET])
++])
++
++AC_DEFUN(OST_PROJ_LIBRARY,[
++ AC_REQUIRE([AM_PROG_LIBTOOL])
++ AC_REQUIRE([AC_PROG_RANLIB])
++ if test ! -z "[$2]" ; then
++ if test ! -z "[$3]" ; then
++ LT_[$1]_VERSION="-version-info [$3] -release [$2]"
++ else
++ LT_[$1]_VERSION="-release [$2]"
++ fi
++ AC_SUBST(LT_[$1]_VERSION)
++ fi
++])
++
++AC_DEFUN(OST_PROG_LIBVER,[
++ LT_MAJOR="`echo $LT_VERSION | sed s/:.*$//`"
++ AC_SUBST(LT_RELEASE)
++ AC_SUBST(LT_MAJOR)
++])
++
++
++AC_DEFUN(OST_PROG_LIBRARY,[
++ AC_REQUIRE([AM_PROG_LIBTOOL])
++ AC_REQUIRE([AC_PROG_RANLIB])
++ if test ! -z "[$2]" ; then
++ LT_[$1]_VERSION="-version-info [$2]"
++ AC_SUBST(LT_[$1]_VERSION)
++ fi
++])
++
+diff --git b/m4/ost_pthread.m4 a/m4/ost_pthread.m4
+new file mode 100644
+index 0000000..d427c73
+--- /dev/null
++++ a/m4/ost_pthread.m4
+@@ -0,0 +1,582 @@
++dnl Copyright (C) 1999-2001 Open Source Telecom Corporation.
++dnl
++dnl This program is free software; you can redistribute it and/or modify
++dnl it under the terms of the GNU General Public License as published by
++dnl the Free Software Foundation; either version 2 of the License, or
++dnl (at your option) any later version.
++dnl
++dnl This program is distributed in the hope that it will be useful,
++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++dnl GNU General Public License for more details.
++dnl
++dnl You should have received a copy of the GNU General Public License
++dnl along with this program; if not, write to the Free Software
++dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++dnl
++dnl As a special exception to the GNU General Public License, if you
++dnl distribute this file as part of a program that contains a configuration
++dnl script generated by Autoconf, you may include it under the same
++dnl distribution terms that you use for the rest of that program.
++
++AC_DEFUN([OST_LIB_PTHREAD],
++[
++ AC_REQUIRE([OST_SYS_POSIX])
++ AC_REQUIRE([OST_CC_SYSTIME])
++ THREAD_FLAGS=""
++ THREAD_LIBS=""
++ ost_cv_thread_library="none"
++ ost_cv_rt_library="none"
++ ost_cv_cxx_mode=false
++
++ AC_ARG_WITH(pthread, [ --with-pthread[=lib] using specified pthread library],
++ [if test "$withval" != "" ; then ost_cv_thread_library=$withval ; fi]
++ )
++
++ AC_ARG_WITH(linuxthreads, [ --with-linuxthreads use linux kernel mode library],
++ [ost_cv_thread_library=lthread
++ AC_DEFINE(WITH_LINUXTHREADS, [1], [bsd system using linuxthreads])
++ if test "$withval" != "yes" ; then
++ THREAD_FLAGS="-D__USE_GNU -D__USE_UNIX98 -I$withval $THREAD_FLAGS"
++ CFLAGS="-D__USE_GNU -D__USE_UNIX98 -I$withval $CFLAGS"
++ else
++ THREAD_FLAGS="-D__USE_GNU -D__USE_UNIX98 -I/usr/local/include/pthread/linuxthreads $THREAD_FLAGS"
++ CFLAGS="-D__USE_GNU -D__USE_UNIX98 -I/usr/local/include/pthread/linuxthreads $CFLAGS"
++ fi
++ ])
++
++ AC_CHECK_HEADERS(pthread.h, [
++ AC_DEFINE(HAVE_PTHREAD_H, [1], [posix thread header])
++ ost_cv_posix_threads=yes],
++ ost_cv_posix_threads=no)
++
++ if test $ost_cv_posix_threads = no ; then
++ AC_LANG_SAVE
++ AC_LANG_CPLUSPLUS
++ SAVE_CXXFLAGS="$CXXFLAGS"
++ CXXFLAGS="$CXXFLAGS -pthread"
++ AC_TRY_COMPILE([#include <pthread.h>],[],
++ AC_DEFINE(HAVE_PTHREAD_H, [1])
++ ost_cv_cxx_mode=true
++ ost_cv_posix_threads=yes)
++ CXXFLAGS="$SAVE_CXXFLAGS"
++ AC_LANG_RESTORE
++ fi
++
++AC_LANG_SAVE
++AC_LANG_CPLUSPLUS
++
++ ost_cv_posix_atomic=no
++ AC_CHECK_HEADERS(sys/atomic_op.h,[
++ AC_DEFINE(HAVE_ATOMIC_AIX, [1], [atomic aix operations])
++ ])
++ AC_CHECK_HEADERS([sys/atomic.h],
++ ost_cv_posix_sys_atomic=yes,
++ ost_cv_posix_sys_atomic=no)
++ if test $ost_cv_posix_sys_atomic = yes ; then
++ AC_MSG_CHECKING([for atomic_t])
++ AC_TRY_COMPILE([#include <sys/atomic.h>],
++ [
++ atomic_t at; at.counter = 1;
++ atomic_dec_and_test(&at);
++ atomic_sub(4, &at);
++ atomic_inc(&at);
++ atomic_add(3, &at);
++ ],
++ [ost_cv_posix_atomic=yes
++ AC_DEFINE(HAVE_WORKING_SYS_ATOMIC_H, [1], [has usable atomic functions])],
++ [ost_cv_posix_atomic=no])
++ AC_MSG_RESULT($ost_cv_posix_atomic)
++ fi
++
++ dnl check for gcc's bits/atomicity and the atomic functions therein
++ AC_CHECK_HEADERS([bits/atomicity.h],
++ ost_cv_bits_atomicity=yes,
++ ost_cv_bits_atomicity=no)
++ if test $ost_cv_bits_atomicity = yes ; then
++ AC_MSG_CHECKING([for _Atomic_word])
++ AC_TRY_COMPILE([#include <bits/atomicity.h>],
++ [
++ _Atomic_word i = 0;
++ __atomic_add(&i, 1);
++ __exchange_and_add(&i, 1);
++ ],
++ [ost_cv_gcc_atomic=yes
++ AC_DEFINE(HAVE_GCC_BITS_ATOMIC, [1], [has gcc atomic functions])],
++ [ost_cv_gcc_atomic=no])
++ AC_MSG_RESULT($ost_cv_gcc_atomic)
++
++ AC_MSG_CHECKING([for __gnu_cxx::_Atomic_word])
++ AC_TRY_COMPILE([#include <bits/atomicity.h>],
++ [
++ using namespace __gnu_cxx;
++ _Atomic_word i = 0;
++ __atomic_add(&i, 1);
++ __exchange_and_add(&i, 1);
++ ],
++ [ost_cv_gcc_cxx_atomic=yes
++ AC_DEFINE(HAVE_GCC_CXX_BITS_ATOMIC, [1],
++ [has __gnu_cxx atomic functions])],
++ [ost_cv_gcc_cxx_atomic=no])
++ AC_MSG_RESULT($ost_cv_gcc_cxx_atomic)
++ fi
++
++AC_LANG_RESTORE
++
++ if test "$target" = NONE ; then
++ targetdir=""
++ else
++ targetdir="$target"
++ fi
++
++ AC_CHECK_HEADERS(thread.h)
++ if test "$prefix" = NONE ; then
++ thrprefix="/usr/$targetdir/include"
++ if test -d /usr/$targetdir/sys-include ; then
++ thrprefix="$prefix/$targetdir/sys-include" ; fi
++ else
++ thrprefix="$prefix/$targetdir/include"
++ if test -d "$prefix/$targetdir/sys-include" ; then
++ thrprefix="$prefix/$targetdir/sys-include" ; fi
++ fi
++
++ if test ! -f $thrprefix/thread.h ; then
++ thrprefix=/usr/include
++ fi
++
++ AC_SUBST(thrprefix)
++
++ if test $ost_cv_posix_threads = yes ; then
++ if test "$ost_cv_thread_library" = "none" ; then
++
++ ost_cv_thread_flags=""
++ for flags in -kthread -pthread -mthreads -pthreads -Kthread --threadsafe -mt ; do
++
++ AC_MSG_CHECKING(whether ${CC-cc} accepts $flags)
++ echo 'void f(){}' >conftest.c
++ if test -z "`${CC-cc} $flags -c conftest.c 2>&1`"; then
++ ost_cv_thread_flags=$flags
++ AC_MSG_RESULT(yes)
++ else
++ AC_MSG_RESULT(no)
++ fi
++ rm -f conftest*
++ if test ! -z "$ost_cv_thread_flags" ; then break ; fi
++ done
++# if test "$ost_cv_prog_cc_pthread" = "no" ; then
++# AC_CACHE_CHECK(whether ${CC-cc} accepts -mthreads,
++# ost_cv_prog_cc_mthreads,
++# [echo 'void f(){}' >conftest.c
++# if test -z "`${CC-cc} -mthreads -c conftest.c 2>&1`"; then
++# ost_cv_prog_cc_mthreads=yes
++# else
++# ost_cv_prog_cc_mthreads=no
++# fi
++# rm -f conftest*
++# ])
++# fi
++ ost_cv_thread_library=none
++ AC_CHECK_LIB(pthread, pthread_self,
++ ost_cv_thread_library=pthread,
++ AC_CHECK_LIB(c_r, pthread_self,
++ ost_cv_thread_library=c_r,
++ AC_CHECK_LIB(pthread, pthread_kill,
++ ost_cv_thread_library=pthread,
++ AC_CHECK_LIB(pthreads, pthread_self,
++ ost_cv_thread_library=pthreads,
++ AC_CHECK_LIB(thread, pthread_self,
++ ost_cv_thread_library=thread)))))
++
++ if test $ost_cv_thread_library = none ; then
++ AC_CHECK_LIB(gthreads, pthread_self,[
++ AC_CHECK_LIB(malloc, malloc)
++ ost_cv_thread_library=gthreads])
++ fi
++ if test $ost_cv_thread_library = none ; then
++ AC_CHECK_LIB(cma, pthread_self,
++ ost_cv_thread_library=cma)
++ fi
++
++ if test $ost_cv_thread_library = none ; then
++ AC_CHECK_LIB(c, pthread_self,
++ ost_cv_thread_library=c)
++ fi
++
++ if test $ost_cv_thread_library = none ; then
++ AC_MSG_ERROR(no library for posix threads found!)
++ fi
++ else
++# ost_cv_prog_cc_pthread=no
++# ost_cv_prog_cc_mthreads=no
++ ost_cv_thread_flags=""
++ fi
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mach_thread_np,
++ AC_DEFINE(HAVE_PTHREAD_MACH_THREAD_NP, [1], [has mach link])
++ )
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, nanosleep,
++ AC_DEFINE(HAVE_PTHREAD_NANOSLEEP, [1], [has nanosleep]),[
++ AC_CHECK_LIB(posix4, nanosleep,[
++ AC_DEFINE(HAVE_PTHREAD_NANOSLEEP, [1])
++ THREAD_LIBS="$THREAD_LIBS -lposix4"
++ ],[
++ AC_CHECK_LIB(rt, nanosleep,[
++ AC_DEFINE(HAVE_PTHREAD_NANOSLEEP, [1])
++ ost_cv_rt_library="-lrt"])
++ ])
++
++ ])
++
++ AC_CHECK_LIB(rt, clock_gettime,[
++ ost_cv_rt_library="-lrt"
++ AC_DEFINE(HAVE_HIRES_TIMER, [1], [have hires])
++ ],[
++ AC_CHECK_FUNCS(clock_gettime,[
++ AC_DEFINE(HAVE_HIRES_TIMER, [1], [have hires])
++ ])
++ ])
++
++ AC_CHECK_LIB(rt, mlockall,[
++ AC_DEFINE(HAVE_MLOCK, [1], [have mlock])
++ AC_DEFINE(HAVE_MLOCKALL, [1], [have memlockall])
++ ost_cv_rt_library="-lrt"],
++ [
++ AC_CHECK_FUNCS(mlock)
++ AC_CHECK_FUNCS(mlockall)
++ ])
++
++ if test "$ost_cv_rt_library" != "none" ; then
++ THREAD_LIBS="$THREAD_LIBS $ost_cv_rt_library" ; fi
++
++ if test ! -z "$ost_cv_thread_flags" ; then
++ THREAD_LIBS="$THREAD_LIBS $ost_cv_thread_flags"
++ else
++ THREAD_LIBS="$THREAD_LIBS -l$ost_cv_thread_library"
++ fi
++
++ AC_MSG_CHECKING([if more special flags are required for pthreads])
++ flag=no
++ case "${host_cpu}-${host_os}" in
++ *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
++ *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
++ esac
++ AC_MSG_RESULT(${flag})
++ if test "x$flag" != xno; then
++ THREAD_FLAGS="$flag"
++ fi
++
++ AC_SUBST(THREAD_FLAGS)
++ AC_SUBST(THREAD_LIBS)
++# LIBS="$THREAD_LIBS $LIBS"
++ if test "$ost_cv_thread_library" != "lthread" ; then
++ AC_CHECK_HEADERS(pthread_np.h)
++ fi
++ AC_CHECK_HEADERS(semaphore.h)
++ AC_CHECK_HEADERS(sched.h)
++ AC_CHECK_HEADERS(sys/sched.h)
++ AC_CHECK_FUNCS(sched_getscheduler)
++ AC_CACHE_CHECK([for recursive mutex type support], ost_cv_mutex_recursive,
++ [
++ ost_cv_mutex_recursive="none"
++
++ if test "$ost_cv_cxx_mode" = true ; then
++ AC_LANG_SAVE
++ AC_LANG_CPLUSPLUS
++ SAVE_CXXFLAGS="$CXXFLAGS"
++ CXXFLAGS="$CXXFLAGS -pthread"
++ fi
++
++ AC_TRY_COMPILE(
++ [#include <pthread.h>],
++ [
++ #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
++ #ifdef PTHREAD_MUTEX_RECURSIVE
++ #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
++ #endif
++ #endif
++ return (int)PTHREAD_MUTEXTYPE_RECURSIVE;
++ ],
++ ost_cv_mutex_recursive="portable",
++ [
++ AC_EGREP_HEADER(PTHREAD_MUTEXTYPE_RECURSIVE_NP,pthread.h,
++ ost_cv_mutex_recursive=non-portable)
++ AC_EGREP_HEADER(PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP, pthread.h,
++ ost_cv_mutex_recursive=lthread)
++ AC_EGREP_HEADER(PTHREAD_MUTEX_RECURSIVE_NP,pthread.h,
++ ost_cv_mutex_recursive=linux)
++ AC_EGREP_HEADER(MUTEX_TYPE_COUNTING_FAST,pthread.h,
++ ost_cv_mutex_recursive=counting)
++ ])
++ if test $ost_cv_mutex_recursive = "none" ; then
++ if test $ost_cv_thread_library = "lthread" ; then
++ ost_cv_mutex_recursive=linux
++ fi
++ fi
++ rm -f conftest*
++ ])
++
++ if test $ost_cv_mutex_recursive = "none" ; then
++ AC_TRY_COMPILE(
++ [#include <pthread.h>],
++ [return MUTEX_TYPE_COUNTING_FAST;],
++ ost_cv_mutex_recursive=counting)
++ fi
++
++ if test "$ost_cv_cxx_mode" = true ; then
++ CXXFLAGS="$SAVE_CXXFLAGS"
++ AC_LANG_RESTORE
++ fi
++
++
++ case $ost_cv_mutex_recursive in
++ non-portable)
++ AC_DEFINE(PTHREAD_MUTEXTYPE_RECURSIVE,
++ PTHREAD_MUTEXTYPE_RECURSIVE_NP, [mutex type])
++ ;;
++ linux)
++ AC_DEFINE(PTHREAD_MUTEXTYPE_RECURSIVE,
++ PTHREAD_MUTEX_RECURSIVE_NP)
++ ;;
++ counting)
++ AC_DEFINE(PTHREAD_MUTEXTYPE_RECURSIVE,
++ MUTEX_TYPE_COUNTING_FAST)
++ ;;
++ esac
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mutexattr_settype,
++ AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE, [1], [has setttype]),
++ [
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mutexattr_settype_np,
++ AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP,
++ [1], [has non portable settype]))
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_mutexattr_setkind_np,
++ AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_SETKIND_NP,
++ [1], [has non portable setkind]))
++ ]
++ )
++
++ ost_cv_thread_rwlock=false
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_rwlock_init,[
++ ost_cv_thread_rwlock=true
++ AC_DEFINE(HAVE_PTHREAD_RWLOCK, [1], [has rwlock support])])
++
++ AC_CHECK_LIB(c, pread,[
++ AC_DEFINE(HAVE_PREAD_PWRITE, [1], [has pwrite])],[
++ AC_CHECK_LIB(${ost_cv_thread_library}, pread,[
++ AC_DEFINE(HAVE_PREAD_PWRITE, [1])],[
++ AC_CHECK_LIB(c_r, pread,[AC_DEFINE(HAVE_PREAD_PWRITE)])
++ ])
++ ])
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_suspend,
++ AC_DEFINE(HAVE_PTHREAD_SUSPEND, [1], [has suspend]))
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_attr_setstacksize,
++ AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE, [1], [has stack size]))
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_yield_np,
++ AC_DEFINE(HAVE_PTHREAD_YIELD_NP, [1], [has np yield]),[
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_yield,
++ AC_DEFINE(HAVE_PTHREAD_YIELD, [1], [has yield]),[
++ AC_CHECK_LIB(${ost_cv_thread_library}, sched_yield,
++ AC_DEFINE(HAVE_PTHREAD_SCHED_YIELD, [1], [has sched yield]))
++ ])
++ ])
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_cancel,[
++ AC_DEFINE(HAVE_PTHREAD_CANCEL, [1], [has cancel])
++ AC_CHECK_LIB(${ost_cv_thread_library},
++ pthread_setcanceltype,
++ AC_DEFINE(HAVE_PTHREAD_SETCANCELTYPE, [1], [has setcanceltype]),
++ AC_CHECK_LIB($ost_cv_thread_library, pthread_setcanel,
++ AC_DEFINE(HAVE_PTHREAD_SETCANCEL, [1], [has setcancel])))
++ ],[
++ AC_CHECK_LIB(${ost_cv_thread_library},
++ pthread_setcanceltype,[
++ AC_DEFINE(HAVE_PTHREAD_CANCEL)
++ AC_DEFINE(HAVE_PTHREAD_SETCANCELTYPE)])
++
++ ])
++
++ AC_CHECK_LIB(${ost_cv_thread_library}, pthread_delay_np,
++ AC_DEFINE(HAVE_PTHREAD_DELAY_NP, [1], [has non portable delay]))
++
++ fi
++
++ UNAME=`uname`
++ if test "$UNAME" = "AIX" ; then
++ AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
++ CC=$PTHREAD_CC
++ AC_DEFINE(COMMON_AIX_FIXES, [1], [aix fixes needed])
++ fi
++
++AH_BOTTOM([
++#ifdef HAVE_THREAD_H
++#include "@thrprefix@/thread.h"
++#if defined(i386) && defined(__svr4__) && !defined(__sun)
++#define _THR_UNIXWARE
++#endif
++#if defined(__SVR4) && defined(__sun)
++#define _THR_SUNOS5
++#else
++#if defined(__SVR4__) && defined(__SUN__)
++#define _THR_SUNOS5
++#endif
++#endif
++#endif
++
++#ifdef HAVE_WORKING_SYS_ATOMIC_H
++#include <sys/atomic.h>
++#define HAVE_ATOMIC
++#elif defined(HAVE_ATOMIC_AIX)
++#include <sys/atomic_op.h>
++#ifndef HAVE_ATOMIC
++#define HAVE_ATOMIC
++#endif
++#endif
++
++#if defined(__cplusplus)
++#if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
++#include <bits/atomicity.h>
++#define HAVE_ATOMIC
++#endif
++#endif
++
++#if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
++
++#ifdef __QNX__
++#define __EXT_QNX
++#endif
++
++#include <pthread.h>
++
++#ifdef HAVE_PTHREAD_NP_H
++#include <pthread_np.h>
++#endif
++
++#ifdef HAVE_SEMAPHORE_H
++#include <semaphore.h>
++#endif
++#ifdef _POSIX_PRIORITY_SCHEDULING
++#ifdef HAVE_SCHED_H
++#include <sched.h>
++#else
++#ifdef HAVE_SYS_SCHED_H
++#include <sys/sched.h>
++#endif
++#endif
++#endif
++
++#define __PTHREAD_H__
++#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
++#ifdef MUTEX_TYPE_COUNTING_FAST
++#define PTHREAD_MUTEXTYPE_RECURSIVE MUTEX_TYPE_COUNTING_FAST
++#endif
++#endif
++#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
++#ifdef PTHREAD_MUTEX_RECURSIVE
++#define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE
++#endif
++#endif
++#ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
++#if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
++#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
++#define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
++#endif
++#define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
++#define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
++#endif
++#if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
++#ifndef PTHREAD_MUTEXTYPE_RECURSIVE
++#define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEXTYPE_RECURSIVE_NP
++#endif
++#define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
++#define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
++#endif
++#endif
++
++#ifdef HAVE_PTHREAD_MACH_THREAD_NP
++#define _THR_MACH
++#endif
++
++#ifndef HAVE_PTHREAD_YIELD
++#ifdef HAVE_PTHREAD_YIELD_NP
++#define pthread_yield() pthread_yield_np()
++#define HAVE_PTHREAD_YIELD
++#endif
++#endif
++
++#ifndef HAVE_PTHREAD_YIELD
++#ifdef HAVE_PTHREAD_SCHED_YIELD
++#define pthread_yield() sched_yield()
++#define HAVE_PTHREAD_YIELD
++#endif
++#endif
++
++#ifndef HAVE_PTHREAD_DELAY
++#ifdef HAVE_PTHREAD_DELAY_NP
++#define HAVE_PTHREAD_DELAY
++#define pthread_delay(x) pthread_delay_np(x)
++#endif
++#if defined(HAVE_PTHREAD_NANOSLEEP)
++#ifndef HAVE_PTHREAD_DELAY
++#define HAVE_PTHREAD_DELAY
++#ifdef __FreeBSD__
++#ifdef __cplusplus
++extern "C" int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
++#endif
++#endif
++#define pthread_delay(x) nanosleep(x, NULL)
++#endif
++#endif
++#endif
++
++#ifdef HAVE_PTHREAD_ATTR_SETSTACK
++#ifndef PTHREAD_STACK_MIN
++#define PTHREAD_STACK_MIN 32768
++#endif
++#endif
++
++#ifndef HAVE_PTHREAD_CANCEL
++#ifdef SIGCANCEL
++#define CCXX_SIG_THREAD_CANCEL SIGCANCEL
++#else
++#define CCXX_SIG_THREAD_CANCEL SIGQUIT
++#endif
++#define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
++#define pthread_setcanceltype(x, y)
++#define pthread_setcancelstate(x, y)
++#endif
++
++#ifndef HAVE_PTHREAD_SETCANCELTYPE
++#ifdef HAVE_PTHREAD_SETCANCEL
++enum
++{ PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
++ PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
++enum
++{ PTHREAD_CANCEL_ENABLE = CANCEL_ON,
++ PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
++#define pthread_setcancelstate(x, y) \
++ (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
++#define pthread_setcanceltype(x, y) \
++ (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
++#else
++#define pthread_setcanceltype(x, y)
++#define pthread_setcancelstate(x, y)
++#endif
++#endif
++
++#ifdef _AIX
++#ifdef HAVE_PTHREAD_SUSPEND
++#undef HAVE_PTHREAD_SUSPEND
++#endif
++#endif
++
++#endif
++
++
++ ])
++
++])
++
+diff --git b/m4/ost_systime.m4 a/m4/ost_systime.m4
+new file mode 100644
+index 0000000..f48f207
+--- /dev/null
++++ a/m4/ost_systime.m4
+@@ -0,0 +1,40 @@
++dnl Copyright (C) 1999-2001 Open Source Telecom Corporation.
++dnl
++dnl This program is free software; you can redistribute it and/or modify
++dnl it under the terms of the GNU General Public License as published by
++dnl the Free Software Foundation; either version 2 of the License, or
++dnl (at your option) any later version.
++dnl
++dnl This program is distributed in the hope that it will be useful,
++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++dnl GNU General Public License for more details.
++dnl
++dnl You should have received a copy of the GNU General Public License
++dnl along with this program; if not, write to the Free Software
++dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++dnl
++dnl As a special exception to the GNU General Public License, if you
++dnl distribute this file as part of a program that contains a configuration
++dnl script generated by Autoconf, you may include it under the same
++dnl distribution terms that you use for the rest of that program.
++
++AC_DEFUN(OST_CC_SYSTIME,[
++ AC_HEADER_TIME
++ AC_CHECK_HEADERS(sys/time.h)
++AH_TOP([
++#undef HAVE_SYS_TIME_H
++#if TIME_WITH_SYS_TIME
++#include <sys/time.h>
++#include <time.h>
++#else
++#if HAVE_SYS_TIME_H
++#include <sys/time.h>
++#else
++#include <time.h>
++#endif
++#endif
++ ])
++
++])
++
+
+commit 7b304172a261034b049b0bf4b41208eac54ebd90
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Oct 19 14:39:02 2008 +0000
+
+ Started version 0.9.1.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@482 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/ChangeLog b/ChangeLog
+index 5162192..b9a510f 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,4 +1,12 @@
+
++VERSION 0.9.1svn
++================
++
++2008-10-19 Vincent Richard <vincent@vincent-richard.net>
++
++ * Started version 0.9.1.
++
++
+ VERSION 0.9.0
+ =============
+
+diff --git a/SConstruct b/SConstruct
+index 6014385..7f62876 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -29,7 +29,7 @@ import string
+ # Package version number
+ packageVersionMajor = 0
+ packageVersionMinor = 9
+-packageVersionMicro = 0
++packageVersionMicro = 1
+
+ # API version number (libtool)
+ #
+
+commit d0960f6bbb000849505e4fd47de1ab10c3a17627
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Nov 9 13:48:04 2008 +0000
+
+ Missing #include for GCC 4.4 (thanks to Martin Michlmayr).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@483 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index 4d063d4..e89b9ab 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -32,6 +32,7 @@
+
+ #include <dirent.h>
+
++#include <stdio.h>
+ #include <string.h>
+
+ #include "vmime/exception.hpp"
+
+commit 9b74d48f383169f9269dbd6612e0b180f9f7119b
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 16 21:44:42 2008 +0000
+
+ Send CRLF in the same packet as command to avoid problems with some servers.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@484 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
+index 3ce8d21..5ad8d70 100644
+--- a/src/net/smtp/SMTPTransport.cpp
++++ b/src/net/smtp/SMTPTransport.cpp
+@@ -617,8 +617,10 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients
+
+ void SMTPTransport::sendRequest(const string& buffer, const bool end)
+ {
+- m_socket->send(buffer);
+- if (end) m_socket->send("\r\n");
++ if (end)
++ m_socket->send(buffer + "\r\n");
++ else
++ m_socket->send(buffer);
+ }
+
+
+
+commit 72c169401644272043bbb4e536e13fbf9df494b2
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Dec 29 21:46:08 2008 +0000
+
+ Fixed week of year for 53th week (non ISO-compliant).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@485 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/datetimeUtils.cpp b/src/utility/datetimeUtils.cpp
+index ed9fb4b..cc06f50 100644
+--- a/src/utility/datetimeUtils.cpp
++++ b/src/utility/datetimeUtils.cpp
+@@ -322,6 +322,9 @@ int datetimeUtils::getWeekOfYear(const int year, const int month, const int day)
+ WeekNumber -= 1;
+ }
+
++ if (WeekNumber == 1 && month == 12)
++ WeekNumber = 53;
++
+ return WeekNumber;
+ }
+
+
+commit bf516d786e3af88e2663cb96ba7026f8fb9b09cb
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri Jan 9 21:07:42 2009 +0000
+
+ Fixed non-numeric timezone parsing (thanks to John van der Kamp, Zarafa).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@486 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/dateTime.cpp b/src/dateTime.cpp
+index 3af6da7..66cd992 100644
+--- a/src/dateTime.cpp
++++ b/src/dateTime.cpp
+@@ -427,7 +427,7 @@ void datetime::parse(const string& buffer, const string::size_type position,
+ zone[zoneLength++] = *p;
+ ++p;
+ }
+- while (zoneLength < 3 && p < pend && parserHelpers::isDigit(*p));
++ while (zoneLength < 3 && p < pend);
+
+ switch (zone[0])
+ {
+@@ -491,6 +491,8 @@ void datetime::parse(const string& buffer, const string::size_type position,
+
+ break;
+ }
++ case 'g':
++ case 'G':
+ case 'u':
+ case 'U':
+ {
+
+commit 248d19bf70b8b71e9cdb9f92a09f338289ff5b2a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Mar 1 21:23:40 2009 +0000
+
+ Use Decider() method instead of deprecated SourceSignatures/TargetSignatures().
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@487 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 7f62876..4bfddd8 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -439,9 +439,7 @@ EnsureSConsVersion(0, 94)
+
+ SetOption('implicit_cache', 1)
+
+-#SourceSignatures('timestamp')
+-SourceSignatures('MD5')
+-TargetSignatures('build')
++Decider('MD5-timestamp')
+
+
+ #############
+
+commit 0131dcb8198dc1253bf2b5e86709ff009f4fa448
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Apr 9 18:15:50 2009 +0000
+
+ Fixed block size through filtered streams.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@488 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
+index eda0c64..5db0104 100644
+--- a/src/utility/filteredStream.cpp
++++ b/src/utility/filteredStream.cpp
+@@ -30,6 +30,22 @@ namespace vmime {
+ namespace utility {
+
+
++// filteredInputStream
++
++stream::size_type filteredInputStream::getBlockSize()
++{
++ return std::min(inputStream::getBlockSize(), getPreviousInputStream().getBlockSize());
++}
++
++
++// filteredOutputStream
++
++stream::size_type filteredOutputStream::getBlockSize()
++{
++ return std::min(outputStream::getBlockSize(), getNextOutputStream().getBlockSize());
++}
++
++
+ // dotFilteredInputStream
+
+ dotFilteredInputStream::dotFilteredInputStream(inputStream& is)
+diff --git a/src/utility/stream.cpp b/src/utility/stream.cpp
+index bb5300e..8fbf337 100644
+--- a/src/utility/stream.cpp
++++ b/src/utility/stream.cpp
+@@ -38,7 +38,7 @@ namespace utility {
+
+ // stream
+
+-stream::size_type stream::getBlockSize() const
++stream::size_type stream::getBlockSize()
+ {
+ return 32768; // 32 KB
+ }
+@@ -468,7 +468,7 @@ void outputStreamSocketAdapter::flush()
+ }
+
+
+-stream::size_type outputStreamSocketAdapter::getBlockSize() const
++stream::size_type outputStreamSocketAdapter::getBlockSize()
+ {
+ return 16384; // 16 KB
+ }
+@@ -511,7 +511,7 @@ stream::size_type inputStreamSocketAdapter::skip
+ }
+
+
+-stream::size_type inputStreamSocketAdapter::getBlockSize() const
++stream::size_type inputStreamSocketAdapter::getBlockSize()
+ {
+ return 16384; // 16 KB
+ }
+diff --git a/vmime/utility/filteredStream.hpp b/vmime/utility/filteredStream.hpp
+index 9f64ba9..1e03697 100644
+--- a/vmime/utility/filteredStream.hpp
++++ b/vmime/utility/filteredStream.hpp
+@@ -41,6 +41,8 @@ class filteredInputStream : public inputStream
+ {
+ public:
+
++ virtual size_type getBlockSize();
++
+ /** Return a reference to the stream being filtered.
+ *
+ * @return stream being filtered
+@@ -56,6 +58,8 @@ class filteredOutputStream : public outputStream
+ {
+ public:
+
++ virtual size_type getBlockSize();
++
+ /** Return a reference to the stream being filtered.
+ *
+ * @return destination stream for filtered data
+diff --git a/vmime/utility/stream.hpp b/vmime/utility/stream.hpp
+index a9c079b..5f7bfa2 100644
+--- a/vmime/utility/stream.hpp
++++ b/vmime/utility/stream.hpp
+@@ -77,7 +77,7 @@ public:
+ *
+ * @return block size, in bytes
+ */
+- virtual size_type getBlockSize() const;
++ virtual size_type getBlockSize();
+ };
+
+
+@@ -239,6 +239,7 @@ public:
+ void write(const value_type* const data, const size_type count);
+ void flush();
+
++size_type getBlockSize(){return 8192;}
+ private:
+
+ string& m_buffer;
+@@ -402,7 +403,7 @@ public:
+ void write(const value_type* const data, const size_type count);
+ void flush();
+
+- size_type getBlockSize() const;
++ size_type getBlockSize();
+
+ private:
+
+@@ -426,7 +427,7 @@ public:
+ size_type read(value_type* const data, const size_type count);
+ size_type skip(const size_type count);
+
+- size_type getBlockSize() const;
++ size_type getBlockSize();
+
+ private:
+
+
+commit 11e0721c996957696f41f7450d4161fefad2f450
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Apr 9 20:24:08 2009 +0000
+
+ Fixed duplicate switch case on AIX (thanks to Robin Rawson-Tetley).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@489 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index e89b9ab..b371fe7 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -488,7 +488,9 @@ void posixFileSystemFactory::reportError(const vmime::utility::path& path, const
+ case ENOMEM: desc = "ENOMEM: insufficient kernel memory."; break;
+ case EMFILE: desc = "ENFILE: limit on number of files open by the process has been reached."; break;
+ case ENFILE: desc = "ENFILE: limit on number of files open on the system has been reached."; break;
++#ifndef AIX
+ case ENOTEMPTY: desc = "ENOTEMPTY: directory is not empty."; break;
++#endif
+
+ default:
+
+
+commit d5783e1bfc66a3632820379f4d3f45957469a260
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Apr 9 20:31:16 2009 +0000
+
+ Removed '-pipe' compiler flags, as it is not available on all platforms.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@490 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 4bfddd8..7ba1b27 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -590,7 +590,6 @@ env.Append(CPPPATH = [ '.' ])
+
+ env.Append(CPPDEFINES = ['_REENTRANT=1'])
+
+-env.Append(CXXFLAGS = ['-pipe'])
+ env.Append(CXXFLAGS = ['-W'])
+ env.Append(CXXFLAGS = ['-Wall'])
+ env.Append(CXXFLAGS = ['-ansi'])
+@@ -1831,7 +1830,7 @@ EXTRA_CFLAGS="$EXTRA_CFLAGS $lt_prog_compiler_pic"
+
+ """)
+
+- compilerFlags = [ '-pipe', '-ansi', '-pedantic', '-W', '-Wall', '-Wpointer-arith', '-Wold-style-cast', '-Wconversion' ]
++ compilerFlags = [ '-ansi', '-pedantic', '-W', '-Wall', '-Wpointer-arith', '-Wold-style-cast', '-Wconversion' ]
+
+ for f in compilerFlags:
+ configure_in.write('# ' + f + '\n')
+
+commit 71398fc74b32da917bb7e8bc8b7d7c1dc79dd03c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri May 1 17:11:20 2009 +0000
+
+ Fixed dynamic_cast support detection on HPUX (aCC).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@491 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 7ba1b27..2a01b61 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1414,8 +1414,8 @@ AC_TRY_COMPILE(
+ AC_MSG_CHECKING([if C++ compiler supports dynamic_cast<> (required)])
+ AC_TRY_COMPILE(
+ [
+- class foo { virtual ~foo() { } };
+- class bar : public foo { };
++ class foo { public: virtual ~foo() { } };
++ class bar : public foo { public: virtual ~bar() { } };
+ ],[
+ foo *c=0;
+ bar *c1=dynamic_cast<bar*>(c);
+
+commit 72074634c0810f69abc92c312199263921c1a619
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Jun 21 20:57:03 2009 +0000
+
+ Check return status of fsync (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@492 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/AUTHORS b/AUTHORS
+index da6f087..d252ee3 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -19,4 +19,5 @@ Other contributors:
+ - Benjamin Biron <benbiron@gmail.com>
+ - Bertrand Benoit <bsquare@bsquare.levillage.org>
+ - Tim Teulings <rael@edge.ping.de>
++ - Georg Sauthoff <gsauthof@techfak.uni-bielefeld.de>
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index b371fe7..d04ebc2 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -126,7 +126,8 @@ void posixFileWriterOutputStream::write(const value_type* const data, const size
+
+ void posixFileWriterOutputStream::flush()
+ {
+- ::fsync(m_fd);
++ if (::fsync(m_fd) == -1)
++ posixFileSystemFactory::reportError(m_path, errno);
+ }
+
+
+
+commit 063e9acffbbdff0ba65b69e27492551a4370673c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Jun 21 21:05:16 2009 +0000
+
+ Added other missing return error checks for posix system calls; check consistent for -1 (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@493 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index d04ebc2..79da351 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -63,7 +63,10 @@ posixFileIterator::posixFileIterator(const vmime::utility::file::path& path, con
+ posixFileIterator::~posixFileIterator()
+ {
+ if (m_dir != NULL)
+- ::closedir(m_dir);
++ {
++ if (::closedir(m_dir) == -1)
++ posixFileSystemFactory::reportError(m_path, errno);
++ }
+ }
+
+
+@@ -86,6 +89,8 @@ ref <vmime::utility::file> posixFileIterator::nextElement()
+
+ void posixFileIterator::getNextElement()
+ {
++ errno = 0;
++
+ while ((m_dirEntry = ::readdir(m_dir)) != NULL)
+ {
+ const char* name = m_dirEntry->d_name;
+@@ -97,6 +102,9 @@ void posixFileIterator::getNextElement()
+ break;
+ }
+ }
++
++ if (errno)
++ posixFileSystemFactory::reportError(m_path, errno);
+ }
+
+
+@@ -144,7 +152,8 @@ posixFileReaderInputStream::posixFileReaderInputStream(const vmime::utility::fil
+
+ posixFileReaderInputStream::~posixFileReaderInputStream()
+ {
+- ::close(m_fd);
++ if (::close(m_fd) == -1)
++ posixFileSystemFactory::reportError(m_path, errno);
+ }
+
+
+@@ -156,7 +165,8 @@ bool posixFileReaderInputStream::eof() const
+
+ void posixFileReaderInputStream::reset()
+ {
+- ::lseek(m_fd, 0, SEEK_SET);
++ if (::lseek(m_fd, 0, SEEK_SET) == off_t(-1))
++ posixFileSystemFactory::reportError(m_path, errno);
+ }
+
+
+@@ -178,8 +188,15 @@ vmime::utility::stream::size_type posixFileReaderInputStream::read
+ vmime::utility::stream::size_type posixFileReaderInputStream::skip(const size_type count)
+ {
+ const off_t curPos = ::lseek(m_fd, 0, SEEK_CUR);
++
++ if (curPos == off_t(-1))
++ posixFileSystemFactory::reportError(m_path, errno);
++
+ const off_t newPos = ::lseek(m_fd, count, SEEK_CUR);
+
++ if (newPos == off_t(-1))
++ posixFileSystemFactory::reportError(m_path, errno);
++
+ return static_cast <size_type>(newPos - curPos);
+ }
+
+@@ -246,7 +263,8 @@ void posixFile::createFile()
+ if ((fd = ::open(m_nativePath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0660)) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
+- ::close(fd);
++ if (::close(fd) == -1)
++ posixFileSystemFactory::reportError(m_path, errno);
+ }
+
+
+@@ -259,32 +277,58 @@ void posixFile::createDirectory(const bool createAll)
+ bool posixFile::isFile() const
+ {
+ struct stat buf;
+- return (::stat(m_nativePath.c_str(), &buf) == 0 && S_ISREG(buf.st_mode));
++
++ if (::stat(m_nativePath.c_str(), &buf) == -1)
++ {
++ posixFileSystemFactory::reportError(m_path, errno);
++ return false;
++ }
++
++ return S_ISREG(buf.st_mode);
+ }
+
+
+ bool posixFile::isDirectory() const
+ {
+ struct stat buf;
+- return (::stat(m_nativePath.c_str(), &buf) == 0 && S_ISDIR(buf.st_mode));
++
++ if (::stat(m_nativePath.c_str(), &buf) == -1)
++ {
++ posixFileSystemFactory::reportError(m_path, errno);
++ return false;
++ }
++
++ return S_ISDIR(buf.st_mode);
+ }
+
+
+ bool posixFile::canRead() const
+ {
+ struct stat buf;
+- return (::stat(m_nativePath.c_str(), &buf) == 0 &&
+- S_ISREG(buf.st_mode) &&
+- ::access(m_nativePath.c_str(), R_OK | F_OK) == 0);
++
++ if (::stat(m_nativePath.c_str(), &buf) == -1)
++ {
++ posixFileSystemFactory::reportError(m_path, errno);
++ return false;
++ }
++
++ return S_ISREG(buf.st_mode) &&
++ ::access(m_nativePath.c_str(), R_OK | F_OK) == 0;
+ }
+
+
+ bool posixFile::canWrite() const
+ {
+ struct stat buf;
+- return (::stat(m_nativePath.c_str(), &buf) == 0 &&
+- S_ISREG(buf.st_mode) &&
+- ::access(m_nativePath.c_str(), W_OK | F_OK) == 0);
++
++ if (::stat(m_nativePath.c_str(), &buf) == -1)
++ {
++ posixFileSystemFactory::reportError(m_path, errno);
++ return false;
++ }
++
++ return S_ISREG(buf.st_mode) &&
++ ::access(m_nativePath.c_str(), W_OK | F_OK) == 0;
+ }
+
+
+@@ -292,7 +336,7 @@ posixFile::length_type posixFile::getLength()
+ {
+ struct stat buf;
+
+- if (::stat(m_nativePath.c_str(), &buf) != 0)
++ if (::stat(m_nativePath.c_str(), &buf) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
+ return static_cast <length_type>(buf.st_size);
+@@ -325,7 +369,7 @@ void posixFile::rename(const path& newName)
+ {
+ const vmime::string newNativePath = posixFileSystemFactory::pathToStringImpl(newName);
+
+- if (::rename(m_nativePath.c_str(), newNativePath.c_str()) != 0)
++ if (::rename(m_nativePath.c_str(), newNativePath.c_str()) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
+ m_path = newName;
+@@ -337,17 +381,17 @@ void posixFile::remove()
+ {
+ struct stat buf;
+
+- if (::stat(m_nativePath.c_str(), &buf) != 0)
++ if (::stat(m_nativePath.c_str(), &buf) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
+ if (S_ISDIR(buf.st_mode))
+ {
+- if (::rmdir(m_nativePath.c_str()) != 0)
++ if (::rmdir(m_nativePath.c_str()) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+ }
+ else if (S_ISREG(buf.st_mode))
+ {
+- if (::unlink(m_nativePath.c_str()) != 0)
++ if (::unlink(m_nativePath.c_str()) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+ }
+ }
+@@ -386,7 +430,7 @@ void posixFile::createDirectoryImpl(const vmime::utility::file::path& fullPath,
+ if (!path.isEmpty() && recursive)
+ createDirectoryImpl(fullPath, path.getParent(), true);
+
+- if (::mkdir(nativePath.c_str(), 0750) != 0)
++ if (::mkdir(nativePath.c_str(), 0750) == -1)
+ posixFileSystemFactory::reportError(fullPath, errno);
+ }
+
+
+commit da3d98391ef7004969845593d583812d06d904e7
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Jun 21 21:07:35 2009 +0000
+
+ Changed posix write wrapper since a) write can be interrupted and b) write can write less than specified without error (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@494 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index 79da351..9b16d03 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -127,8 +127,29 @@ posixFileWriterOutputStream::~posixFileWriterOutputStream()
+
+ void posixFileWriterOutputStream::write(const value_type* const data, const size_type count)
+ {
+- if (::write(m_fd, data, count) == -1)
+- posixFileSystemFactory::reportError(m_path, errno);
++ const value_type* array = data;
++ size_t size = count;
++
++ while (1)
++ {
++ ssize_t ret = ::write(m_fd, array, size);
++
++ if (ret == -1)
++ {
++ if (errno == EINTR)
++ continue;
++
++ posixFileSystemFactory::reportError(m_path, errno);
++ break;
++ }
++ else if (size_t(ret) < size)
++ {
++ array += ret;
++ size -= ret;
++ }
++
++ break;
++ }
+ }
+
+
+
+commit 33c37b2603fc3a0608fc75d2951408057d38ba60
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Jun 21 21:08:56 2009 +0000
+
+ Use ::flush() (aka fsync()) after a maildir message is written (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@495 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
+index 4f0acaf..9a52171 100644
+--- a/src/net/maildir/maildirFolder.cpp
++++ b/src/net/maildir/maildirFolder.cpp
+@@ -945,6 +945,8 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
+ if (progress)
+ progress->progress(total, size);
+ }
++
++ os->flush();
+ }
+ catch (exception& e)
+ {
+
+commit 58afd9dee9633c8e66eb9b9a4d781fdd5de402e9
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Jun 21 21:19:00 2009 +0000
+
+ Include hostname in message id (ensure unicity when working on a network file system).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@496 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
+index 67d52fe..13311a5 100644
+--- a/src/net/maildir/maildirUtils.cpp
++++ b/src/net/maildir/maildirUtils.cpp
+@@ -25,6 +25,7 @@
+ #include "vmime/net/maildir/maildirStore.hpp"
+
+ #include "vmime/utility/random.hpp"
++#include "vmime/platform.hpp"
+
+ #include "vmime/exception.hpp"
+
+@@ -153,6 +154,8 @@ const utility::file::path::component maildirUtils::generateId()
+ oss << utility::random::getProcess();
+ oss << ".";
+ oss << utility::random::getString(6);
++ oss << ".";
++ oss << platform::getHandler()->getHostName();
+
+ return (utility::file::path::component(oss.str()));
+ }
+
+commit 184dacc1ff75195fa594a18fb697b80dd8e08e43
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Jun 21 21:32:25 2009 +0000
+
+ gnutls_x509_crt_list_import does not support multiple DER certificates (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@497 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp
+index 73af1da..4f64967 100644
+--- a/src/net/tls/TLSSocket.cpp
++++ b/src/net/tls/TLSSocket.cpp
+@@ -292,27 +292,26 @@ ref <security::cert::certificateChain> TLSSocket::getPeerCertificates() const
+ // Try X.509
+ gnutls_x509_crt* x509Certs = new gnutls_x509_crt[certCount];
+
+- unsigned int count = certCount;
+-
+- int res = gnutls_x509_crt_list_import
+- (x509Certs, &count, rawData, GNUTLS_X509_FMT_PEM, 0);
+-
+- if (res <= 0)
++ for (unsigned int i = 0; i < certCount; ++i)
+ {
+- count = certCount;
++ gnutls_x509_crt_init(x509Certs + i);
+
+- res = gnutls_x509_crt_list_import
+- (x509Certs, &count, rawData, GNUTLS_X509_FMT_DER, 0);
++ int res = gnutls_x509_crt_import(x509Certs[i], rawData + i,
++ GNUTLS_X509_FMT_DER);
++
++ if (res < 0)
++ {
++ // XXX more fine-grained error reporting?
++ delete [] x509Certs;
++ return NULL;
++ }
+ }
+
+- if (res >= 1)
+ {
+ std::vector <ref <security::cert::certificate> > certs;
+ bool error = false;
+
+- count = static_cast <unsigned int>(res);
+-
+- for (unsigned int i = 0 ; i < count ; ++i)
++ for (unsigned int i = 0 ; i < certCount ; ++i)
+ {
+ size_t dataSize = 0;
+
+
+commit c0cec33b83284f8ad6112c63cea9c11f4c067e0c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sat Jul 11 12:21:59 2009 +0000
+
+ Ensure 'unsigned long' is 4 bytes long (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@498 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
+index a51e250..51eec6a 100644
+--- a/src/security/digest/sha1/sha1MessageDigest.cpp
++++ b/src/security/digest/sha1/sha1MessageDigest.cpp
+@@ -27,6 +27,7 @@
+ #include "vmime/security/digest/sha1/sha1MessageDigest.hpp"
+
+ #include <cstring>
++#include <cassert>
+
+
+ namespace vmime {
+@@ -161,8 +162,8 @@ void sha1MessageDigest::finalize()
+ i = j = 0;
+
+ std::memset(m_buffer, 0, 64);
+- std::memset(m_state, 0, 20);
+- std::memset(m_count, 0, 8);
++ std::memset(m_state, 0, 5 * sizeof(unsigned long));
++ std::memset(m_count, 0, 2 * sizeof(unsigned long));
+ std::memset(&finalcount, 0, 8);
+ }
+
+@@ -201,6 +202,8 @@ void sha1MessageDigest::transform
+ unsigned long l[16];
+ } CHAR64LONG16;
+
++ assert(sizeof(unsigned long) == 4);
++
+ CHAR64LONG16* block;
+ static unsigned char workspace[64];
+
+
+commit ab6295012905d625d8606408905c8e4bb63b0635
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sat Jul 11 12:31:18 2009 +0000
+
+ fsync() in posixFile::fileCreate(); changed posixFile::rename to exclusive semantics - if dst exists it fails (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@499 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index 9b16d03..2a1356a 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -284,6 +284,9 @@ void posixFile::createFile()
+ if ((fd = ::open(m_nativePath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0660)) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
++ if (::fsync(fd) == -1)
++ posixFileSystemFactory::reportError(m_path, errno);
++
+ if (::close(fd) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+ }
+@@ -390,6 +393,9 @@ void posixFile::rename(const path& newName)
+ {
+ const vmime::string newNativePath = posixFileSystemFactory::pathToStringImpl(newName);
+
++ posixFile dest(newName);
++ dest.createFile();
++
+ if (::rename(m_nativePath.c_str(), newNativePath.c_str()) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
+
+commit 37807bc97a51d0ef561c9102580b2dd12d66c08a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sat Jul 11 12:39:36 2009 +0000
+
+ maildirFolder::addMessage() : iff FLAG_RECENT is present, add message to 'new' instead of 'cur' (Georg Sauthoff).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@500 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
+index 9a52171..65abdcf 100644
+--- a/src/net/maildir/maildirFolder.cpp
++++ b/src/net/maildir/maildirFolder.cpp
+@@ -835,9 +835,12 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size,
+ utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
+
+ utility::file::path tmpDirPath = store->getFormat()->
+- folderPathToFileSystemPath(m_path, maildirFormat::TMP_DIRECTORY);
+- utility::file::path curDirPath = store->getFormat()->
+- folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
++ folderPathToFileSystemPath(m_path,maildirFormat::TMP_DIRECTORY);
++ utility::file::path dstDirPath = store->getFormat()->
++ folderPathToFileSystemPath(m_path,
++ flags == message::FLAG_RECENT ?
++ maildirFormat::NEW_DIRECTORY :
++ maildirFormat::CUR_DIRECTORY);
+
+ const utility::file::path::component filename =
+ maildirUtils::buildFilename(maildirUtils::generateId(),
+@@ -855,7 +858,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size,
+
+ try
+ {
+- ref <utility::file> curDir = fsf->create(curDirPath);
++ ref <utility::file> curDir = fsf->create(dstDirPath);
+ curDir->createDirectory(true);
+ }
+ catch (exceptions::filesystem_exception&)
+@@ -864,7 +867,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size,
+ }
+
+ // Actually add the message
+- copyMessageImpl(tmpDirPath, curDirPath, filename, is, size, progress);
++ copyMessageImpl(tmpDirPath, dstDirPath, filename, is, size, progress);
+
+ // Append the message to the cache list
+ messageInfos msgInfos;
+@@ -910,7 +913,8 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size,
+
+
+ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
+- const utility::file::path& curDirPath, const utility::file::path::component& filename,
++ const utility::file::path& dstDirPath,
++ const utility::file::path::component& filename,
+ utility::inputStream& is, const utility::stream::size_type size,
+ utility::progressListener* progress)
+ {
+@@ -970,7 +974,7 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
+ // ...then, move it to 'cur'
+ try
+ {
+- file->rename(curDirPath / filename);
++ file->rename(dstDirPath / filename);
+ }
+ catch (exception& e)
+ {
+@@ -980,7 +984,8 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
+ // Delete temporary file
+ try
+ {
+- ref <utility::file> file = fsf->create(tmpDirPath / filename);
++ file->remove();
++ ref <utility::file> file = fsf->create(dstDirPath / filename);
+ file->remove();
+ }
+ catch (exceptions::filesystem_exception&)
+diff --git a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
+index 13311a5..bb2b69f 100644
+--- a/src/net/maildir/maildirUtils.cpp
++++ b/src/net/maildir/maildirUtils.cpp
+@@ -129,18 +129,24 @@ const utility::file::path::component maildirUtils::buildFlags(const int flags)
+ const utility::file::path::component maildirUtils::buildFilename
+ (const utility::file::path::component& id, const int flags)
+ {
+- return (buildFilename(id, buildFlags(flags)));
++ if (flags == message::FLAG_RECENT)
++ return id;
++ else
++ return (buildFilename(id, buildFlags(flags)));
+ }
+
+
+ const utility::file::path::component maildirUtils::buildFilename
+- (const utility::file::path::component& id, const utility::file::path::component& flags)
++ (const utility::file::path::component& id,
++ const utility::file::path::component& flags)
+ {
+ #if VMIME_BUILTIN_PLATFORM_WINDOWS
+- return (utility::path::component(id.getBuffer() + "-" + flags.getBuffer())); // use dash
++ static const char DELIMITER[] = "-";
+ #else
+- return (utility::path::component(id.getBuffer() + ":" + flags.getBuffer())); // use colon
++ static const char DELIMITER[] = ":";
+ #endif
++
++ return utility::path::component(id.getBuffer() + DELIMITER + flags.getBuffer());
+ }
+
+
+
+commit 867808f0e40d69009755419d77f764d2224b8a78
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Aug 19 18:41:20 2009 +0000
+
+ Use pkg-config for gnutls 2.8.0 and later (thanks to Andreas Metzler).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@501 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 2a01b61..2e86832 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1617,7 +1617,7 @@ AC_ARG_ENABLE(tls,
+
+ if test "x$conf_tls" = "xyes"; then
+ # -- GNU TLS Library (http://www.gnu.org/software/gnutls/)
+- AM_PATH_LIBGNUTLS(1.2.0, have_gnutls=yes, have_gnutls=no)
++ PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0], have_gnutls=yes, have_gnutls=no)
+
+ if test "x$have_gnutls" = "xyes"; then
+ AM_CONDITIONAL(VMIME_HAVE_TLS_SUPPORT, true)
+
+commit 0dc22247b059382321a3228bb07e0819596466d0
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Sep 6 12:02:10 2009 +0000
+
+ Relicensed VMime under the GNU GPL version 3. Changed copyright year to 2009.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@502 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/AUTHORS b/AUTHORS
+index d252ee3..8391c18 100644
+--- a/AUTHORS
++++ b/AUTHORS
@@ -1,17 +1,14 @@
-VMIME AUTHORS AND CONTRIBUTORS
@@ -28,53 +3511,20 @@ diff -urN a/AUTHORS b/AUTHORS
- Stefan Uhrig <stefanuhrig@gmx.net>
- Rafael Fernandez <prf@adinet.com.uy>
-@@ -19,4 +16,11 @@
- - Benjamin Biron <benbiron@gmail.com>
+@@ -20,4 +17,9 @@ Other contributors:
- Bertrand Benoit <bsquare@bsquare.levillage.org>
- Tim Teulings <rael@edge.ping.de>
-+ - Georg Sauthoff <gsauthof@techfak.uni-bielefeld.de>
+ - Georg Sauthoff <gsauthof@techfak.uni-bielefeld.de>
+ - Pierre Thierry <nowhere.man@levallois.eu.org> (patches for STL algorithms)
+ - Zarafa <http://developer.zarafa.com/VmimePatches>
-+ - Bartek Szurgot <vempirelord@wp.pl, http://baszerr.org>
+
+Please apologize if I have forgotten someone here. ;)
+See SVN Changelog for full list.
-diff -urN a/bootstrap b/bootstrap
---- a/bootstrap 2008-10-19 14:35:41.000000000 +0200
-+++ b/bootstrap 2010-02-09 14:34:54.000000000 +0100
-@@ -40,6 +40,7 @@
- || (echo "[NO]" ; cat bootstrap.tmpout ; rm -f bootstrap.tmpout ; not_a_command >& /dev/null) || DIE=1
- fi
-
-+# Bug with automake 1.10?
- touch autotools/config.rpath
-
- if test $DIE = 0 ; then
-diff -urN a/ChangeLog b/ChangeLog
---- a/ChangeLog 2008-10-19 13:57:34.000000000 +0200
-+++ b/ChangeLog 2010-02-09 14:34:54.000000000 +0100
-@@ -1,4 +1,17 @@
-
-+VERSION 0.9.1svn
-+================
-+
-+2009-09-06 Vincent Richard <vincent@vincent-richard.net>
-+
-+ * Relicensed VMime under the GNU GPL license version 3. Dual licensing
-+ is now available. More info here: http://www.vmime.org/pages/Licensing
-+
-+2008-10-19 Vincent Richard <vincent@vincent-richard.net>
-+
-+ * Started version 0.9.1.
-+
-+
- VERSION 0.9.0
- =============
-
-diff -urN a/COPYING b/COPYING
---- a/COPYING 2008-01-05 18:49:22.000000000 +0100
-+++ b/COPYING 2010-02-09 14:34:54.000000000 +0100
+diff --git a/COPYING b/COPYING
+index 5b6e7c6..94a9ed0 100644
+--- a/COPYING
++++ b/COPYING
@@ -1,285 +1,626 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
@@ -116,15 +3566,14 @@ diff -urN a/COPYING b/COPYING
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
--
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
+
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-+them if you wish), that you receive source code or can get it if you
-+want it, that you can change the software or use pieces of it in new
-+free programs, and that you know you can do these things.
-+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
@@ -836,6 +4285,9 @@ diff -urN a/COPYING b/COPYING
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
+-
+- 9. The Free Software Foundation may publish revised and/or new versions
+-of the General Public License from time to time. Such new versions will
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
@@ -856,9 +4308,7 @@ diff -urN a/COPYING b/COPYING
+combination as such.
+
+ 14. Revised Versions of this License.
-
-- 9. The Free Software Foundation may publish revised and/or new versions
--of the General Public License from time to time. Such new versions will
++
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
@@ -962,7 +4412,7 @@ diff -urN a/COPYING b/COPYING
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
-@@ -287,15 +628,15 @@
+@@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
@@ -981,7 +4431,7 @@ diff -urN a/COPYING b/COPYING
(at your option) any later version.
This program is distributed in the hope that it will be useful,
-@@ -304,37 +645,30 @@
+@@ -304,37 +645,30 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
@@ -1038,9 +4488,57 @@ diff -urN a/COPYING b/COPYING
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
-diff -urN a/examples/example1.cpp b/examples/example1.cpp
---- a/examples/example1.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example1.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/ChangeLog b/ChangeLog
+index b9a510f..4031746 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -2,6 +2,11 @@
+ VERSION 0.9.1svn
+ ================
+
++2009-09-06 Vincent Richard <vincent@vincent-richard.net>
++
++ * Relicensed VMime under the GNU GPL license version 3. Dual licensing
++ is now available. More info here: http://www.vmime.org/pages/Licensing
++
+ 2008-10-19 Vincent Richard <vincent@vincent-richard.net>
+
+ * Started version 0.9.1.
+diff --git a/doc/book/intro.tex b/doc/book/intro.tex
+index 93a3675..26d9abe 100644
+--- a/doc/book/intro.tex
++++ b/doc/book/intro.tex
+@@ -52,14 +52,14 @@ The main objectives of this library are:
+
+ VMime library is Free Software and is licensed under the terms of the GNU
+ General Public License\footnote{See Appendix \ref{appendix_license} and
+-\url{http://www.gnu.org/copyleft/gpl.html}} (GPL):
++\url{http://www.gnu.org/copyleft/gpl.html}} (GPL) version 3:
+
+ \begin{verbatim}
+- Copyright (C) 2002-2008 Vincent Richard
++ Copyright (C) 2002-2009 Vincent Richard
+
+ VMime library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+- published by the Free Software Foundation; either version 2 of
++ published by the Free Software Foundation; either version 3 of
+ the License, or (at your option) any later version.
+
+ VMime is distributed in the hope that it will be useful, but
+@@ -79,7 +79,7 @@ GNU Free Documentation
+ License\footnote{See \url{http://www.gnu.org/copyleft/fdl.html}} (FDL):
+
+ \begin{verbatim}
+- Copyright (C) 2004-2007 Vincent Richard
++ Copyright (C) 2004-2009 Vincent Richard
+
+ Permission is granted to copy, distribute and/or modify
+ this document under the terms of the GNU Free Documentation
+diff --git a/examples/example1.cpp b/examples/example1.cpp
+index 5552510..a340f1d 100644
+--- a/examples/example1.cpp
++++ b/examples/example1.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1054,9 +4552,10 @@ diff -urN a/examples/example1.cpp b/examples/example1.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/examples/example2.cpp b/examples/example2.cpp
---- a/examples/example2.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example2.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/examples/example2.cpp b/examples/example2.cpp
+index 953d669..af91f12 100644
+--- a/examples/example2.cpp
++++ b/examples/example2.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1070,9 +4569,10 @@ diff -urN a/examples/example2.cpp b/examples/example2.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/examples/example3.cpp b/examples/example3.cpp
---- a/examples/example3.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example3.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/examples/example3.cpp b/examples/example3.cpp
+index 0a260a9..cb3e6ae 100644
+--- a/examples/example3.cpp
++++ b/examples/example3.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1086,9 +4586,10 @@ diff -urN a/examples/example3.cpp b/examples/example3.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/examples/example4.cpp b/examples/example4.cpp
---- a/examples/example4.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example4.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/examples/example4.cpp b/examples/example4.cpp
+index 09c2dad..6a746da 100644
+--- a/examples/example4.cpp
++++ b/examples/example4.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1102,9 +4603,10 @@ diff -urN a/examples/example4.cpp b/examples/example4.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/examples/example5.cpp b/examples/example5.cpp
---- a/examples/example5.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example5.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/examples/example5.cpp b/examples/example5.cpp
+index 11ceb83..ad84db9 100644
+--- a/examples/example5.cpp
++++ b/examples/example5.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1118,9 +4620,10 @@ diff -urN a/examples/example5.cpp b/examples/example5.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/examples/example6.cpp b/examples/example6.cpp
---- a/examples/example6.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example6.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/examples/example6.cpp b/examples/example6.cpp
+index 8bf7b44..bcb2df9 100644
+--- a/examples/example6.cpp
++++ b/examples/example6.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1134,9 +4637,10 @@ diff -urN a/examples/example6.cpp b/examples/example6.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/examples/example7.cpp b/examples/example7.cpp
---- a/examples/example7.cpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/examples/example7.cpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/examples/example7.cpp b/examples/example7.cpp
+index 79445ea..1ddb3d0 100644
+--- a/examples/example7.cpp
++++ b/examples/example7.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1150,568 +4654,10 @@ diff -urN a/examples/example7.cpp b/examples/example7.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/INSTALL b/INSTALL
---- a/INSTALL 2008-10-19 14:36:21.000000000 +0200
-+++ b/INSTALL 2010-02-10 11:06:52.000000000 +0100
-@@ -2,15 +2,15 @@
- *************************
-
- Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
--2006, 2007 Free Software Foundation, Inc.
-+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-
--This file is free documentation; the Free Software Foundation gives
-+ This file is free documentation; the Free Software Foundation gives
- unlimited permission to copy, distribute and modify it.
-
- Basic Installation
- ==================
-
--Briefly, the shell commands `./configure; make; make install' should
-+ Briefly, the shell commands `./configure; make; make install' should
- configure, build, and install this package. The following
- more-detailed instructions are generic; see the `README' file for
- instructions specific to this package.
-@@ -73,9 +73,9 @@
- Compilers and Options
- =====================
-
--Some systems require unusual options for compilation or linking that the
--`configure' script does not know about. Run `./configure --help' for
--details on some of the pertinent environment variables.
-+ Some systems require unusual options for compilation or linking that
-+the `configure' script does not know about. Run `./configure --help'
-+for details on some of the pertinent environment variables.
-
- You can give `configure' initial values for configuration parameters
- by setting variables in the command line or in the environment. Here
-@@ -88,7 +88,7 @@
- Compiling For Multiple Architectures
- ====================================
-
--You can compile the package for more than one kind of computer at the
-+ You can compile the package for more than one kind of computer at the
- same time, by placing the object files for each architecture in their
- own directory. To do this, you can use GNU `make'. `cd' to the
- directory where you want the object files and executables to go and run
-@@ -100,10 +100,24 @@
- installed the package for one architecture, use `make distclean' before
- reconfiguring for another architecture.
-
-+ On MacOS X 10.5 and later systems, you can create libraries and
-+executables that work on multiple system types--known as "fat" or
-+"universal" binaries--by specifying multiple `-arch' options to the
-+compiler but only a single `-arch' option to the preprocessor. Like
-+this:
-+
-+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
-+ CPP="gcc -E" CXXCPP="g++ -E"
-+
-+ This is not guaranteed to produce working output in all cases, you
-+may have to build one architecture at a time and combine the results
-+using the `lipo' tool if you have problems.
-+
- Installation Names
- ==================
-
--By default, `make install' installs the package's commands under
-+ By default, `make install' installs the package's commands under
- `/usr/local/bin', include files under `/usr/local/include', etc. You
- can specify an installation prefix other than `/usr/local' by giving
- `configure' the option `--prefix=PREFIX'.
-@@ -126,7 +140,7 @@
- Optional Features
- =================
-
--Some packages pay attention to `--enable-FEATURE' options to
-+ Some packages pay attention to `--enable-FEATURE' options to
- `configure', where FEATURE indicates an optional part of the package.
- They may also pay attention to `--with-PACKAGE' options, where PACKAGE
- is something like `gnu-as' or `x' (for the X Window System). The
-@@ -138,14 +152,46 @@
- you can use the `configure' options `--x-includes=DIR' and
- `--x-libraries=DIR' to specify their locations.
-
-+Particular systems
-+==================
-+
-+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
-+CC is not installed, it is recommended to use the following options in
-+order to use an ANSI C compiler:
-+
-+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
-+
-+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
-+
-+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
-+a workaround. If GNU CC is not installed, it is therefore recommended
-+to try
-+
-+ ./configure CC="cc"
-+
-+and if that doesn't work, try
-+
-+ ./configure CC="cc -nodtk"
-+
-+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
-+directory contains several dysfunctional programs; working variants of
-+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
-+in your `PATH', put it _after_ `/usr/bin'.
-+
-+ On Haiku, software installed for all users goes in `/boot/common',
-+not `/usr/local'. It is recommended to use the following options:
-+
-+ ./configure --prefix=/boot/common
-+
- Specifying the System Type
- ==========================
-
--There may be some features `configure' cannot figure out automatically,
--but needs to determine by the type of machine the package will run on.
--Usually, assuming the package is built to be run on the _same_
--architectures, `configure' can figure that out, but if it prints a
--message saying it cannot guess the machine type, give it the
-+ There may be some features `configure' cannot figure out
-+automatically, but needs to determine by the type of machine the package
-+will run on. Usually, assuming the package is built to be run on the
-+_same_ architectures, `configure' can figure that out, but if it prints
-+a message saying it cannot guess the machine type, give it the
- `--build=TYPE' option. TYPE can either be a short name for the system
- type, such as `sun4', or a canonical name which has the form:
-
-@@ -153,7 +199,8 @@
-
- where SYSTEM can have one of these forms:
-
-- OS KERNEL-OS
-+ OS
-+ KERNEL-OS
-
- See the file `config.sub' for the possible values of each field. If
- `config.sub' isn't included in this package, then this package doesn't
-@@ -171,9 +218,9 @@
- Sharing Defaults
- ================
-
--If you want to set default values for `configure' scripts to share, you
--can create a site shell script called `config.site' that gives default
--values for variables like `CC', `cache_file', and `prefix'.
-+ If you want to set default values for `configure' scripts to share,
-+you can create a site shell script called `config.site' that gives
-+default values for variables like `CC', `cache_file', and `prefix'.
- `configure' looks for `PREFIX/share/config.site' if it exists, then
- `PREFIX/etc/config.site' if it exists. Or, you can set the
- `CONFIG_SITE' environment variable to the location of the site script.
-@@ -182,7 +229,7 @@
- Defining Variables
- ==================
-
--Variables not defined in a site shell script can be set in the
-+ Variables not defined in a site shell script can be set in the
- environment passed to `configure'. However, some packages may run
- configure again during the build, and the customized values of these
- variables may be lost. In order to avoid this problem, you should set
-@@ -201,11 +248,19 @@
- `configure' Invocation
- ======================
-
--`configure' recognizes the following options to control how it operates.
-+ `configure' recognizes the following options to control how it
-+operates.
-
- `--help'
- `-h'
-- Print a summary of the options to `configure', and exit.
-+ Print a summary of all of the options to `configure', and exit.
-+
-+`--help=short'
-+`--help=recursive'
-+ Print a summary of the options unique to this package's
-+ `configure', and exit. The `short' variant lists options used
-+ only in the top level, while the `recursive' variant lists options
-+ also present in any nested packages.
-
- `--version'
- `-V'
-@@ -232,6 +287,16 @@
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-+`--prefix=DIR'
-+ Use DIR as the installation prefix. *Note Installation Names::
-+ for more details, including other options available for fine-tuning
-+ the installation locations.
-+
-+`--no-create'
-+`-n'
-+ Run the configure checks, but stop before creating any output
-+ files.
-+
- `configure' also accepts some other, not widely useful, options. Run
- `configure --help' for more details.
-
-diff -urN a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
---- a/m4/acx_pthread.m4 1970-01-01 01:00:00.000000000 +0100
-+++ b/m4/acx_pthread.m4 2010-02-09 14:34:51.000000000 +0100
-@@ -0,0 +1,235 @@
-+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-+dnl
-+dnl This macro figures out how to build C programs using POSIX threads.
-+dnl It sets the PTHREAD_LIBS output variable to the threads library and
-+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
-+dnl C compiler flags that are needed. (The user can also force certain
-+dnl compiler flags/libs to be tested by setting these environment
-+dnl variables.)
-+dnl
-+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-+dnl multi-threaded programs (defaults to the value of CC otherwise).
-+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-+dnl
-+dnl NOTE: You are assumed to not only compile your program with these
-+dnl flags, but also link it with them as well. e.g. you should link
-+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
-+dnl $LIBS
-+dnl
-+dnl If you are only building threads programs, you may wish to use
-+dnl these variables in your default LIBS, CFLAGS, and CC:
-+dnl
-+dnl LIBS="$PTHREAD_LIBS $LIBS"
-+dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-+dnl CC="$PTHREAD_CC"
-+dnl
-+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
-+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-+dnl
-+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
-+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
-+dnl default action will define HAVE_PTHREAD.
-+dnl
-+dnl Please let the authors know if this macro fails on any platform, or
-+dnl if you have any other suggestions or comments. This macro was based
-+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
-+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
-+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
-+dnl We are also grateful for the helpful feedback of numerous users.
-+dnl
-+dnl @category InstalledPackages
-+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-+dnl @version 2005-01-14
-+dnl @license GPLWithACException
-+
-+AC_DEFUN([ACX_PTHREAD], [
-+AC_REQUIRE([AC_CANONICAL_HOST])
-+AC_LANG_SAVE
-+AC_LANG_C
-+acx_pthread_ok=no
-+
-+# We used to check for pthread.h first, but this fails if pthread.h
-+# requires special compiler flags (e.g. on True64 or Sequent).
-+# It gets checked for in the link test anyway.
-+
-+# First of all, check if the user has set any of the PTHREAD_LIBS,
-+# etcetera environment variables, and if threads linking works using
-+# them:
-+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
-+ save_CFLAGS="$CFLAGS"
-+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-+ save_LIBS="$LIBS"
-+ LIBS="$PTHREAD_LIBS $LIBS"
-+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
-+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
-+ AC_MSG_RESULT($acx_pthread_ok)
-+ if test x"$acx_pthread_ok" = xno; then
-+ PTHREAD_LIBS=""
-+ PTHREAD_CFLAGS=""
-+ fi
-+ LIBS="$save_LIBS"
-+ CFLAGS="$save_CFLAGS"
-+fi
-+
-+# We must check for the threads library under a number of different
-+# names; the ordering is very important because some systems
-+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-+# libraries is broken (non-POSIX).
-+
-+# Create a list of thread flags to try. Items starting with a "-" are
-+# C compiler flags, and other items are library names, except for "none"
-+# which indicates that we try without any flags at all, and "pthread-config"
-+# which is a program returning the flags for the Pth emulation library.
-+
-+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-+
-+# The ordering *is* (sometimes) important. Some notes on the
-+# individual items follow:
-+
-+# pthreads: AIX (must check this before -lpthread)
-+# none: in case threads are in libc; should be tried before -Kthread and
-+# other compiler flags to prevent continual compiler warnings
-+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-+# -pthreads: Solaris/gcc
-+# -mthreads: Mingw32/gcc, Lynx/gcc
-+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-+# doesn't hurt to check since this sometimes defines pthreads too;
-+# also defines -D_REENTRANT)
-+# pthread: Linux, etcetera
-+# --thread-safe: KAI C++
-+# pthread-config: use pthread-config program (for GNU Pth library)
-+
-+case "${host_cpu}-${host_os}" in
-+ *solaris*)
-+
-+ # On Solaris (at least, for some versions), libc contains stubbed
-+ # (non-functional) versions of the pthreads routines, so link-based
-+ # tests will erroneously succeed. (We need to link with -pthread or
-+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
-+ # a function called by this macro, so we could check for that, but
-+ # who knows whether they'll stub that too in a future libc.) So,
-+ # we'll just look for -pthreads and -lpthread first:
-+
-+ acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
-+ ;;
-+esac
-+
-+if test x"$acx_pthread_ok" = xno; then
-+for flag in $acx_pthread_flags; do
-+
-+ case $flag in
-+ none)
-+ AC_MSG_CHECKING([whether pthreads work without any flags])
-+ ;;
-+
-+ -*)
-+ AC_MSG_CHECKING([whether pthreads work with $flag])
-+ PTHREAD_CFLAGS="$flag"
-+ ;;
-+
-+ pthread-config)
-+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
-+ if test x"$acx_pthread_config" = xno; then continue; fi
-+ PTHREAD_CFLAGS="`pthread-config --cflags`"
-+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
-+ ;;
-+
-+ *)
-+ AC_MSG_CHECKING([for the pthreads library -l$flag])
-+ PTHREAD_LIBS="-l$flag"
-+ ;;
-+ esac
-+
-+ save_LIBS="$LIBS"
-+ save_CFLAGS="$CFLAGS"
-+ LIBS="$PTHREAD_LIBS $LIBS"
-+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-+
-+ # Check for various functions. We must include pthread.h,
-+ # since some functions may be macros. (On the Sequent, we
-+ # need a special flag -Kthread to make this header compile.)
-+ # We check for pthread_join because it is in -lpthread on IRIX
-+ # while pthread_create is in libc. We check for pthread_attr_init
-+ # due to DEC craziness with -lpthreads. We check for
-+ # pthread_cleanup_push because it is one of the few pthread
-+ # functions on Solaris that doesn't have a non-functional libc stub.
-+ # We try pthread_create on general principles.
-+ AC_TRY_LINK([#include <pthread.h>],
-+ [pthread_t th; pthread_join(th, 0);
-+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
-+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
-+ [acx_pthread_ok=yes])
-+
-+ LIBS="$save_LIBS"
-+ CFLAGS="$save_CFLAGS"
-+
-+ AC_MSG_RESULT($acx_pthread_ok)
-+ if test "x$acx_pthread_ok" = xyes; then
-+ break;
-+ fi
-+
-+ PTHREAD_LIBS=""
-+ PTHREAD_CFLAGS=""
-+done
-+fi
-+
-+# Various other checks:
-+if test "x$acx_pthread_ok" = xyes; then
-+ save_LIBS="$LIBS"
-+ LIBS="$PTHREAD_LIBS $LIBS"
-+ save_CFLAGS="$CFLAGS"
-+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-+
-+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
-+ AC_MSG_CHECKING([for joinable pthread attribute])
-+ attr_name=unknown
-+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
-+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
-+ [attr_name=$attr; break])
-+ done
-+ AC_MSG_RESULT($attr_name)
-+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
-+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
-+ [Define to necessary symbol if this constant
-+ uses a non-standard name on your system.])
-+ fi
-+
-+ AC_MSG_CHECKING([if more special flags are required for pthreads])
-+ flag=no
-+ case "${host_cpu}-${host_os}" in
-+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
-+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
-+ esac
-+ AC_MSG_RESULT(${flag})
-+ if test "x$flag" != xno; then
-+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
-+ fi
-+
-+ LIBS="$save_LIBS"
-+ CFLAGS="$save_CFLAGS"
-+
-+ # More AIX lossage: must compile with cc_r
-+ AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
-+else
-+ PTHREAD_CC="$CC"
-+fi
-+
-+AC_SUBST(PTHREAD_LIBS)
-+AC_SUBST(PTHREAD_CFLAGS)
-+AC_SUBST(PTHREAD_CC)
-+
-+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-+if test x"$acx_pthread_ok" = xyes; then
-+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
-+ :
-+else
-+ acx_pthread_ok=no
-+ $2
-+fi
-+AC_LANG_RESTORE
-+])dnl ACX_PTHREAD
-diff -urN a/SConstruct b/SConstruct
---- a/SConstruct 2008-10-19 14:27:32.000000000 +0200
-+++ b/SConstruct 2010-02-10 11:06:33.000000000 +0100
-@@ -29,7 +29,7 @@
- # Package version number
- packageVersionMajor = 0
- packageVersionMinor = 9
--packageVersionMicro = 0
-+packageVersionMicro = 1
-
- # API version number (libtool)
- #
-@@ -376,6 +376,7 @@
- ]
-
- libvmime_autotools = [
-+ 'm4/acx_pthread.m4',
- 'm4/iconv.m4',
- 'm4/lib-ld.m4',
- 'm4/lib-link.m4',
-@@ -439,9 +440,11 @@
-
- SetOption('implicit_cache', 1)
-
--#SourceSignatures('timestamp')
--SourceSignatures('MD5')
--TargetSignatures('build')
-+try:
-+ Decider('MD5-timestamp')
-+except:
-+ SourceSignatures('MD5')
-+ TargetSignatures('build')
-
-
- #############
-@@ -528,14 +531,6 @@
- defaultSendmailPath
- ),
- EnumOption(
-- 'with_wide_char_support',
-- 'Support for wide characters (rarely used, should be set to "no")',
-- 'no',
-- allowed_values = ('yes', 'no'),
-- map = { },
-- ignorecase = 1
-- ),
-- EnumOption(
- 'byte_order',
- 'Byte order (Big Endian or Little Endian)',
- sys.byteorder,
-@@ -592,7 +587,6 @@
-
- env.Append(CPPDEFINES = ['_REENTRANT=1'])
-
--env.Append(CXXFLAGS = ['-pipe'])
- env.Append(CXXFLAGS = ['-W'])
- env.Append(CXXFLAGS = ['-Wall'])
- env.Append(CXXFLAGS = ['-ansi'])
-@@ -801,12 +795,6 @@
-
- config_hpp.write('// Options\n')
-
--config_hpp.write('// -- Wide characters support\n')
--if env['with_wide_char_support'] == 'yes':
-- config_hpp.write('#define VMIME_WIDE_CHAR_SUPPORT 1\n')
--else:
-- config_hpp.write('#define VMIME_WIDE_CHAR_SUPPORT 0\n')
--
- config_hpp.write('// -- File-system support\n')
- if env['with_filesystem'] == 'yes':
- config_hpp.write('#define VMIME_HAVE_FILESYSTEM_FEATURES 1\n')
-@@ -1417,8 +1405,8 @@
- AC_MSG_CHECKING([if C++ compiler supports dynamic_cast<> (required)])
- AC_TRY_COMPILE(
- [
-- class foo { virtual ~foo() { } };
-- class bar : public foo { };
-+ class foo { public: virtual ~foo() { } };
-+ class bar : public foo { public: virtual ~bar() { } };
- ],[
- foo *c=0;
- bar *c1=dynamic_cast<bar*>(c);
-@@ -1620,7 +1608,7 @@
-
- if test "x$conf_tls" = "xyes"; then
- # -- GNU TLS Library (http://www.gnu.org/software/gnutls/)
-- AM_PATH_LIBGNUTLS(1.2.0, have_gnutls=yes, have_gnutls=no)
-+ PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0], have_gnutls=yes, have_gnutls=no)
-
- if test "x$have_gnutls" = "xyes"; then
- AM_CONDITIONAL(VMIME_HAVE_TLS_SUPPORT, true)
-@@ -1833,7 +1821,7 @@
-
- """)
-
-- compilerFlags = [ '-pipe', '-ansi', '-pedantic', '-W', '-Wall', '-Wpointer-arith', '-Wold-style-cast', '-Wconversion' ]
-+ compilerFlags = [ '-ansi', '-pedantic', '-W', '-Wall', '-Wpointer-arith', '-Wold-style-cast', '-Wconversion' ]
-
- for f in compilerFlags:
- configure_in.write('# ' + f + '\n')
-@@ -1915,8 +1903,6 @@
- typedef unsigned ${VMIME_TYPE_INT32} vmime_uint32;
-
- // Options
--// -- Wide characters support
--#define VMIME_WIDE_CHAR_SUPPORT 0
- // -- File-system support
- #define VMIME_HAVE_FILESYSTEM_FEATURES 1
- // -- SASL support
-@@ -2260,8 +2246,6 @@
-
-
- // Options
--// -- Wide characters support
--#define VMIME_WIDE_CHAR_SUPPORT 0
- // -- File-system support
- #define VMIME_HAVE_FILESYSTEM_FEATURES 1
- // -- SASL support
-diff -urN a/src/address.cpp b/src/address.cpp
---- a/src/address.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/address.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/examples/viewer/viewer.cpp b/examples/viewer/viewer.cpp
+index 50862b3..ee21f01 100644
+--- a/examples/viewer/viewer.cpp
++++ b/examples/viewer/viewer.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1725,9 +4671,10 @@ diff -urN a/src/address.cpp b/src/address.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/addressList.cpp b/src/addressList.cpp
---- a/src/addressList.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/addressList.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/address.cpp b/src/address.cpp
+index 17220c1..88c39a3 100644
+--- a/src/address.cpp
++++ b/src/address.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1741,9 +4688,10 @@ diff -urN a/src/addressList.cpp b/src/addressList.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp
---- a/src/attachmentHelper.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/attachmentHelper.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/addressList.cpp b/src/addressList.cpp
+index fd7b35c..31a2a3d 100644
+--- a/src/addressList.cpp
++++ b/src/addressList.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1757,9 +4705,10 @@ diff -urN a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/base.cpp b/src/base.cpp
---- a/src/base.cpp 2008-10-12 15:41:25.000000000 +0200
-+++ b/src/base.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp
+index ec6e2f7..65e8c88 100644
+--- a/src/attachmentHelper.cpp
++++ b/src/attachmentHelper.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1773,22 +4722,10 @@ diff -urN a/src/base.cpp b/src/base.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -55,12 +55,6 @@
- */
- const string NULL_STRING;
-
--#if VMIME_WIDE_CHAR_SUPPORT
-- /** "Null" (empty) wide-char string.
-- */
-- const wstring NULL_WSTRING;
--#endif
--
- /** "Null" (empty) text.
- */
- const text NULL_TEXT;
-diff -urN a/src/body.cpp b/src/body.cpp
---- a/src/body.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/body.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/base.cpp b/src/base.cpp
+index 71c63cd..2e47ca3 100644
+--- a/src/base.cpp
++++ b/src/base.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1802,9 +4739,10 @@ diff -urN a/src/body.cpp b/src/body.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/bodyPartAttachment.cpp b/src/bodyPartAttachment.cpp
---- a/src/bodyPartAttachment.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/bodyPartAttachment.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/body.cpp b/src/body.cpp
+index 0e34762..3f5ff0f 100644
+--- a/src/body.cpp
++++ b/src/body.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1818,9 +4756,10 @@ diff -urN a/src/bodyPartAttachment.cpp b/src/bodyPartAttachment.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/bodyPart.cpp b/src/bodyPart.cpp
---- a/src/bodyPart.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/bodyPart.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/bodyPart.cpp b/src/bodyPart.cpp
+index b35346b..20bb102 100644
+--- a/src/bodyPart.cpp
++++ b/src/bodyPart.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1834,9 +4773,10 @@ diff -urN a/src/bodyPart.cpp b/src/bodyPart.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/charsetConverter.cpp b/src/charsetConverter.cpp
---- a/src/charsetConverter.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/charsetConverter.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/bodyPartAttachment.cpp b/src/bodyPartAttachment.cpp
+index b4fb7b1..f3b6b66 100644
+--- a/src/bodyPartAttachment.cpp
++++ b/src/bodyPartAttachment.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1850,64 +4790,10 @@ diff -urN a/src/charsetConverter.cpp b/src/charsetConverter.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -53,6 +53,27 @@
- }
-
-
-+
-+// Output replacement char when an invalid sequence is encountered
-+template <typename OUTPUT_CLASS, typename ICONV_DESC>
-+void outputInvalidChar(OUTPUT_CLASS& out, ICONV_DESC cd)
-+{
-+ const char* invalidCharIn = "?";
-+ size_t invalidCharInLen = 1;
-+
-+ char invalidCharOutBuffer[16];
-+ char* invalidCharOutPtr = invalidCharOutBuffer;
-+ size_t invalidCharOutLen = 16;
-+
-+ if (iconv(cd, ICONV_HACK(&invalidCharIn), &invalidCharInLen,
-+ &invalidCharOutPtr, &invalidCharOutLen) != static_cast <size_t>(-1))
-+ {
-+ out.write(invalidCharOutBuffer, 16 - invalidCharOutLen);
-+ }
-+}
-+
-+
-+
- namespace vmime
- {
-
-@@ -121,7 +142,7 @@
-
- // Output a special character to indicate we don't known how to
- // convert the sequence at this position
-- out.write("?", 1);
-+ outputInvalidChar(out, cd);
-
- // Skip a byte and leave unconverted bytes in the input buffer
- std::copy(const_cast <char*>(inPtr + 1), inBuffer + sizeof(inBuffer), inBuffer);
-@@ -235,7 +256,7 @@
- // character and skip one byte in the invalid sequence.
- if (m_unconvCount >= sizeof(m_unconvBuffer))
- {
-- m_stream.write("?", 1);
-+ outputInvalidChar(m_stream, cd);
-
- std::copy(m_unconvBuffer + 1,
- m_unconvBuffer + m_unconvCount, m_unconvBuffer);
-@@ -358,7 +379,7 @@
- // Skip a "blocking" character
- if (inputConverted == 0)
- {
-- m_stream.write("?", 1);
-+ outputInvalidChar(m_stream, cd);
-
- offset++;
- m_unconvCount--;
-diff -urN a/src/charset.cpp b/src/charset.cpp
---- a/src/charset.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/charset.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/charset.cpp b/src/charset.cpp
+index 798d34f..e3c11da 100644
+--- a/src/charset.cpp
++++ b/src/charset.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1921,9 +4807,10 @@ diff -urN a/src/charset.cpp b/src/charset.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/component.cpp b/src/component.cpp
---- a/src/component.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/component.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/charsetConverter.cpp b/src/charsetConverter.cpp
+index 26609db..ec74ae5 100644
+--- a/src/charsetConverter.cpp
++++ b/src/charsetConverter.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1937,9 +4824,10 @@ diff -urN a/src/component.cpp b/src/component.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/constants.cpp b/src/constants.cpp
---- a/src/constants.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/constants.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/component.cpp b/src/component.cpp
+index 69a6049..fbf677b 100644
+--- a/src/component.cpp
++++ b/src/component.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1953,9 +4841,10 @@ diff -urN a/src/constants.cpp b/src/constants.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/contentDisposition.cpp b/src/contentDisposition.cpp
---- a/src/contentDisposition.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/contentDisposition.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/constants.cpp b/src/constants.cpp
+index ba6f194..b3f51a2 100644
+--- a/src/constants.cpp
++++ b/src/constants.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1969,9 +4858,10 @@ diff -urN a/src/contentDisposition.cpp b/src/contentDisposition.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/contentDispositionField.cpp b/src/contentDispositionField.cpp
---- a/src/contentDispositionField.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/contentDispositionField.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/contentDisposition.cpp b/src/contentDisposition.cpp
+index 7ffa424..0ab7c45 100644
+--- a/src/contentDisposition.cpp
++++ b/src/contentDisposition.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -1985,9 +4875,10 @@ diff -urN a/src/contentDispositionField.cpp b/src/contentDispositionField.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/contentHandler.cpp b/src/contentHandler.cpp
---- a/src/contentHandler.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/contentHandler.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/contentDispositionField.cpp b/src/contentDispositionField.cpp
+index 0630a51..355e820 100644
+--- a/src/contentDispositionField.cpp
++++ b/src/contentDispositionField.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2001,9 +4892,10 @@ diff -urN a/src/contentHandler.cpp b/src/contentHandler.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/contentTypeField.cpp b/src/contentTypeField.cpp
---- a/src/contentTypeField.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/contentTypeField.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/contentHandler.cpp b/src/contentHandler.cpp
+index 5d50283..6022411 100644
+--- a/src/contentHandler.cpp
++++ b/src/contentHandler.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2017,9 +4909,10 @@ diff -urN a/src/contentTypeField.cpp b/src/contentTypeField.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/dateTime.cpp b/src/dateTime.cpp
---- a/src/dateTime.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/dateTime.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/contentTypeField.cpp b/src/contentTypeField.cpp
+index 7b5a3e2..406a06e 100644
+--- a/src/contentTypeField.cpp
++++ b/src/contentTypeField.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2033,27 +4926,10 @@ diff -urN a/src/dateTime.cpp b/src/dateTime.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -427,7 +427,7 @@
- zone[zoneLength++] = *p;
- ++p;
- }
-- while (zoneLength < 3 && p < pend && parserHelpers::isDigit(*p));
-+ while (zoneLength < 3 && p < pend);
-
- switch (zone[0])
- {
-@@ -491,6 +491,8 @@
-
- break;
- }
-+ case 'g':
-+ case 'G':
- case 'u':
- case 'U':
- {
-diff -urN a/src/defaultAttachment.cpp b/src/defaultAttachment.cpp
---- a/src/defaultAttachment.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/defaultAttachment.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/dateTime.cpp b/src/dateTime.cpp
+index 66cd992..089a900 100644
+--- a/src/dateTime.cpp
++++ b/src/dateTime.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2067,9 +4943,10 @@ diff -urN a/src/defaultAttachment.cpp b/src/defaultAttachment.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/disposition.cpp b/src/disposition.cpp
---- a/src/disposition.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/disposition.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/defaultAttachment.cpp b/src/defaultAttachment.cpp
+index c2ad61e..b61d52e 100644
+--- a/src/defaultAttachment.cpp
++++ b/src/defaultAttachment.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2083,9 +4960,10 @@ diff -urN a/src/disposition.cpp b/src/disposition.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
---- a/src/emptyContentHandler.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/emptyContentHandler.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/disposition.cpp b/src/disposition.cpp
+index 1b420fb..b8059a7 100644
+--- a/src/disposition.cpp
++++ b/src/disposition.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2099,9 +4977,10 @@ diff -urN a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/encoding.cpp b/src/encoding.cpp
---- a/src/encoding.cpp 2008-10-12 15:41:52.000000000 +0200
-+++ b/src/encoding.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
+index bbee986..5245341 100644
+--- a/src/emptyContentHandler.cpp
++++ b/src/emptyContentHandler.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2115,9 +4994,10 @@ diff -urN a/src/encoding.cpp b/src/encoding.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/exception.cpp b/src/exception.cpp
---- a/src/exception.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/exception.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/encoding.cpp b/src/encoding.cpp
+index a45573d..58ce71d 100644
+--- a/src/encoding.cpp
++++ b/src/encoding.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2131,9 +5011,10 @@ diff -urN a/src/exception.cpp b/src/exception.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/fileAttachment.cpp b/src/fileAttachment.cpp
---- a/src/fileAttachment.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/fileAttachment.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/exception.cpp b/src/exception.cpp
+index 54be174..60ec95b 100644
+--- a/src/exception.cpp
++++ b/src/exception.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2147,148 +5028,10 @@ diff -urN a/src/fileAttachment.cpp b/src/fileAttachment.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -31,48 +31,93 @@
-
- #include "vmime/contentDispositionField.hpp"
-
-+#include "vmime/platform.hpp"
-+#include "vmime/utility/file.hpp"
-+
-
- namespace vmime
- {
-
-
--fileAttachment::fileAttachment(const string& filename, const mediaType& type)
-+fileAttachment::fileAttachment(const string& filepath, const mediaType& type)
- {
- m_type = type;
-
-- setData(filename);
-+ setData(filepath);
-
- m_encoding = encoding::decide(m_data);
- }
-
-
--fileAttachment::fileAttachment(const string& filename, const mediaType& type, const text& desc)
-+fileAttachment::fileAttachment(const string& filepath, const mediaType& type, const text& desc)
- {
- m_type = type;
- m_desc = desc;
-
-- setData(filename);
-+ setData(filepath);
-
- m_encoding = encoding::decide(m_data);
- }
-
-
--fileAttachment::fileAttachment(const string& filename, const mediaType& type,
-+fileAttachment::fileAttachment(const string& filepath, const mediaType& type,
- const text& desc, const encoding& enc)
- {
- m_type = type;
- m_desc = desc;
-
-- setData(filename);
-+ setData(filepath);
-+
-+ m_encoding = enc;
-+}
-+
-+
-+fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type)
-+{
-+ if (!filename.isEmpty())
-+ m_fileInfo.setFilename(filename);
-+
-+ m_type = type;
-+
-+ setData(is);
-+
-+ m_encoding = encoding::decide(m_data);
-+}
-+
-+
-+fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename,
-+ const mediaType& type, const text& desc)
-+{
-+ if (!filename.isEmpty())
-+ m_fileInfo.setFilename(filename);
-+
-+ m_type = type;
-+ m_desc = desc;
-+
-+ setData(is);
-+
-+ m_encoding = encoding::decide(m_data);
-+}
-+
-+
-+fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename,
-+ const mediaType& type, const text& desc, const encoding& enc)
-+{
-+ if (!filename.isEmpty())
-+ m_fileInfo.setFilename(filename);
-
-+ m_type = type;
-+ m_desc = desc;
- m_encoding = enc;
-+
-+ setData(is);
- }
-
-
--void fileAttachment::setData(const string& filename)
-+void fileAttachment::setData(const string& filepath)
- {
- std::ifstream* file = new std::ifstream();
-- file->open(filename.c_str(), std::ios::in | std::ios::binary);
-+ file->open(filepath.c_str(), std::ios::in | std::ios::binary);
-
- if (!*file)
- {
-@@ -82,6 +127,15 @@
-
- ref <utility::inputStream> is = vmime::create <utility::inputStreamPointerAdapter>(file, true);
-
-+ setData(is);
-+
-+ utility::file::path path = platform::getHandler()->getFileSystemFactory()->stringToPath(filepath);
-+ m_fileInfo.setFilename(path.getLastComponent());
-+}
-+
-+
-+void fileAttachment::setData(ref <utility::inputStream> is)
-+{
- m_data = vmime::create <streamContentHandler>(is, 0);
- }
-
-@@ -94,7 +148,7 @@
- dynamicCast <contentDispositionField>();
-
- if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize()));
-- if (m_fileInfo.hasFilename()) cdf->setFilename(m_fileInfo.getFilename());
-+ if (m_fileInfo.hasFilename() && !m_fileInfo.getFilename().isEmpty()) cdf->setFilename(m_fileInfo.getFilename());
- if (m_fileInfo.hasCreationDate()) cdf->setCreationDate(m_fileInfo.getCreationDate());
- if (m_fileInfo.hasModificationDate()) cdf->setModificationDate(m_fileInfo.getModificationDate());
- if (m_fileInfo.hasReadDate()) cdf->setReadDate(m_fileInfo.getReadDate());
-@@ -134,8 +188,9 @@
- }
-
- bool fileAttachment::fileInfo::hasFilename() const { return (m_filename != NULL); }
--const string& fileAttachment::fileInfo::getFilename() const { return (*m_filename); }
--void fileAttachment::fileInfo::setFilename(const string& name) { if (m_filename) { *m_filename = name; } else { m_filename = new string(name); } }
-+const word& fileAttachment::fileInfo::getFilename() const { return (*m_filename); }
-+void fileAttachment::fileInfo::setFilename(const string& name) { if (m_filename) { *m_filename = name; } else { m_filename = new word(name); } }
-+void fileAttachment::fileInfo::setFilename(const word& name) { if (m_filename) { *m_filename = name; } else { m_filename = new word(name); } }
-
- bool fileAttachment::fileInfo::hasCreationDate() const { return (m_creationDate != NULL); }
- const datetime& fileAttachment::fileInfo::getCreationDate() const { return (*m_creationDate); }
-diff -urN a/src/generatedMessageAttachment.cpp b/src/generatedMessageAttachment.cpp
---- a/src/generatedMessageAttachment.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/generatedMessageAttachment.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp
+index 20b8083..e643491 100644
+--- a/src/fileAttachment.cpp
++++ b/src/fileAttachment.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2302,9 +5045,10 @@ diff -urN a/src/generatedMessageAttachment.cpp b/src/generatedMessageAttachment.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/header.cpp b/src/header.cpp
---- a/src/header.cpp 2008-10-12 11:02:22.000000000 +0200
-+++ b/src/header.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/generatedMessageAttachment.cpp b/src/generatedMessageAttachment.cpp
+index 205b549..e9bd1a6 100644
+--- a/src/generatedMessageAttachment.cpp
++++ b/src/generatedMessageAttachment.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2318,9 +5062,10 @@ diff -urN a/src/header.cpp b/src/header.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/headerField.cpp b/src/headerField.cpp
---- a/src/headerField.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/headerField.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/header.cpp b/src/header.cpp
+index 78424b3..443aab8 100644
+--- a/src/header.cpp
++++ b/src/header.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2334,9 +5079,10 @@ diff -urN a/src/headerField.cpp b/src/headerField.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/headerFieldFactory.cpp b/src/headerFieldFactory.cpp
---- a/src/headerFieldFactory.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/headerFieldFactory.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/headerField.cpp b/src/headerField.cpp
+index 0057712..52fe7e8 100644
+--- a/src/headerField.cpp
++++ b/src/headerField.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2350,9 +5096,10 @@ diff -urN a/src/headerFieldFactory.cpp b/src/headerFieldFactory.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
---- a/src/htmlTextPart.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/htmlTextPart.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/headerFieldFactory.cpp b/src/headerFieldFactory.cpp
+index 6d949f0..807a2b3 100644
+--- a/src/headerFieldFactory.cpp
++++ b/src/headerFieldFactory.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2366,9 +5113,10 @@ diff -urN a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mailbox.cpp b/src/mailbox.cpp
---- a/src/mailbox.cpp 2008-10-12 11:03:13.000000000 +0200
-+++ b/src/mailbox.cpp 2010-02-10 10:56:54.000000000 +0100
+diff --git a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
+index a287573..7713034 100644
+--- a/src/htmlTextPart.cpp
++++ b/src/htmlTextPart.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2382,37 +5130,10 @@ diff -urN a/src/mailbox.cpp b/src/mailbox.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -369,7 +369,7 @@
- // We have to encode the name:
- // - if it contains characters in a charset different from "US-ASCII",
- // - and/or if it contains one or more of these special chars:
-- // SPACE TAB " ; , < > ( ) @ / ? . = :
-+ // CR LF TAB " ; , < > ( ) @ / ? . = :
-
- // Check whether there are words that are not "US-ASCII"
- // and/or contain the special chars.
-@@ -386,7 +386,8 @@
- {
- switch (*c)
- {
-- case ' ':
-+ case '\r':
-+ case '\n':
- case '\t':
- case ';':
- case ',':
-@@ -415,7 +416,7 @@
- bool newLine = true;
-
- m_name.encodeAndFold(os, maxLineLength, pos, &pos,
-- forceEncode ? text::FORCE_ENCODING : 0);
-+ text::QUOTE_IF_POSSIBLE | (forceEncode ? text::FORCE_ENCODING : 0));
-
- if (pos + m_email.length() + 3 > maxLineLength)
- {
-diff -urN a/src/mailboxField.cpp b/src/mailboxField.cpp
---- a/src/mailboxField.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mailboxField.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mailbox.cpp b/src/mailbox.cpp
+index b1ed7a2..2f62521 100644
+--- a/src/mailbox.cpp
++++ b/src/mailbox.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2426,9 +5147,10 @@ diff -urN a/src/mailboxField.cpp b/src/mailboxField.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
---- a/src/mailboxGroup.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mailboxGroup.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mailboxField.cpp b/src/mailboxField.cpp
+index 0fc5773..0d9bd83 100644
+--- a/src/mailboxField.cpp
++++ b/src/mailboxField.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2442,9 +5164,10 @@ diff -urN a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mailboxList.cpp b/src/mailboxList.cpp
---- a/src/mailboxList.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mailboxList.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
+index ac7202c..94f7ba6 100644
+--- a/src/mailboxGroup.cpp
++++ b/src/mailboxGroup.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2458,9 +5181,10 @@ diff -urN a/src/mailboxList.cpp b/src/mailboxList.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mdn/MDNHelper.cpp b/src/mdn/MDNHelper.cpp
---- a/src/mdn/MDNHelper.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mdn/MDNHelper.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mailboxList.cpp b/src/mailboxList.cpp
+index e9fe7f9..0023d9d 100644
+--- a/src/mailboxList.cpp
++++ b/src/mailboxList.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2474,9 +5198,10 @@ diff -urN a/src/mdn/MDNHelper.cpp b/src/mdn/MDNHelper.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mdn/MDNInfos.cpp b/src/mdn/MDNInfos.cpp
---- a/src/mdn/MDNInfos.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mdn/MDNInfos.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mdn/MDNHelper.cpp b/src/mdn/MDNHelper.cpp
+index a4a4ee4..b419b85 100644
+--- a/src/mdn/MDNHelper.cpp
++++ b/src/mdn/MDNHelper.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2490,9 +5215,10 @@ diff -urN a/src/mdn/MDNInfos.cpp b/src/mdn/MDNInfos.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mdn/receivedMDNInfos.cpp b/src/mdn/receivedMDNInfos.cpp
---- a/src/mdn/receivedMDNInfos.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mdn/receivedMDNInfos.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mdn/MDNInfos.cpp b/src/mdn/MDNInfos.cpp
+index 82d580d..cd8e38f 100644
+--- a/src/mdn/MDNInfos.cpp
++++ b/src/mdn/MDNInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2506,9 +5232,10 @@ diff -urN a/src/mdn/receivedMDNInfos.cpp b/src/mdn/receivedMDNInfos.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mdn/sendableMDNInfos.cpp b/src/mdn/sendableMDNInfos.cpp
---- a/src/mdn/sendableMDNInfos.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mdn/sendableMDNInfos.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mdn/receivedMDNInfos.cpp b/src/mdn/receivedMDNInfos.cpp
+index 366d46f..cff211c 100644
+--- a/src/mdn/receivedMDNInfos.cpp
++++ b/src/mdn/receivedMDNInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2522,9 +5249,10 @@ diff -urN a/src/mdn/sendableMDNInfos.cpp b/src/mdn/sendableMDNInfos.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/mediaType.cpp b/src/mediaType.cpp
---- a/src/mediaType.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/mediaType.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mdn/sendableMDNInfos.cpp b/src/mdn/sendableMDNInfos.cpp
+index 953e492..d274ae0 100644
+--- a/src/mdn/sendableMDNInfos.cpp
++++ b/src/mdn/sendableMDNInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2538,9 +5266,10 @@ diff -urN a/src/mediaType.cpp b/src/mediaType.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/messageBuilder.cpp b/src/messageBuilder.cpp
---- a/src/messageBuilder.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/messageBuilder.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/mediaType.cpp b/src/mediaType.cpp
+index 569ccc3..725f933 100644
+--- a/src/mediaType.cpp
++++ b/src/mediaType.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2554,48 +5283,10 @@ diff -urN a/src/messageBuilder.cpp b/src/messageBuilder.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -54,11 +54,17 @@
- if (m_from.isEmpty())
- throw exceptions::no_expeditor();
-
-- if (m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty())
-+ if ((m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty()) &&
-+ (m_cc.isEmpty() || m_cc.getAddressAt(0)->isEmpty()) &&
-+ (m_bcc.isEmpty() || m_bcc.getAddressAt(0)->isEmpty()))
-+ {
- throw exceptions::no_recipient();
-+ }
-
- msg->getHeader()->From()->setValue(m_from);
-- msg->getHeader()->To()->setValue(m_to);
-+
-+ if (!m_to.isEmpty())
-+ msg->getHeader()->To()->setValue(m_to);
-
- if (!m_cc.isEmpty())
- msg->getHeader()->Cc()->setValue(m_cc);
-@@ -142,6 +148,9 @@
- {
- const bodyPart& part = *msg->getBody()->getPartAt(0);
-
-+ // Make a full copy of the body, otherwise the copyFrom() will delete the body we're copying
-+ ref <body> bodyCopy = part.getBody()->clone().dynamicCast <body>();
-+
- // First, copy (and replace) the header fields
- const std::vector <ref <const headerField> > fields = part.getHeader()->getFieldList();
-
-@@ -153,7 +162,7 @@
-
- // Second, copy the body contents and sub-parts (this also remove
- // the body part we are copying...)
-- msg->getBody()->copyFrom(*part.getBody());
-+ msg->getBody()->copyFrom(*bodyCopy);
- }
-
- return (msg);
-diff -urN a/src/message.cpp b/src/message.cpp
---- a/src/message.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/message.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/message.cpp b/src/message.cpp
+index 04d1287..6f4b046 100644
+--- a/src/message.cpp
++++ b/src/message.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2609,9 +5300,10 @@ diff -urN a/src/message.cpp b/src/message.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/messageId.cpp b/src/messageId.cpp
---- a/src/messageId.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/messageId.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/messageBuilder.cpp b/src/messageBuilder.cpp
+index cef4f73..d619554 100644
+--- a/src/messageBuilder.cpp
++++ b/src/messageBuilder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2625,9 +5317,10 @@ diff -urN a/src/messageId.cpp b/src/messageId.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/messageIdSequence.cpp b/src/messageIdSequence.cpp
---- a/src/messageIdSequence.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/messageIdSequence.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/messageId.cpp b/src/messageId.cpp
+index 08a8e37..961fb63 100644
+--- a/src/messageId.cpp
++++ b/src/messageId.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2641,9 +5334,10 @@ diff -urN a/src/messageIdSequence.cpp b/src/messageIdSequence.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/messageParser.cpp b/src/messageParser.cpp
---- a/src/messageParser.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/messageParser.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/messageIdSequence.cpp b/src/messageIdSequence.cpp
+index 6011358..08103d0 100644
+--- a/src/messageIdSequence.cpp
++++ b/src/messageIdSequence.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2657,9 +5351,10 @@ diff -urN a/src/messageParser.cpp b/src/messageParser.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/misc/importanceHelper.cpp b/src/misc/importanceHelper.cpp
---- a/src/misc/importanceHelper.cpp 2008-10-12 11:12:02.000000000 +0200
-+++ b/src/misc/importanceHelper.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/messageParser.cpp b/src/messageParser.cpp
+index 639ac5f..35e0bba 100644
+--- a/src/messageParser.cpp
++++ b/src/messageParser.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2673,9 +5368,10 @@ diff -urN a/src/misc/importanceHelper.cpp b/src/misc/importanceHelper.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/builtinServices.inl b/src/net/builtinServices.inl
---- a/src/net/builtinServices.inl 2008-01-05 18:49:19.000000000 +0100
-+++ b/src/net/builtinServices.inl 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/misc/importanceHelper.cpp b/src/misc/importanceHelper.cpp
+index 763753c..22d0cdf 100644
+--- a/src/misc/importanceHelper.cpp
++++ b/src/misc/importanceHelper.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2689,9 +5385,10 @@ diff -urN a/src/net/builtinServices.inl b/src/net/builtinServices.inl
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/defaultConnectionInfos.cpp b/src/net/defaultConnectionInfos.cpp
---- a/src/net/defaultConnectionInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/defaultConnectionInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/builtinServices.inl b/src/net/builtinServices.inl
+index e74766e..4a6ac87 100644
+--- a/src/net/builtinServices.inl
++++ b/src/net/builtinServices.inl
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2705,9 +5402,10 @@ diff -urN a/src/net/defaultConnectionInfos.cpp b/src/net/defaultConnectionInfos.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/events.cpp b/src/net/events.cpp
---- a/src/net/events.cpp 2008-10-12 11:25:21.000000000 +0200
-+++ b/src/net/events.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/defaultConnectionInfos.cpp b/src/net/defaultConnectionInfos.cpp
+index ee706a3..41f1e0f 100644
+--- a/src/net/defaultConnectionInfos.cpp
++++ b/src/net/defaultConnectionInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2721,9 +5419,10 @@ diff -urN a/src/net/events.cpp b/src/net/events.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/folder.cpp b/src/net/folder.cpp
---- a/src/net/folder.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/folder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/events.cpp b/src/net/events.cpp
+index a6674a7..52c13ee 100644
+--- a/src/net/events.cpp
++++ b/src/net/events.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2737,9 +5436,10 @@ diff -urN a/src/net/folder.cpp b/src/net/folder.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
---- a/src/net/imap/IMAPConnection.cpp 2008-10-12 11:28:37.000000000 +0200
-+++ b/src/net/imap/IMAPConnection.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/folder.cpp b/src/net/folder.cpp
+index 20291be..47ec317 100644
+--- a/src/net/folder.cpp
++++ b/src/net/folder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2753,22 +5453,10 @@ diff -urN a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -718,6 +718,12 @@
- }
-
-
-+ref <const socket> IMAPConnection::getSocket() const
-+{
-+ return m_socket;
-+}
-+
-+
- } // imap
- } // net
- } // vmime
-diff -urN a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
---- a/src/net/imap/IMAPFolder.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/imap/IMAPFolder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
+index 7c78b78..c3ee574 100644
+--- a/src/net/imap/IMAPConnection.cpp
++++ b/src/net/imap/IMAPConnection.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2782,22 +5470,10 @@ diff -urN a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -1284,7 +1284,11 @@
- if (progress)
- progress->start(total);
-
-- char buffer[65536];
-+ const socket::size_type blockSize = std::min(is.getBlockSize(),
-+ static_cast <size_t>(m_connection->getSocket()->getBlockSize()));
-+
-+ std::vector <char> vbuffer(blockSize);
-+ char* buffer = &vbuffer.front();
-
- while (!is.eof())
- {
-diff -urN a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
---- a/src/net/imap/IMAPMessage.cpp 2008-10-12 11:33:02.000000000 +0200
-+++ b/src/net/imap/IMAPMessage.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
+index 2130211..c06a8d4 100644
+--- a/src/net/imap/IMAPFolder.cpp
++++ b/src/net/imap/IMAPFolder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2811,9 +5487,10 @@ diff -urN a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/imap/IMAPServiceInfos.cpp b/src/net/imap/IMAPServiceInfos.cpp
---- a/src/net/imap/IMAPServiceInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/imap/IMAPServiceInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
+index 90bebf3..29c2aea 100644
+--- a/src/net/imap/IMAPMessage.cpp
++++ b/src/net/imap/IMAPMessage.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2827,9 +5504,10 @@ diff -urN a/src/net/imap/IMAPServiceInfos.cpp b/src/net/imap/IMAPServiceInfos.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/imap/IMAPSStore.cpp b/src/net/imap/IMAPSStore.cpp
---- a/src/net/imap/IMAPSStore.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/imap/IMAPSStore.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPSStore.cpp b/src/net/imap/IMAPSStore.cpp
+index 0b4b90b..9e92f92 100644
+--- a/src/net/imap/IMAPSStore.cpp
++++ b/src/net/imap/IMAPSStore.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2843,9 +5521,10 @@ diff -urN a/src/net/imap/IMAPSStore.cpp b/src/net/imap/IMAPSStore.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/imap/IMAPStore.cpp b/src/net/imap/IMAPStore.cpp
---- a/src/net/imap/IMAPStore.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/imap/IMAPStore.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPServiceInfos.cpp b/src/net/imap/IMAPServiceInfos.cpp
+index 1604411..33898f4 100644
+--- a/src/net/imap/IMAPServiceInfos.cpp
++++ b/src/net/imap/IMAPServiceInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2859,9 +5538,10 @@ diff -urN a/src/net/imap/IMAPStore.cpp b/src/net/imap/IMAPStore.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/imap/IMAPTag.cpp b/src/net/imap/IMAPTag.cpp
---- a/src/net/imap/IMAPTag.cpp 2008-10-12 11:35:01.000000000 +0200
-+++ b/src/net/imap/IMAPTag.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPStore.cpp b/src/net/imap/IMAPStore.cpp
+index 753adc6..f260e55 100644
+--- a/src/net/imap/IMAPStore.cpp
++++ b/src/net/imap/IMAPStore.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2875,9 +5555,10 @@ diff -urN a/src/net/imap/IMAPTag.cpp b/src/net/imap/IMAPTag.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp
---- a/src/net/imap/IMAPUtils.cpp 2008-10-12 11:34:27.000000000 +0200
-+++ b/src/net/imap/IMAPUtils.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPTag.cpp b/src/net/imap/IMAPTag.cpp
+index 7b8ce3f..abb7924 100644
+--- a/src/net/imap/IMAPTag.cpp
++++ b/src/net/imap/IMAPTag.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2891,9 +5572,10 @@ diff -urN a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp
---- a/src/net/maildir/format/courierMaildirFormat.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/format/courierMaildirFormat.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp
+index 18ca00c..c4651ed 100644
+--- a/src/net/imap/IMAPUtils.cpp
++++ b/src/net/imap/IMAPUtils.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2907,63 +5589,10 @@ diff -urN a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/fo
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -49,7 +49,7 @@
-
- void courierMaildirFormat::createFolder(const folder::path& path)
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY)))
- throw exceptions::invalid_folder_name();
-@@ -80,7 +80,7 @@
-
- void courierMaildirFormat::destroyFolder(const folder::path& path)
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- // Recursively delete directories of subfolders
- const std::vector <folder::path> folders = listFolders(path, true);
-@@ -119,7 +119,7 @@
- void courierMaildirFormat::renameFolderImpl
- (const folder::path& oldPath, const folder::path& newPath)
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- const utility::file::path oldFSPath =
- folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY);
-@@ -134,7 +134,7 @@
-
- bool courierMaildirFormat::folderExists(const folder::path& path) const
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create
- (folderPathToFileSystemPath(path, ROOT_DIRECTORY));
-@@ -254,7 +254,7 @@
- bool courierMaildirFormat::listDirectories(const folder::path& root,
- std::vector <string>& dirs, const bool onlyTestForExistence) const
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create
- (getContext()->getStore()->getFileSystemPath());
-@@ -496,7 +496,7 @@
-
- bool courierMaildirFormat::supports() const
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create
- (getContext()->getStore()->getFileSystemPath());
-diff -urN a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp
---- a/src/net/maildir/format/kmailMaildirFormat.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/format/kmailMaildirFormat.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp
+index 1118c27..6dbda80 100644
+--- a/src/net/maildir/format/courierMaildirFormat.cpp
++++ b/src/net/maildir/format/courierMaildirFormat.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -2977,63 +5606,10 @@ diff -urN a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/form
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -49,7 +49,7 @@
-
- void kmailMaildirFormat::createFolder(const folder::path& path)
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY)))
- throw exceptions::invalid_folder_name();
-@@ -75,7 +75,7 @@
- void kmailMaildirFormat::destroyFolder(const folder::path& path)
- {
- // Delete 'folder' and '.folder.directory' directories
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- maildirUtils::recursiveFSDelete(fsf->create
- (folderPathToFileSystemPath(path, ROOT_DIRECTORY))); // root
-@@ -87,7 +87,7 @@
-
- bool kmailMaildirFormat::folderExists(const folder::path& path) const
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create
- (folderPathToFileSystemPath(path, ROOT_DIRECTORY));
-@@ -177,7 +177,7 @@
- void kmailMaildirFormat::listFoldersImpl
- (std::vector <folder::path>& list, const folder::path& root, const bool recursive) const
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create(folderPathToFileSystemPath(root,
- root.isEmpty() ? ROOT_DIRECTORY : CONTAINER_DIRECTORY));
-@@ -226,7 +226,7 @@
-
- void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder::path& newPath)
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create
- (folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY));
-@@ -277,7 +277,7 @@
-
- bool kmailMaildirFormat::folderHasSubfolders(const folder::path& path) const
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> rootDir = fsf->create
- (folderPathToFileSystemPath(path, CONTAINER_DIRECTORY));
-diff -urN a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
---- a/src/net/maildir/maildirFolder.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/maildirFolder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp
+index eeedd41..5fb75fe 100644
+--- a/src/net/maildir/format/kmailMaildirFormat.cpp
++++ b/src/net/maildir/format/kmailMaildirFormat.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3047,126 +5623,10 @@ diff -urN a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -264,7 +264,7 @@
- m_messageCount = 0;
- m_unreadMessageCount = 0;
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- utility::file::path newDirPath = store->getFormat()->folderPathToFileSystemPath
- (m_path, maildirFormat::NEW_DIRECTORY);
-@@ -760,7 +760,7 @@
- {
- ref <maildirStore> store = m_store.acquire();
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- utility::file::path curDirPath = store->getFormat()->
- folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
-@@ -832,12 +832,15 @@
- else if (m_mode == MODE_READ_ONLY)
- throw exceptions::illegal_state("Folder is read-only");
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- utility::file::path tmpDirPath = store->getFormat()->
-- folderPathToFileSystemPath(m_path, maildirFormat::TMP_DIRECTORY);
-- utility::file::path curDirPath = store->getFormat()->
-- folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
-+ folderPathToFileSystemPath(m_path,maildirFormat::TMP_DIRECTORY);
-+ utility::file::path dstDirPath = store->getFormat()->
-+ folderPathToFileSystemPath(m_path,
-+ flags == message::FLAG_RECENT ?
-+ maildirFormat::NEW_DIRECTORY :
-+ maildirFormat::CUR_DIRECTORY);
-
- const utility::file::path::component filename =
- maildirUtils::buildFilename(maildirUtils::generateId(),
-@@ -855,7 +858,7 @@
-
- try
- {
-- ref <utility::file> curDir = fsf->create(curDirPath);
-+ ref <utility::file> curDir = fsf->create(dstDirPath);
- curDir->createDirectory(true);
- }
- catch (exceptions::filesystem_exception&)
-@@ -864,7 +867,7 @@
- }
-
- // Actually add the message
-- copyMessageImpl(tmpDirPath, curDirPath, filename, is, size, progress);
-+ copyMessageImpl(tmpDirPath, dstDirPath, filename, is, size, progress);
-
- // Append the message to the cache list
- messageInfos msgInfos;
-@@ -910,11 +913,12 @@
-
-
- void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
-- const utility::file::path& curDirPath, const utility::file::path::component& filename,
-+ const utility::file::path& dstDirPath,
-+ const utility::file::path::component& filename,
- utility::inputStream& is, const utility::stream::size_type size,
- utility::progressListener* progress)
- {
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- ref <utility::file> file = fsf->create(tmpDirPath / filename);
-
-@@ -945,6 +949,8 @@
- if (progress)
- progress->progress(total, size);
- }
-+
-+ os->flush();
- }
- catch (exception& e)
- {
-@@ -968,7 +974,7 @@
- // ...then, move it to 'cur'
- try
- {
-- file->rename(curDirPath / filename);
-+ file->rename(dstDirPath / filename);
- }
- catch (exception& e)
- {
-@@ -978,7 +984,8 @@
- // Delete temporary file
- try
- {
-- ref <utility::file> file = fsf->create(tmpDirPath / filename);
-+ file->remove();
-+ ref <utility::file> file = fsf->create(dstDirPath / filename);
- file->remove();
- }
- catch (exceptions::filesystem_exception&)
-@@ -1051,7 +1058,7 @@
- {
- ref <maildirStore> store = m_store.acquire();
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- utility::file::path curDirPath = store->getFormat()->folderPathToFileSystemPath
- (m_path, maildirFormat::CUR_DIRECTORY);
-@@ -1193,7 +1200,7 @@
- else if (m_mode == MODE_READ_ONLY)
- throw exceptions::illegal_state("Folder is read-only");
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- utility::file::path curDirPath = store->getFormat()->
- folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
-diff -urN a/src/net/maildir/maildirFormat.cpp b/src/net/maildir/maildirFormat.cpp
---- a/src/net/maildir/maildirFormat.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/maildirFormat.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
+index 65abdcf..3e361ae 100644
+--- a/src/net/maildir/maildirFolder.cpp
++++ b/src/net/maildir/maildirFolder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3180,18 +5640,10 @@ diff -urN a/src/net/maildir/maildirFormat.cpp b/src/net/maildir/maildirFormat.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -52,7 +52,7 @@
-
- ref <maildirStore> maildirFormat::context::getStore() const
- {
-- return m_store;
-+ return m_store.acquire().constCast <maildirStore>();
- }
-
-
-diff -urN a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
---- a/src/net/maildir/maildirMessage.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/maildirMessage.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/maildirFormat.cpp b/src/net/maildir/maildirFormat.cpp
+index 17899a2..607ed61 100644
+--- a/src/net/maildir/maildirFormat.cpp
++++ b/src/net/maildir/maildirFormat.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3205,36 +5657,10 @@ diff -urN a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -346,7 +346,7 @@
- {
- ref <const maildirFolder> folder = m_folder.acquire();
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- const utility::file::path path = folder->getMessageFSPath(m_num);
- ref <utility::file> file = fsf->create(path);
-@@ -393,7 +393,7 @@
-
- ref <maildirPart> mp = p.dynamicCast <maildirPart>();
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- const utility::file::path path = folder->getMessageFSPath(m_num);
- ref <utility::file> file = fsf->create(path);
-@@ -430,7 +430,7 @@
- if (folder != msgFolder)
- throw exceptions::folder_not_found();
-
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- const utility::file::path path = folder->getMessageFSPath(m_num);
- ref <utility::file> file = fsf->create(path);
-diff -urN a/src/net/maildir/maildirServiceInfos.cpp b/src/net/maildir/maildirServiceInfos.cpp
---- a/src/net/maildir/maildirServiceInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/maildirServiceInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
+index 1ae83ee..ed87cdb 100644
+--- a/src/net/maildir/maildirMessage.cpp
++++ b/src/net/maildir/maildirMessage.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3248,9 +5674,10 @@ diff -urN a/src/net/maildir/maildirServiceInfos.cpp b/src/net/maildir/maildirSer
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp
---- a/src/net/maildir/maildirStore.cpp 2008-10-12 11:36:52.000000000 +0200
-+++ b/src/net/maildir/maildirStore.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/maildirServiceInfos.cpp b/src/net/maildir/maildirServiceInfos.cpp
+index 48869dc..55ba64e 100644
+--- a/src/net/maildir/maildirServiceInfos.cpp
++++ b/src/net/maildir/maildirServiceInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3264,18 +5691,10 @@ diff -urN a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -132,7 +132,7 @@
- throw exceptions::already_connected();
-
- // Get root directory
-- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
-+ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
-
- m_fsPath = fsf->stringToPath(GET_PROPERTY(string, PROPERTY_SERVER_ROOTPATH));
-
-diff -urN a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
---- a/src/net/maildir/maildirUtils.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/maildir/maildirUtils.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp
+index 8e4e002..3b77024 100644
+--- a/src/net/maildir/maildirStore.cpp
++++ b/src/net/maildir/maildirStore.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3289,55 +5708,10 @@ diff -urN a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -25,6 +25,7 @@
- #include "vmime/net/maildir/maildirStore.hpp"
-
- #include "vmime/utility/random.hpp"
-+#include "vmime/platform.hpp"
-
- #include "vmime/exception.hpp"
-
-@@ -128,18 +129,24 @@
- const utility::file::path::component maildirUtils::buildFilename
- (const utility::file::path::component& id, const int flags)
- {
-- return (buildFilename(id, buildFlags(flags)));
-+ if (flags == message::FLAG_RECENT)
-+ return id;
-+ else
-+ return (buildFilename(id, buildFlags(flags)));
- }
-
-
- const utility::file::path::component maildirUtils::buildFilename
-- (const utility::file::path::component& id, const utility::file::path::component& flags)
-+ (const utility::file::path::component& id,
-+ const utility::file::path::component& flags)
- {
- #if VMIME_BUILTIN_PLATFORM_WINDOWS
-- return (utility::path::component(id.getBuffer() + "-" + flags.getBuffer())); // use dash
-+ static const char DELIMITER[] = "-";
- #else
-- return (utility::path::component(id.getBuffer() + ":" + flags.getBuffer())); // use colon
-+ static const char DELIMITER[] = ":";
- #endif
-+
-+ return utility::path::component(id.getBuffer() + DELIMITER + flags.getBuffer());
- }
-
-
-@@ -153,6 +160,8 @@
- oss << utility::random::getProcess();
- oss << ".";
- oss << utility::random::getString(6);
-+ oss << ".";
-+ oss << platform::getHandler()->getHostName();
-
- return (utility::file::path::component(oss.str()));
- }
-diff -urN a/src/net/message.cpp b/src/net/message.cpp
---- a/src/net/message.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/message.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
+index bb2b69f..19887b2 100644
+--- a/src/net/maildir/maildirUtils.cpp
++++ b/src/net/maildir/maildirUtils.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3351,9 +5725,10 @@ diff -urN a/src/net/message.cpp b/src/net/message.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/pop3/POP3Folder.cpp b/src/net/pop3/POP3Folder.cpp
---- a/src/net/pop3/POP3Folder.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/pop3/POP3Folder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/message.cpp b/src/net/message.cpp
+index 37f020b..9a54809 100644
+--- a/src/net/message.cpp
++++ b/src/net/message.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3367,9 +5742,10 @@ diff -urN a/src/net/pop3/POP3Folder.cpp b/src/net/pop3/POP3Folder.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
---- a/src/net/pop3/POP3Message.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/pop3/POP3Message.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/pop3/POP3Folder.cpp b/src/net/pop3/POP3Folder.cpp
+index ba70f2b..d5fc687 100644
+--- a/src/net/pop3/POP3Folder.cpp
++++ b/src/net/pop3/POP3Folder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3383,9 +5759,10 @@ diff -urN a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/pop3/POP3ServiceInfos.cpp b/src/net/pop3/POP3ServiceInfos.cpp
---- a/src/net/pop3/POP3ServiceInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/pop3/POP3ServiceInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
+index 6cdd455..b38951b 100644
+--- a/src/net/pop3/POP3Message.cpp
++++ b/src/net/pop3/POP3Message.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3399,9 +5776,10 @@ diff -urN a/src/net/pop3/POP3ServiceInfos.cpp b/src/net/pop3/POP3ServiceInfos.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/pop3/POP3SStore.cpp b/src/net/pop3/POP3SStore.cpp
---- a/src/net/pop3/POP3SStore.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/pop3/POP3SStore.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/pop3/POP3SStore.cpp b/src/net/pop3/POP3SStore.cpp
+index 154f049..59aacb8 100644
+--- a/src/net/pop3/POP3SStore.cpp
++++ b/src/net/pop3/POP3SStore.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3415,9 +5793,10 @@ diff -urN a/src/net/pop3/POP3SStore.cpp b/src/net/pop3/POP3SStore.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp
---- a/src/net/pop3/POP3Store.cpp 2008-10-12 11:32:11.000000000 +0200
-+++ b/src/net/pop3/POP3Store.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/pop3/POP3ServiceInfos.cpp b/src/net/pop3/POP3ServiceInfos.cpp
+index da67f84..77faa5f 100644
+--- a/src/net/pop3/POP3ServiceInfos.cpp
++++ b/src/net/pop3/POP3ServiceInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3431,9 +5810,10 @@ diff -urN a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/pop3/POP3Utils.cpp b/src/net/pop3/POP3Utils.cpp
---- a/src/net/pop3/POP3Utils.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/pop3/POP3Utils.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp
+index 16a5dff..e5e8ba7 100644
+--- a/src/net/pop3/POP3Store.cpp
++++ b/src/net/pop3/POP3Store.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3447,9 +5827,10 @@ diff -urN a/src/net/pop3/POP3Utils.cpp b/src/net/pop3/POP3Utils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/sendmail/sendmailServiceInfos.cpp b/src/net/sendmail/sendmailServiceInfos.cpp
---- a/src/net/sendmail/sendmailServiceInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/sendmail/sendmailServiceInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/pop3/POP3Utils.cpp b/src/net/pop3/POP3Utils.cpp
+index b8df9fd..de70dfe 100644
+--- a/src/net/pop3/POP3Utils.cpp
++++ b/src/net/pop3/POP3Utils.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3463,9 +5844,10 @@ diff -urN a/src/net/sendmail/sendmailServiceInfos.cpp b/src/net/sendmail/sendmai
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/sendmail/sendmailTransport.cpp b/src/net/sendmail/sendmailTransport.cpp
---- a/src/net/sendmail/sendmailTransport.cpp 2008-10-12 11:36:47.000000000 +0200
-+++ b/src/net/sendmail/sendmailTransport.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/sendmail/sendmailServiceInfos.cpp b/src/net/sendmail/sendmailServiceInfos.cpp
+index de23e2b..fb5fb54 100644
+--- a/src/net/sendmail/sendmailServiceInfos.cpp
++++ b/src/net/sendmail/sendmailServiceInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3479,9 +5861,10 @@ diff -urN a/src/net/sendmail/sendmailTransport.cpp b/src/net/sendmail/sendmailTr
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/service.cpp b/src/net/service.cpp
---- a/src/net/service.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/service.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/sendmail/sendmailTransport.cpp b/src/net/sendmail/sendmailTransport.cpp
+index c1aded6..53ff0d1 100644
+--- a/src/net/sendmail/sendmailTransport.cpp
++++ b/src/net/sendmail/sendmailTransport.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3495,9 +5878,10 @@ diff -urN a/src/net/service.cpp b/src/net/service.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/serviceFactory.cpp b/src/net/serviceFactory.cpp
---- a/src/net/serviceFactory.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/serviceFactory.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/service.cpp b/src/net/service.cpp
+index 2fae23f..f12c78f 100644
+--- a/src/net/service.cpp
++++ b/src/net/service.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3511,9 +5895,10 @@ diff -urN a/src/net/serviceFactory.cpp b/src/net/serviceFactory.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/serviceInfos.cpp b/src/net/serviceInfos.cpp
---- a/src/net/serviceInfos.cpp 2008-10-12 10:58:42.000000000 +0200
-+++ b/src/net/serviceInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/serviceFactory.cpp b/src/net/serviceFactory.cpp
+index 0abeeb3..65f9aa1 100644
+--- a/src/net/serviceFactory.cpp
++++ b/src/net/serviceFactory.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3527,9 +5912,10 @@ diff -urN a/src/net/serviceInfos.cpp b/src/net/serviceInfos.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/serviceRegistration.inl b/src/net/serviceRegistration.inl
---- a/src/net/serviceRegistration.inl 2008-10-12 11:25:52.000000000 +0200
-+++ b/src/net/serviceRegistration.inl 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/serviceInfos.cpp b/src/net/serviceInfos.cpp
+index d6aee29..069d9e1 100644
+--- a/src/net/serviceInfos.cpp
++++ b/src/net/serviceInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3543,9 +5929,10 @@ diff -urN a/src/net/serviceRegistration.inl b/src/net/serviceRegistration.inl
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/session.cpp b/src/net/session.cpp
---- a/src/net/session.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/session.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/serviceRegistration.inl b/src/net/serviceRegistration.inl
+index 75fa435..6eaca1e 100644
+--- a/src/net/serviceRegistration.inl
++++ b/src/net/serviceRegistration.inl
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3559,9 +5946,10 @@ diff -urN a/src/net/session.cpp b/src/net/session.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/smtp/SMTPResponse.cpp b/src/net/smtp/SMTPResponse.cpp
---- a/src/net/smtp/SMTPResponse.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/smtp/SMTPResponse.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/session.cpp b/src/net/session.cpp
+index ff23bc5..3898a8d 100644
+--- a/src/net/session.cpp
++++ b/src/net/session.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3575,9 +5963,10 @@ diff -urN a/src/net/smtp/SMTPResponse.cpp b/src/net/smtp/SMTPResponse.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/smtp/SMTPServiceInfos.cpp b/src/net/smtp/SMTPServiceInfos.cpp
---- a/src/net/smtp/SMTPServiceInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/smtp/SMTPServiceInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/smtp/SMTPResponse.cpp b/src/net/smtp/SMTPResponse.cpp
+index 24301c5..03c199b 100644
+--- a/src/net/smtp/SMTPResponse.cpp
++++ b/src/net/smtp/SMTPResponse.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3591,9 +5980,10 @@ diff -urN a/src/net/smtp/SMTPServiceInfos.cpp b/src/net/smtp/SMTPServiceInfos.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/smtp/SMTPSTransport.cpp b/src/net/smtp/SMTPSTransport.cpp
---- a/src/net/smtp/SMTPSTransport.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/smtp/SMTPSTransport.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/smtp/SMTPSTransport.cpp b/src/net/smtp/SMTPSTransport.cpp
+index 2b70731..db7fc6f 100644
+--- a/src/net/smtp/SMTPSTransport.cpp
++++ b/src/net/smtp/SMTPSTransport.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3607,9 +5997,10 @@ diff -urN a/src/net/smtp/SMTPSTransport.cpp b/src/net/smtp/SMTPSTransport.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
---- a/src/net/smtp/SMTPTransport.cpp 2008-10-12 15:50:54.000000000 +0200
-+++ b/src/net/smtp/SMTPTransport.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/smtp/SMTPServiceInfos.cpp b/src/net/smtp/SMTPServiceInfos.cpp
+index 7c39ea5..d2d0dcc 100644
+--- a/src/net/smtp/SMTPServiceInfos.cpp
++++ b/src/net/smtp/SMTPServiceInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3623,22 +6014,10 @@ diff -urN a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -617,8 +617,10 @@
-
- void SMTPTransport::sendRequest(const string& buffer, const bool end)
- {
-- m_socket->send(buffer);
-- if (end) m_socket->send("\r\n");
-+ if (end)
-+ m_socket->send(buffer + "\r\n");
-+ else
-+ m_socket->send(buffer);
- }
-
-
-diff -urN a/src/net/tls/TLSSecuredConnectionInfos.cpp b/src/net/tls/TLSSecuredConnectionInfos.cpp
---- a/src/net/tls/TLSSecuredConnectionInfos.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/tls/TLSSecuredConnectionInfos.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
+index 5ad8d70..917a56c 100644
+--- a/src/net/smtp/SMTPTransport.cpp
++++ b/src/net/smtp/SMTPTransport.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3652,9 +6031,10 @@ diff -urN a/src/net/tls/TLSSecuredConnectionInfos.cpp b/src/net/tls/TLSSecuredCo
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
---- a/src/net/tls/TLSSession.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/tls/TLSSession.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/tls/TLSSecuredConnectionInfos.cpp b/src/net/tls/TLSSecuredConnectionInfos.cpp
+index 55df5e2..2a37069 100644
+--- a/src/net/tls/TLSSecuredConnectionInfos.cpp
++++ b/src/net/tls/TLSSecuredConnectionInfos.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3668,49 +6048,10 @@ diff -urN a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -24,6 +24,13 @@
- #include <gnutls/gnutls.h>
- #include <gnutls/extra.h>
-
-+#include "vmime/config.hpp"
-+
-+#if VMIME_HAVE_PTHREAD
-+# include <gcrypt.h>
-+# include <errno.h>
-+#endif // VMIME_HAVE_PTHREAD
-+
- #include "vmime/net/tls/TLSSession.hpp"
-
- #include "vmime/exception.hpp"
-@@ -38,6 +45,14 @@
- #endif // VMIME_DEBUG && GNUTLS_DEBUG
-
-
-+#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
-+extern "C"
-+{
-+ GCRY_THREAD_OPTION_PTHREAD_IMPL;
-+}
-+#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
-+
-+
- namespace vmime {
- namespace net {
- namespace tls {
-@@ -50,6 +65,10 @@
- {
- TLSGlobal()
- {
-+#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
-+ gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
-+#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
-+
- gnutls_global_init();
- //gnutls_global_init_extra();
-
-diff -urN a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp
---- a/src/net/tls/TLSSocket.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/net/tls/TLSSocket.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
+index d90be8e..1146d1b 100644
+--- a/src/net/tls/TLSSession.cpp
++++ b/src/net/tls/TLSSession.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3724,80 +6065,10 @@ diff -urN a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -90,6 +90,12 @@
- }
-
-
-+TLSSocket::size_type TLSSocket::getBlockSize() const
-+{
-+ return 16384; // 16 KB
-+}
-+
-+
- void TLSSocket::receive(string& buffer)
- {
- const int size = receiveRaw(m_buffer, sizeof(m_buffer));
-@@ -103,7 +109,7 @@
- }
-
-
--int TLSSocket::receiveRaw(char* buffer, const int count)
-+TLSSocket::size_type TLSSocket::receiveRaw(char* buffer, const size_type count)
- {
- const ssize_t ret = gnutls_record_recv
- (*m_session->m_gnutlsSession,
-@@ -124,7 +130,7 @@
- }
-
-
--void TLSSocket::sendRaw(const char* buffer, const int count)
-+void TLSSocket::sendRaw(const char* buffer, const size_type count)
- {
- gnutls_record_send
- (*m_session->m_gnutlsSession,
-@@ -292,27 +298,26 @@
- // Try X.509
- gnutls_x509_crt* x509Certs = new gnutls_x509_crt[certCount];
-
-- unsigned int count = certCount;
--
-- int res = gnutls_x509_crt_list_import
-- (x509Certs, &count, rawData, GNUTLS_X509_FMT_PEM, 0);
--
-- if (res <= 0)
-+ for (unsigned int i = 0; i < certCount; ++i)
- {
-- count = certCount;
-+ gnutls_x509_crt_init(x509Certs + i);
-+
-+ int res = gnutls_x509_crt_import(x509Certs[i], rawData + i,
-+ GNUTLS_X509_FMT_DER);
-
-- res = gnutls_x509_crt_list_import
-- (x509Certs, &count, rawData, GNUTLS_X509_FMT_DER, 0);
-+ if (res < 0)
-+ {
-+ // XXX more fine-grained error reporting?
-+ delete [] x509Certs;
-+ return NULL;
-+ }
- }
-
-- if (res >= 1)
- {
- std::vector <ref <security::cert::certificate> > certs;
- bool error = false;
-
-- count = static_cast <unsigned int>(res);
--
-- for (unsigned int i = 0 ; i < count ; ++i)
-+ for (unsigned int i = 0 ; i < certCount ; ++i)
- {
- size_t dataSize = 0;
-
-diff -urN a/src/net/transport.cpp b/src/net/transport.cpp
---- a/src/net/transport.cpp 2008-10-12 11:30:53.000000000 +0200
-+++ b/src/net/transport.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp
+index 4f64967..c2f91f6 100644
+--- a/src/net/tls/TLSSocket.cpp
++++ b/src/net/tls/TLSSocket.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3811,9 +6082,10 @@ diff -urN a/src/net/transport.cpp b/src/net/transport.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/object.cpp b/src/object.cpp
---- a/src/object.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/object.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/net/transport.cpp b/src/net/transport.cpp
+index 5db70d2..dd4663d 100644
+--- a/src/net/transport.cpp
++++ b/src/net/transport.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3827,9 +6099,10 @@ diff -urN a/src/object.cpp b/src/object.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/options.cpp b/src/options.cpp
---- a/src/options.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/options.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/object.cpp b/src/object.cpp
+index a15417a..1424f68 100644
+--- a/src/object.cpp
++++ b/src/object.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3843,9 +6116,10 @@ diff -urN a/src/options.cpp b/src/options.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/parameter.cpp b/src/parameter.cpp
---- a/src/parameter.cpp 2008-10-12 11:08:59.000000000 +0200
-+++ b/src/parameter.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/options.cpp b/src/options.cpp
+index a7c838e..f75da99 100644
+--- a/src/options.cpp
++++ b/src/options.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3859,9 +6133,10 @@ diff -urN a/src/parameter.cpp b/src/parameter.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
---- a/src/parameterizedHeaderField.cpp 2008-10-12 11:47:37.000000000 +0200
-+++ b/src/parameterizedHeaderField.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/parameter.cpp b/src/parameter.cpp
+index 466df3d..6cd8d1f 100644
+--- a/src/parameter.cpp
++++ b/src/parameter.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3875,9 +6150,10 @@ diff -urN a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/parsedMessageAttachment.cpp b/src/parsedMessageAttachment.cpp
---- a/src/parsedMessageAttachment.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/parsedMessageAttachment.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
+index a45c627..090d5b4 100644
+--- a/src/parameterizedHeaderField.cpp
++++ b/src/parameterizedHeaderField.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3891,9 +6167,10 @@ diff -urN a/src/parsedMessageAttachment.cpp b/src/parsedMessageAttachment.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/path.cpp b/src/path.cpp
---- a/src/path.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/path.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/parsedMessageAttachment.cpp b/src/parsedMessageAttachment.cpp
+index 3ef17ac..bde56aa 100644
+--- a/src/parsedMessageAttachment.cpp
++++ b/src/parsedMessageAttachment.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3907,9 +6184,10 @@ diff -urN a/src/path.cpp b/src/path.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/plainTextPart.cpp b/src/plainTextPart.cpp
---- a/src/plainTextPart.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/plainTextPart.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/path.cpp b/src/path.cpp
+index 5816787..37a4090 100644
+--- a/src/path.cpp
++++ b/src/path.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3923,9 +6201,10 @@ diff -urN a/src/plainTextPart.cpp b/src/plainTextPart.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/platform.cpp b/src/platform.cpp
---- a/src/platform.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/platform.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/plainTextPart.cpp b/src/plainTextPart.cpp
+index dee3f39..7a674e7 100644
+--- a/src/plainTextPart.cpp
++++ b/src/plainTextPart.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3939,9 +6218,10 @@ diff -urN a/src/platform.cpp b/src/platform.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posixChildProcess.cpp
---- a/src/platforms/posix/posixChildProcess.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/platforms/posix/posixChildProcess.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platform.cpp b/src/platform.cpp
+index 9db92cc..d1d23de 100644
+--- a/src/platform.cpp
++++ b/src/platform.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3955,9 +6235,10 @@ diff -urN a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posi
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
---- a/src/platforms/posix/posixFile.cpp 2008-10-12 11:42:23.000000000 +0200
-+++ b/src/platforms/posix/posixFile.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posixChildProcess.cpp
+index d1a0d91..68ef021 100644
+--- a/src/platforms/posix/posixChildProcess.cpp
++++ b/src/platforms/posix/posixChildProcess.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -3971,280 +6252,10 @@ diff -urN a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -32,6 +32,7 @@
-
- #include <dirent.h>
-
-+#include <stdio.h>
- #include <string.h>
-
- #include "vmime/exception.hpp"
-@@ -62,7 +63,10 @@
- posixFileIterator::~posixFileIterator()
- {
- if (m_dir != NULL)
-- ::closedir(m_dir);
-+ {
-+ if (::closedir(m_dir) == -1)
-+ posixFileSystemFactory::reportError(m_path, errno);
-+ }
- }
-
-
-@@ -85,6 +89,8 @@
-
- void posixFileIterator::getNextElement()
- {
-+ errno = 0;
-+
- while ((m_dirEntry = ::readdir(m_dir)) != NULL)
- {
- const char* name = m_dirEntry->d_name;
-@@ -96,6 +102,9 @@
- break;
- }
- }
-+
-+ if (errno)
-+ posixFileSystemFactory::reportError(m_path, errno);
- }
-
-
-@@ -118,14 +127,36 @@
-
- void posixFileWriterOutputStream::write(const value_type* const data, const size_type count)
- {
-- if (::write(m_fd, data, count) == -1)
-- posixFileSystemFactory::reportError(m_path, errno);
-+ const value_type* array = data;
-+ size_t size = count;
-+
-+ while (1)
-+ {
-+ ssize_t ret = ::write(m_fd, array, size);
-+
-+ if (ret == -1)
-+ {
-+ if (errno == EINTR)
-+ continue;
-+
-+ posixFileSystemFactory::reportError(m_path, errno);
-+ break;
-+ }
-+ else if (size_t(ret) < size)
-+ {
-+ array += ret;
-+ size -= ret;
-+ }
-+
-+ break;
-+ }
- }
-
-
- void posixFileWriterOutputStream::flush()
- {
-- ::fsync(m_fd);
-+ if (::fsync(m_fd) == -1)
-+ posixFileSystemFactory::reportError(m_path, errno);
- }
-
-
-@@ -142,7 +173,8 @@
-
- posixFileReaderInputStream::~posixFileReaderInputStream()
- {
-- ::close(m_fd);
-+ if (::close(m_fd) == -1)
-+ posixFileSystemFactory::reportError(m_path, errno);
- }
-
-
-@@ -154,7 +186,10 @@
-
- void posixFileReaderInputStream::reset()
- {
-- ::lseek(m_fd, 0, SEEK_SET);
-+ if (::lseek(m_fd, 0, SEEK_SET) == off_t(-1))
-+ posixFileSystemFactory::reportError(m_path, errno);
-+
-+ m_eof = false;
- }
-
-
-@@ -166,7 +201,7 @@
- if ((c = ::read(m_fd, data, count)) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
-
-- if (c == 0)
-+ if (c == 0 && count != 0)
- m_eof = true;
-
- return static_cast <size_type>(c);
-@@ -176,8 +211,15 @@
- vmime::utility::stream::size_type posixFileReaderInputStream::skip(const size_type count)
- {
- const off_t curPos = ::lseek(m_fd, 0, SEEK_CUR);
-+
-+ if (curPos == off_t(-1))
-+ posixFileSystemFactory::reportError(m_path, errno);
-+
- const off_t newPos = ::lseek(m_fd, count, SEEK_CUR);
-
-+ if (newPos == off_t(-1))
-+ posixFileSystemFactory::reportError(m_path, errno);
-+
- return static_cast <size_type>(newPos - curPos);
- }
-
-@@ -244,7 +286,11 @@
- if ((fd = ::open(m_nativePath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0660)) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
-
-- ::close(fd);
-+ if (::fsync(fd) == -1)
-+ posixFileSystemFactory::reportError(m_path, errno);
-+
-+ if (::close(fd) == -1)
-+ posixFileSystemFactory::reportError(m_path, errno);
- }
-
-
-@@ -257,32 +303,58 @@
- bool posixFile::isFile() const
- {
- struct stat buf;
-- return (::stat(m_nativePath.c_str(), &buf) == 0 && S_ISREG(buf.st_mode));
-+
-+ if (::stat(m_nativePath.c_str(), &buf) == -1)
-+ {
-+ posixFileSystemFactory::reportError(m_path, errno);
-+ return false;
-+ }
-+
-+ return S_ISREG(buf.st_mode);
- }
-
-
- bool posixFile::isDirectory() const
- {
- struct stat buf;
-- return (::stat(m_nativePath.c_str(), &buf) == 0 && S_ISDIR(buf.st_mode));
-+
-+ if (::stat(m_nativePath.c_str(), &buf) == -1)
-+ {
-+ posixFileSystemFactory::reportError(m_path, errno);
-+ return false;
-+ }
-+
-+ return S_ISDIR(buf.st_mode);
- }
-
-
- bool posixFile::canRead() const
- {
- struct stat buf;
-- return (::stat(m_nativePath.c_str(), &buf) == 0 &&
-- S_ISREG(buf.st_mode) &&
-- ::access(m_nativePath.c_str(), R_OK | F_OK) == 0);
-+
-+ if (::stat(m_nativePath.c_str(), &buf) == -1)
-+ {
-+ posixFileSystemFactory::reportError(m_path, errno);
-+ return false;
-+ }
-+
-+ return S_ISREG(buf.st_mode) &&
-+ ::access(m_nativePath.c_str(), R_OK | F_OK) == 0;
- }
-
-
- bool posixFile::canWrite() const
- {
- struct stat buf;
-- return (::stat(m_nativePath.c_str(), &buf) == 0 &&
-- S_ISREG(buf.st_mode) &&
-- ::access(m_nativePath.c_str(), W_OK | F_OK) == 0);
-+
-+ if (::stat(m_nativePath.c_str(), &buf) == -1)
-+ {
-+ posixFileSystemFactory::reportError(m_path, errno);
-+ return false;
-+ }
-+
-+ return S_ISREG(buf.st_mode) &&
-+ ::access(m_nativePath.c_str(), W_OK | F_OK) == 0;
- }
-
-
-@@ -290,7 +362,7 @@
- {
- struct stat buf;
-
-- if (::stat(m_nativePath.c_str(), &buf) != 0)
-+ if (::stat(m_nativePath.c_str(), &buf) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
-
- return static_cast <length_type>(buf.st_size);
-@@ -323,7 +395,14 @@
- {
- const vmime::string newNativePath = posixFileSystemFactory::pathToStringImpl(newName);
-
-- if (::rename(m_nativePath.c_str(), newNativePath.c_str()) != 0)
-+ posixFile dest(newName);
-+
-+ if (isDirectory())
-+ dest.createDirectory();
-+ else
-+ dest.createFile();
-+
-+ if (::rename(m_nativePath.c_str(), newNativePath.c_str()) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
-
- m_path = newName;
-@@ -335,17 +414,17 @@
- {
- struct stat buf;
-
-- if (::stat(m_nativePath.c_str(), &buf) != 0)
-+ if (::stat(m_nativePath.c_str(), &buf) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
-
- if (S_ISDIR(buf.st_mode))
- {
-- if (::rmdir(m_nativePath.c_str()) != 0)
-+ if (::rmdir(m_nativePath.c_str()) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
- }
- else if (S_ISREG(buf.st_mode))
- {
-- if (::unlink(m_nativePath.c_str()) != 0)
-+ if (::unlink(m_nativePath.c_str()) == -1)
- posixFileSystemFactory::reportError(m_path, errno);
- }
- }
-@@ -384,7 +463,7 @@
- if (!path.isEmpty() && recursive)
- createDirectoryImpl(fullPath, path.getParent(), true);
-
-- if (::mkdir(nativePath.c_str(), 0750) != 0)
-+ if (::mkdir(nativePath.c_str(), 0750) == -1)
- posixFileSystemFactory::reportError(fullPath, errno);
- }
-
-@@ -487,7 +566,9 @@
- case ENOMEM: desc = "ENOMEM: insufficient kernel memory."; break;
- case EMFILE: desc = "ENFILE: limit on number of files open by the process has been reached."; break;
- case ENFILE: desc = "ENFILE: limit on number of files open on the system has been reached."; break;
-+#ifndef AIX
- case ENOTEMPTY: desc = "ENOTEMPTY: directory is not empty."; break;
-+#endif
-
- default:
-
-diff -urN a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
---- a/src/platforms/posix/posixHandler.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/platforms/posix/posixHandler.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index 2a1356a..4ec2ef3 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4258,127 +6269,10 @@ diff -urN a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHand
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -36,6 +36,11 @@
- #include <netdb.h>
-
- #include <string.h>
-+#include <cassert>
-+
-+#if VMIME_HAVE_PTHREAD
-+# include <pthread.h>
-+#endif // VMIME_HAVE_PTHREAD
-
- /*
- #ifdef _POSIX_PRIORITY_SCHEDULING
-@@ -44,6 +49,43 @@
- */
-
-
-+#if VMIME_HAVE_PTHREAD
-+
-+namespace
-+{
-+ // This construction ensures mutex will be initialized in compile-time
-+ // and will be available any time in the runtime.
-+ pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
-+
-+ // Helper lock, to be exception safe all the time.
-+ class PLockHelper
-+ {
-+ public:
-+
-+ PLockHelper()
-+ {
-+ if (pthread_mutex_lock(&g_mutex) != 0)
-+ assert(!"unable to lock mutex - thread safety's void");
-+ }
-+
-+ ~PLockHelper()
-+ {
-+ if (pthread_mutex_unlock(&g_mutex) != 0)
-+ assert(!"unable to unlock mutex - application's dead...");
-+ }
-+
-+ private:
-+
-+ // Object cannot be copied
-+ PLockHelper(const PLockHelper&);
-+ const PLockHelper& operator=(const PLockHelper&);
-+ };
-+
-+} // unnamed namespace
-+
-+#endif // VMIME_HAVE_PTHREAD
-+
-+
- namespace vmime {
- namespace platforms {
- namespace posix {
-@@ -55,18 +97,14 @@
- m_socketFactory = vmime::create <posixSocketFactory>();
- #endif
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-- m_fileSysFactory = new posixFileSystemFactory();
-- m_childProcFactory = new posixChildProcessFactory();
-+ m_fileSysFactory = vmime::create <posixFileSystemFactory>();
-+ m_childProcFactory = vmime::create <posixChildProcessFactory>();
- #endif
- }
-
-
- posixHandler::~posixHandler()
- {
--#if VMIME_HAVE_FILESYSTEM_FEATURES
-- delete (m_fileSysFactory);
-- delete (m_childProcFactory);
--#endif
- }
-
-
-@@ -113,6 +151,8 @@
-
- const vmime::charset posixHandler::getLocaleCharset() const
- {
-+ const PLockHelper lock;
-+
- const char* prevLocale = ::setlocale(LC_ALL, "");
- vmime::charset ch(::nl_langinfo(CODESET));
- ::setlocale(LC_ALL, prevLocale);
-@@ -173,9 +213,9 @@
-
- #if VMIME_HAVE_MESSAGING_FEATURES
-
--ref <vmime::net::socketFactory> posixHandler::getSocketFactory() const
-+ref <vmime::net::socketFactory> posixHandler::getSocketFactory()
- {
-- return m_socketFactory.dynamicCast <vmime::net::socketFactory>();
-+ return m_socketFactory;
- }
-
- #endif
-@@ -183,15 +223,15 @@
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-
--vmime::utility::fileSystemFactory* posixHandler::getFileSystemFactory() const
-+ref <vmime::utility::fileSystemFactory> posixHandler::getFileSystemFactory()
- {
-- return (m_fileSysFactory);
-+ return m_fileSysFactory;
- }
-
-
--vmime::utility::childProcessFactory* posixHandler::getChildProcessFactory() const
-+ref <vmime::utility::childProcessFactory> posixHandler::getChildProcessFactory()
- {
-- return (m_childProcFactory);
-+ return m_childProcFactory;
- }
-
- #endif
-diff -urN a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
---- a/src/platforms/posix/posixSocket.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/platforms/posix/posixSocket.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
+index 94a5072..f43972e 100644
+--- a/src/platforms/posix/posixHandler.cpp
++++ b/src/platforms/posix/posixHandler.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4392,43 +6286,27 @@ diff -urN a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocke
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -217,6 +217,12 @@
- }
-
-
-+posixSocket::size_type posixSocket::getBlockSize() const
-+{
-+ return 16384; // 16 KB
-+}
-+
-+
- void posixSocket::receive(vmime::string& buffer)
- {
- const int size = receiveRaw(m_buffer, sizeof(m_buffer));
-@@ -224,7 +230,7 @@
- }
-
-
--int posixSocket::receiveRaw(char* buffer, const int count)
-+posixSocket::size_type posixSocket::receiveRaw(char* buffer, const size_type count)
- {
- const int ret = ::recv(m_desc, buffer, count, 0);
-
-@@ -252,9 +258,9 @@
- }
-
-
--void posixSocket::sendRaw(const char* buffer, const int count)
-+void posixSocket::sendRaw(const char* buffer, const size_type count)
- {
-- int size = count;
-+ size_type size = count;
-
- while (size > 0)
- {
-diff -urN a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
---- a/src/platforms/windows/windowsFile.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/platforms/windows/windowsFile.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
+index 4c2375c..6740995 100644
+--- a/src/platforms/posix/posixSocket.cpp
++++ b/src/platforms/posix/posixSocket.cpp
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff --git a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
+index c94076c..5412a3b 100644
+--- a/src/platforms/windows/windowsFile.cpp
++++ b/src/platforms/windows/windowsFile.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://vmime.sourceforge.net)
@@ -4442,36 +6320,10 @@ diff -urN a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/window
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -268,7 +268,7 @@
- return true;
- }
-
--const windowsFile::length_type windowsFile::getLength()
-+windowsFile::length_type windowsFile::getLength()
- {
- HANDLE hFile = CreateFile(
- m_nativePath.c_str(),
-@@ -464,7 +464,7 @@
- SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
- }
-
--const vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
-+vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
- {
- DWORD dwBytesRead;
- if (!ReadFile(m_hFile, (LPVOID)data, (DWORD)count, &dwBytesRead, NULL))
-@@ -472,7 +472,7 @@
- return dwBytesRead;
- }
-
--const vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
-+vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
- {
- DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
- DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)count, NULL, FILE_CURRENT);
-diff -urN a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
---- a/src/platforms/windows/windowsHandler.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/platforms/windows/windowsHandler.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
+index 58b1ae9..404d3cb 100644
+--- a/src/platforms/windows/windowsHandler.cpp
++++ b/src/platforms/windows/windowsHandler.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://vmime.sourceforge.net)
@@ -4485,57 +6337,10 @@ diff -urN a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/win
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -49,17 +49,13 @@
- m_socketFactory = vmime::create <windowsSocketFactory>();
- #endif
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-- m_fileSysFactory = new windowsFileSystemFactory();
-+ m_fileSysFactory = vmime::create <windowsFileSystemFactory>();
- #endif
- }
-
-
- windowsHandler::~windowsHandler()
- {
--#if VMIME_HAVE_FILESYSTEM_FEATURES
-- delete (m_fileSysFactory);
--#endif
--
- WSACleanup();
- }
-
-@@ -240,9 +236,9 @@
-
- #if VMIME_HAVE_MESSAGING_FEATURES
-
--ref <vmime::net::socketFactory> windowsHandler::getSocketFactory() const
-+ref <vmime::net::socketFactory> windowsHandler::getSocketFactory()
- {
-- return m_socketFactory.dynamicCast <vmime::net::socketFactory>();
-+ return m_socketFactory;
- }
-
- #endif
-@@ -250,13 +246,13 @@
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-
--vmime::utility::fileSystemFactory* windowsHandler::getFileSystemFactory() const
-+ref <vmime::utility::fileSystemFactory> windowsHandler::getFileSystemFactory()
- {
-- return (m_fileSysFactory);
-+ return m_fileSysFactory;
- }
-
-
--vmime::utility::childProcessFactory* windowsHandler::getChildProcessFactory() const
-+ref <vmime::utility::childProcessFactory> windowsHandler::getChildProcessFactory()
- {
- // TODO: Not implemented
- return (NULL);
-diff -urN a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
---- a/src/platforms/windows/windowsSocket.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/platforms/windows/windowsSocket.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
+index 9450efc..8a42583 100644
+--- a/src/platforms/windows/windowsSocket.cpp
++++ b/src/platforms/windows/windowsSocket.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://vmime.sourceforge.net)
@@ -4549,40 +6354,10 @@ diff -urN a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/wind
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -121,6 +121,12 @@
- }
-
-
-+windowsSocket::size_type windowsSocket::getBlockSize() const
-+{
-+ return 16384; // 16 KB
-+}
-+
-+
- void windowsSocket::receive(vmime::string& buffer)
- {
- int ret = ::recv(m_desc, m_buffer, sizeof(m_buffer), 0);
-@@ -137,7 +143,7 @@
- }
-
-
--int windowsSocket::receiveRaw(char* buffer, const int count)
-+windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type count)
- {
- int ret = ::recv(m_desc, buffer, count, 0);
-
-@@ -159,7 +165,7 @@
- }
-
-
--void windowsSocket::sendRaw(const char* buffer, const int count)
-+void windowsSocket::sendRaw(const char* buffer, const size_type count)
- {
- ::send(m_desc, buffer, count, 0);
- }
-diff -urN a/src/propertySet.cpp b/src/propertySet.cpp
---- a/src/propertySet.cpp 2008-10-12 11:48:09.000000000 +0200
-+++ b/src/propertySet.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/propertySet.cpp b/src/propertySet.cpp
+index c980d96..1b37179 100644
+--- a/src/propertySet.cpp
++++ b/src/propertySet.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4596,9 +6371,10 @@ diff -urN a/src/propertySet.cpp b/src/propertySet.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/relay.cpp b/src/relay.cpp
---- a/src/relay.cpp 2008-10-12 11:50:43.000000000 +0200
-+++ b/src/relay.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/relay.cpp b/src/relay.cpp
+index b86ea14..5cd454f 100644
+--- a/src/relay.cpp
++++ b/src/relay.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4612,9 +6388,10 @@ diff -urN a/src/relay.cpp b/src/relay.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/cert/certificateChain.cpp b/src/security/cert/certificateChain.cpp
---- a/src/security/cert/certificateChain.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/cert/certificateChain.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/cert/X509Certificate.cpp b/src/security/cert/X509Certificate.cpp
+index ac1f7e0..1cd079c 100644
+--- a/src/security/cert/X509Certificate.cpp
++++ b/src/security/cert/X509Certificate.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4628,9 +6405,10 @@ diff -urN a/src/security/cert/certificateChain.cpp b/src/security/cert/certifica
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/cert/defaultCertificateVerifier.cpp b/src/security/cert/defaultCertificateVerifier.cpp
---- a/src/security/cert/defaultCertificateVerifier.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/cert/defaultCertificateVerifier.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/cert/certificateChain.cpp b/src/security/cert/certificateChain.cpp
+index 0425d00..71b8ab4 100644
+--- a/src/security/cert/certificateChain.cpp
++++ b/src/security/cert/certificateChain.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4644,9 +6422,10 @@ diff -urN a/src/security/cert/defaultCertificateVerifier.cpp b/src/security/cert
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/cert/X509Certificate.cpp b/src/security/cert/X509Certificate.cpp
---- a/src/security/cert/X509Certificate.cpp 2008-10-12 11:41:13.000000000 +0200
-+++ b/src/security/cert/X509Certificate.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/cert/defaultCertificateVerifier.cpp b/src/security/cert/defaultCertificateVerifier.cpp
+index dc082a8..6fde551 100644
+--- a/src/security/cert/defaultCertificateVerifier.cpp
++++ b/src/security/cert/defaultCertificateVerifier.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4660,9 +6439,10 @@ diff -urN a/src/security/cert/X509Certificate.cpp b/src/security/cert/X509Certif
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/defaultAuthenticator.cpp b/src/security/defaultAuthenticator.cpp
---- a/src/security/defaultAuthenticator.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/defaultAuthenticator.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/defaultAuthenticator.cpp b/src/security/defaultAuthenticator.cpp
+index 8019106..088ef0d 100644
+--- a/src/security/defaultAuthenticator.cpp
++++ b/src/security/defaultAuthenticator.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4676,9 +6456,10 @@ diff -urN a/src/security/defaultAuthenticator.cpp b/src/security/defaultAuthenti
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/digest/md5/md5MessageDigest.cpp b/src/security/digest/md5/md5MessageDigest.cpp
---- a/src/security/digest/md5/md5MessageDigest.cpp 2008-10-12 11:24:44.000000000 +0200
-+++ b/src/security/digest/md5/md5MessageDigest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/digest/md5/md5MessageDigest.cpp b/src/security/digest/md5/md5MessageDigest.cpp
+index d83908f..84ca99a 100644
+--- a/src/security/digest/md5/md5MessageDigest.cpp
++++ b/src/security/digest/md5/md5MessageDigest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4692,9 +6473,10 @@ diff -urN a/src/security/digest/md5/md5MessageDigest.cpp b/src/security/digest/m
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/digest/messageDigest.cpp b/src/security/digest/messageDigest.cpp
---- a/src/security/digest/messageDigest.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/digest/messageDigest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/digest/messageDigest.cpp b/src/security/digest/messageDigest.cpp
+index 6a5de13..4217984 100644
+--- a/src/security/digest/messageDigest.cpp
++++ b/src/security/digest/messageDigest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4708,9 +6490,10 @@ diff -urN a/src/security/digest/messageDigest.cpp b/src/security/digest/messageD
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/digest/messageDigestFactory.cpp b/src/security/digest/messageDigestFactory.cpp
---- a/src/security/digest/messageDigestFactory.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/digest/messageDigestFactory.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/digest/messageDigestFactory.cpp b/src/security/digest/messageDigestFactory.cpp
+index 1348d65..0326931 100644
+--- a/src/security/digest/messageDigestFactory.cpp
++++ b/src/security/digest/messageDigestFactory.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4724,9 +6507,10 @@ diff -urN a/src/security/digest/messageDigestFactory.cpp b/src/security/digest/m
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
---- a/src/security/digest/sha1/sha1MessageDigest.cpp 2008-10-12 11:24:21.000000000 +0200
-+++ b/src/security/digest/sha1/sha1MessageDigest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
+index 51eec6a..6d99e3f 100644
+--- a/src/security/digest/sha1/sha1MessageDigest.cpp
++++ b/src/security/digest/sha1/sha1MessageDigest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4740,37 +6524,10 @@ diff -urN a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -27,6 +27,7 @@
- #include "vmime/security/digest/sha1/sha1MessageDigest.hpp"
-
- #include <cstring>
-+#include <cassert>
-
-
- namespace vmime {
-@@ -161,8 +162,8 @@
- i = j = 0;
-
- std::memset(m_buffer, 0, 64);
-- std::memset(m_state, 0, 20);
-- std::memset(m_count, 0, 8);
-+ std::memset(m_state, 0, 5 * sizeof(unsigned long));
-+ std::memset(m_count, 0, 2 * sizeof(unsigned long));
- std::memset(&finalcount, 0, 8);
- }
-
-@@ -201,6 +202,8 @@
- unsigned long l[16];
- } CHAR64LONG16;
-
-+ assert(sizeof(unsigned long) == 4);
-+
- CHAR64LONG16* block;
- static unsigned char workspace[64];
-
-diff -urN a/src/security/sasl/builtinSASLMechanism.cpp b/src/security/sasl/builtinSASLMechanism.cpp
---- a/src/security/sasl/builtinSASLMechanism.cpp 2008-10-12 11:39:59.000000000 +0200
-+++ b/src/security/sasl/builtinSASLMechanism.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/sasl/SASLContext.cpp b/src/security/sasl/SASLContext.cpp
+index fca95c7..51c2bed 100644
+--- a/src/security/sasl/SASLContext.cpp
++++ b/src/security/sasl/SASLContext.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4784,9 +6541,10 @@ diff -urN a/src/security/sasl/builtinSASLMechanism.cpp b/src/security/sasl/built
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/defaultSASLAuthenticator.cpp
---- a/src/security/sasl/defaultSASLAuthenticator.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/sasl/defaultSASLAuthenticator.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/sasl/SASLMechanismFactory.cpp b/src/security/sasl/SASLMechanismFactory.cpp
+index a866e0c..285d6d3 100644
+--- a/src/security/sasl/SASLMechanismFactory.cpp
++++ b/src/security/sasl/SASLMechanismFactory.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4800,9 +6558,10 @@ diff -urN a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/d
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/sasl/SASLContext.cpp b/src/security/sasl/SASLContext.cpp
---- a/src/security/sasl/SASLContext.cpp 2008-10-12 15:52:16.000000000 +0200
-+++ b/src/security/sasl/SASLContext.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cpp
+index f7f80f5..c1688b7 100644
+--- a/src/security/sasl/SASLSession.cpp
++++ b/src/security/sasl/SASLSession.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4816,9 +6575,10 @@ diff -urN a/src/security/sasl/SASLContext.cpp b/src/security/sasl/SASLContext.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/sasl/SASLMechanismFactory.cpp b/src/security/sasl/SASLMechanismFactory.cpp
---- a/src/security/sasl/SASLMechanismFactory.cpp 2008-10-12 11:38:33.000000000 +0200
-+++ b/src/security/sasl/SASLMechanismFactory.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
+index 5f86aed..118429a 100644
+--- a/src/security/sasl/SASLSocket.cpp
++++ b/src/security/sasl/SASLSocket.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4832,9 +6592,10 @@ diff -urN a/src/security/sasl/SASLMechanismFactory.cpp b/src/security/sasl/SASLM
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cpp
---- a/src/security/sasl/SASLSession.cpp 2008-10-12 11:37:11.000000000 +0200
-+++ b/src/security/sasl/SASLSession.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/sasl/builtinSASLMechanism.cpp b/src/security/sasl/builtinSASLMechanism.cpp
+index 1c95831..767caf9 100644
+--- a/src/security/sasl/builtinSASLMechanism.cpp
++++ b/src/security/sasl/builtinSASLMechanism.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4848,9 +6609,10 @@ diff -urN a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
---- a/src/security/sasl/SASLSocket.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/security/sasl/SASLSocket.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/defaultSASLAuthenticator.cpp
+index 085493a..06ffc49 100644
+--- a/src/security/sasl/defaultSASLAuthenticator.cpp
++++ b/src/security/sasl/defaultSASLAuthenticator.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4864,40 +6626,10 @@ diff -urN a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -69,6 +69,12 @@
- }
-
-
-+SASLSocket::size_type SASLSocket::getBlockSize() const
-+{
-+ return m_wrapped->getBlockSize();
-+}
-+
-+
- void SASLSocket::receive(string& buffer)
- {
- const int n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer));
-@@ -77,7 +83,7 @@
- }
-
-
--int SASLSocket::receiveRaw(char* buffer, const int count)
-+SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count)
- {
- if (m_pendingLen != 0)
- {
-@@ -141,7 +147,7 @@
- }
-
-
--void SASLSocket::sendRaw(const char* buffer, const int count)
-+void SASLSocket::sendRaw(const char* buffer, const size_type count)
- {
- byte_t* output = 0;
- int outputLen = 0;
-diff -urN a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
---- a/src/streamContentHandler.cpp 2008-10-12 15:44:22.000000000 +0200
-+++ b/src/streamContentHandler.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
+index b5f02bf..9edf4aa 100644
+--- a/src/streamContentHandler.cpp
++++ b/src/streamContentHandler.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4911,9 +6643,10 @@ diff -urN a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
---- a/src/stringContentHandler.cpp 2008-10-12 15:42:48.000000000 +0200
-+++ b/src/stringContentHandler.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
+index 84cada5..248fca4 100644
+--- a/src/stringContentHandler.cpp
++++ b/src/stringContentHandler.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4927,9 +6660,10 @@ diff -urN a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/text.cpp b/src/text.cpp
---- a/src/text.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/text.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/text.cpp b/src/text.cpp
+index 2c811c4..f9ded7c 100644
+--- a/src/text.cpp
++++ b/src/text.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4943,31 +6677,10 @@ diff -urN a/src/text.cpp b/src/text.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -91,21 +91,6 @@
- }
-
-
--#if VMIME_WIDE_CHAR_SUPPORT
--
--const wstring text::getDecodedText() const
--{
-- wstring out;
--
-- for (std::vector <ref <word> >::const_iterator i = m_words.begin() ; i != m_words.end() ; ++i)
-- out += (*i)->getDecodedText();
--
-- return (out);
--}
--
--#endif
--
--
- void text::copyFrom(const component& other)
- {
- const text& t = dynamic_cast <const text&>(other);
-diff -urN a/src/textPartFactory.cpp b/src/textPartFactory.cpp
---- a/src/textPartFactory.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/src/textPartFactory.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/textPartFactory.cpp b/src/textPartFactory.cpp
+index 977ba07..c490845 100644
+--- a/src/textPartFactory.cpp
++++ b/src/textPartFactory.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4981,9 +6694,10 @@ diff -urN a/src/textPartFactory.cpp b/src/textPartFactory.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/datetimeUtils.cpp b/src/utility/datetimeUtils.cpp
---- a/src/utility/datetimeUtils.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/datetimeUtils.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/datetimeUtils.cpp b/src/utility/datetimeUtils.cpp
+index cc06f50..cf05a93 100644
+--- a/src/utility/datetimeUtils.cpp
++++ b/src/utility/datetimeUtils.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -4997,28 +6711,10 @@ diff -urN a/src/utility/datetimeUtils.cpp b/src/utility/datetimeUtils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -256,7 +256,7 @@
- }
-
-
--int datetimeUtils::getWeekOfYear(const int year, const int month, const int day)
-+int datetimeUtils::getWeekOfYear(const int year, const int month, const int day, const bool iso)
- {
- // Algorithm from http://personal.ecu.edu/mccartyr/ISOwdALG.txt
-
-@@ -322,6 +322,9 @@
- WeekNumber -= 1;
- }
-
-+ if (!iso && (WeekNumber == 1 && month == 12))
-+ WeekNumber = 53;
-+
- return WeekNumber;
- }
-
-diff -urN a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.cpp
---- a/src/utility/encoder/b64Encoder.cpp 2008-10-12 15:39:42.000000000 +0200
-+++ b/src/utility/encoder/b64Encoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.cpp
+index c4ba2b3..58ef320 100644
+--- a/src/utility/encoder/b64Encoder.cpp
++++ b/src/utility/encoder/b64Encoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5032,9 +6728,10 @@ diff -urN a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/binaryEncoder.cpp b/src/utility/encoder/binaryEncoder.cpp
---- a/src/utility/encoder/binaryEncoder.cpp 2008-10-12 15:28:06.000000000 +0200
-+++ b/src/utility/encoder/binaryEncoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/binaryEncoder.cpp b/src/utility/encoder/binaryEncoder.cpp
+index 2bc77d2..81da790 100644
+--- a/src/utility/encoder/binaryEncoder.cpp
++++ b/src/utility/encoder/binaryEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5048,9 +6745,10 @@ diff -urN a/src/utility/encoder/binaryEncoder.cpp b/src/utility/encoder/binaryEn
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/defaultEncoder.cpp b/src/utility/encoder/defaultEncoder.cpp
---- a/src/utility/encoder/defaultEncoder.cpp 2008-10-12 15:25:06.000000000 +0200
-+++ b/src/utility/encoder/defaultEncoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/defaultEncoder.cpp b/src/utility/encoder/defaultEncoder.cpp
+index db833c8..4d0ffb5 100644
+--- a/src/utility/encoder/defaultEncoder.cpp
++++ b/src/utility/encoder/defaultEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5064,9 +6762,10 @@ diff -urN a/src/utility/encoder/defaultEncoder.cpp b/src/utility/encoder/default
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/eightBitEncoder.cpp b/src/utility/encoder/eightBitEncoder.cpp
---- a/src/utility/encoder/eightBitEncoder.cpp 2008-10-12 15:23:16.000000000 +0200
-+++ b/src/utility/encoder/eightBitEncoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/eightBitEncoder.cpp b/src/utility/encoder/eightBitEncoder.cpp
+index 88f07bc..25ca6c5 100644
+--- a/src/utility/encoder/eightBitEncoder.cpp
++++ b/src/utility/encoder/eightBitEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5080,9 +6779,10 @@ diff -urN a/src/utility/encoder/eightBitEncoder.cpp b/src/utility/encoder/eightB
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/encoder.cpp b/src/utility/encoder/encoder.cpp
---- a/src/utility/encoder/encoder.cpp 2008-10-12 15:15:06.000000000 +0200
-+++ b/src/utility/encoder/encoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/encoder.cpp b/src/utility/encoder/encoder.cpp
+index 893ed4f..85b3708 100644
+--- a/src/utility/encoder/encoder.cpp
++++ b/src/utility/encoder/encoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5096,9 +6796,10 @@ diff -urN a/src/utility/encoder/encoder.cpp b/src/utility/encoder/encoder.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoderFactory.cpp
---- a/src/utility/encoder/encoderFactory.cpp 2008-10-12 15:38:01.000000000 +0200
-+++ b/src/utility/encoder/encoderFactory.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoderFactory.cpp
+index 9d7c107..428788d 100644
+--- a/src/utility/encoder/encoderFactory.cpp
++++ b/src/utility/encoder/encoderFactory.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5112,9 +6813,10 @@ diff -urN a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoder
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp
---- a/src/utility/encoder/qpEncoder.cpp 2008-10-12 15:32:35.000000000 +0200
-+++ b/src/utility/encoder/qpEncoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp
+index 737d488..c3a8c6d 100644
+--- a/src/utility/encoder/qpEncoder.cpp
++++ b/src/utility/encoder/qpEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5128,9 +6830,10 @@ diff -urN a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/sevenBitEncoder.cpp b/src/utility/encoder/sevenBitEncoder.cpp
---- a/src/utility/encoder/sevenBitEncoder.cpp 2008-10-12 15:48:20.000000000 +0200
-+++ b/src/utility/encoder/sevenBitEncoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/sevenBitEncoder.cpp b/src/utility/encoder/sevenBitEncoder.cpp
+index 812afa9..40f0fbf 100644
+--- a/src/utility/encoder/sevenBitEncoder.cpp
++++ b/src/utility/encoder/sevenBitEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5144,9 +6847,10 @@ diff -urN a/src/utility/encoder/sevenBitEncoder.cpp b/src/utility/encoder/sevenB
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/encoder/uuEncoder.cpp b/src/utility/encoder/uuEncoder.cpp
---- a/src/utility/encoder/uuEncoder.cpp 2008-10-12 15:36:45.000000000 +0200
-+++ b/src/utility/encoder/uuEncoder.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/encoder/uuEncoder.cpp b/src/utility/encoder/uuEncoder.cpp
+index 0e72599..d2974e6 100644
+--- a/src/utility/encoder/uuEncoder.cpp
++++ b/src/utility/encoder/uuEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5160,9 +6864,10 @@ diff -urN a/src/utility/encoder/uuEncoder.cpp b/src/utility/encoder/uuEncoder.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
---- a/src/utility/filteredStream.cpp 2008-10-12 11:09:18.000000000 +0200
-+++ b/src/utility/filteredStream.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
+index 5db0104..619f9da 100644
+--- a/src/utility/filteredStream.cpp
++++ b/src/utility/filteredStream.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5176,43 +6881,10 @@ diff -urN a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -30,6 +30,22 @@
- namespace utility {
-
-
-+// filteredInputStream
-+
-+stream::size_type filteredInputStream::getBlockSize()
-+{
-+ return std::min(inputStream::getBlockSize(), getPreviousInputStream().getBlockSize());
-+}
-+
-+
-+// filteredOutputStream
-+
-+stream::size_type filteredOutputStream::getBlockSize()
-+{
-+ return std::min(outputStream::getBlockSize(), getNextOutputStream().getBlockSize());
-+}
-+
-+
- // dotFilteredInputStream
-
- dotFilteredInputStream::dotFilteredInputStream(inputStream& is)
-@@ -215,8 +231,8 @@
-
- if (previousChar == '\r')
- {
-- if (pos != data)
-- m_stream.write(start, pos - 1 - data); // do not write \r
-+ if (pos != start)
-+ m_stream.write(start, pos - 1 - start); // do not write \r
-
- m_stream.write("\n", 1);
-
-diff -urN a/src/utility/path.cpp b/src/utility/path.cpp
---- a/src/utility/path.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/path.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/path.cpp b/src/utility/path.cpp
+index 053e612..9e314e6 100644
+--- a/src/utility/path.cpp
++++ b/src/utility/path.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5226,9 +6898,10 @@ diff -urN a/src/utility/path.cpp b/src/utility/path.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/progressListener.cpp b/src/utility/progressListener.cpp
---- a/src/utility/progressListener.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/progressListener.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/progressListener.cpp b/src/utility/progressListener.cpp
+index c7babcb..4bce372 100644
+--- a/src/utility/progressListener.cpp
++++ b/src/utility/progressListener.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5242,9 +6915,10 @@ diff -urN a/src/utility/progressListener.cpp b/src/utility/progressListener.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/random.cpp b/src/utility/random.cpp
---- a/src/utility/random.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/random.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/random.cpp b/src/utility/random.cpp
+index 2e373bb..d12989b 100644
+--- a/src/utility/random.cpp
++++ b/src/utility/random.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5258,9 +6932,10 @@ diff -urN a/src/utility/random.cpp b/src/utility/random.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/smartPtr.cpp b/src/utility/smartPtr.cpp
---- a/src/utility/smartPtr.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/smartPtr.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/smartPtr.cpp b/src/utility/smartPtr.cpp
+index bbc4843..e039036 100644
+--- a/src/utility/smartPtr.cpp
++++ b/src/utility/smartPtr.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5274,9 +6949,10 @@ diff -urN a/src/utility/smartPtr.cpp b/src/utility/smartPtr.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/smartPtrInt.cpp b/src/utility/smartPtrInt.cpp
---- a/src/utility/smartPtrInt.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/smartPtrInt.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/smartPtrInt.cpp b/src/utility/smartPtrInt.cpp
+index 4b4ce13..2ee677b 100644
+--- a/src/utility/smartPtrInt.cpp
++++ b/src/utility/smartPtrInt.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5290,9 +6966,10 @@ diff -urN a/src/utility/smartPtrInt.cpp b/src/utility/smartPtrInt.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/stream.cpp b/src/utility/stream.cpp
---- a/src/utility/stream.cpp 2008-10-12 11:10:12.000000000 +0200
-+++ b/src/utility/stream.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/stream.cpp b/src/utility/stream.cpp
+index 8fbf337..483784c 100644
+--- a/src/utility/stream.cpp
++++ b/src/utility/stream.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5306,42 +6983,10 @@ diff -urN a/src/utility/stream.cpp b/src/utility/stream.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -38,7 +38,7 @@
-
- // stream
-
--stream::size_type stream::getBlockSize() const
-+stream::size_type stream::getBlockSize()
- {
- return 32768; // 32 KB
- }
-@@ -468,9 +468,9 @@
- }
-
-
--stream::size_type outputStreamSocketAdapter::getBlockSize() const
-+stream::size_type outputStreamSocketAdapter::getBlockSize()
- {
-- return 16384; // 16 KB
-+ return m_socket.getBlockSize();
- }
-
-
-@@ -511,9 +511,9 @@
- }
-
-
--stream::size_type inputStreamSocketAdapter::getBlockSize() const
-+stream::size_type inputStreamSocketAdapter::getBlockSize()
- {
-- return 16384; // 16 KB
-+ return m_socket.getBlockSize();
- }
-
-
-diff -urN a/src/utility/stringProxy.cpp b/src/utility/stringProxy.cpp
---- a/src/utility/stringProxy.cpp 2008-10-12 11:10:31.000000000 +0200
-+++ b/src/utility/stringProxy.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/stringProxy.cpp b/src/utility/stringProxy.cpp
+index 60093b6..a4ba6d2 100644
+--- a/src/utility/stringProxy.cpp
++++ b/src/utility/stringProxy.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5355,9 +7000,10 @@ diff -urN a/src/utility/stringProxy.cpp b/src/utility/stringProxy.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
---- a/src/utility/stringUtils.cpp 2008-10-12 11:11:24.000000000 +0200
-+++ b/src/utility/stringUtils.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
+index 9566599..03b2057 100644
+--- a/src/utility/stringUtils.cpp
++++ b/src/utility/stringUtils.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5371,18 +7017,10 @@ diff -urN a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -142,7 +142,7 @@
- {
- if (parserHelpers::isAscii(*i))
- {
-- if (*i != '=' || *(i + 1) != '?') // To avoid bad behaviour...
-+ if (*i != '=' || ((i + 1) != end && *(i + 1) != '?')) // To avoid bad behaviour...
- ++count;
- }
- }
-diff -urN a/src/utility/url.cpp b/src/utility/url.cpp
---- a/src/utility/url.cpp 2008-10-12 10:54:31.000000000 +0200
-+++ b/src/utility/url.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/url.cpp b/src/utility/url.cpp
+index 7f609c7..6dfa68a 100644
+--- a/src/utility/url.cpp
++++ b/src/utility/url.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5396,9 +7034,10 @@ diff -urN a/src/utility/url.cpp b/src/utility/url.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/utility/urlUtils.cpp b/src/utility/urlUtils.cpp
---- a/src/utility/urlUtils.cpp 2008-10-12 11:52:31.000000000 +0200
-+++ b/src/utility/urlUtils.cpp 2010-02-09 14:34:52.000000000 +0100
+diff --git a/src/utility/urlUtils.cpp b/src/utility/urlUtils.cpp
+index d4243df..6df5794 100644
+--- a/src/utility/urlUtils.cpp
++++ b/src/utility/urlUtils.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5412,9 +7051,10 @@ diff -urN a/src/utility/urlUtils.cpp b/src/utility/urlUtils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/src/word.cpp b/src/word.cpp
---- a/src/word.cpp 2008-10-12 15:45:39.000000000 +0200
-+++ b/src/word.cpp 2010-02-10 10:56:54.000000000 +0100
+diff --git a/src/word.cpp b/src/word.cpp
+index 95adc5c..958c33e 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5428,79 +7068,10 @@ diff -urN a/src/word.cpp b/src/word.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -352,10 +352,23 @@
- noEncoding = false;
- }
-
-- if (noEncoding)
-+ // 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 contain quoting character (")
-+ // - there is enough remaining space on the current line to hold the whole buffer
-+ if (!noEncoding &&
-+ (flags & text::QUOTE_IF_POSSIBLE) &&
-+ asciiCount == m_buffer.length() &&
-+ m_buffer.find('"') == string::npos &&
-+ (curLineLength + 2 /* 2 x " */ + m_buffer.length()) < maxLineLength)
-+ {
-+ os << '"' << m_buffer << '"';
-+ curLineLength += 2 + m_buffer.length();
-+ }
-+ // We will fold lines without encoding them.
-+ else if (noEncoding)
- {
-- // We will fold lines without encoding them.
--
- string::const_iterator lastWSpos = m_buffer.end(); // last white-space position
- string::const_iterator curLineStart = m_buffer.begin(); // current line start
-
-@@ -463,7 +476,7 @@
-
- os << string(curLineStart, lastWSpos);
-
-- if (lastWSpos > curLineStart && std::isspace(*(lastWSpos - 1)))
-+ if (lastWSpos > curLineStart && parserHelpers::isSpace(*(lastWSpos - 1)))
- state->lastCharIsSpace = true;
- else
- state->lastCharIsSpace = false;
-@@ -609,20 +622,6 @@
- }
-
-
--#if VMIME_WIDE_CHAR_SUPPORT
--
--const wstring word::getDecodedText() const
--{
-- wstring out;
--
-- charset::decode(m_buffer, out, m_charset);
--
-- return (out);
--}
--
--#endif
--
--
- word& word::operator=(const word& w)
- {
- m_buffer = w.m_buffer;
-@@ -699,6 +698,12 @@
- }
-
-
-+bool word::isEmpty() const
-+{
-+ return m_buffer.empty();
-+}
-+
-+
- void word::setBuffer(const string& buffer)
- {
- m_buffer = buffer;
-diff -urN a/src/wordEncoder.cpp b/src/wordEncoder.cpp
---- a/src/wordEncoder.cpp 2008-10-12 15:47:14.000000000 +0200
-+++ b/src/wordEncoder.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/src/wordEncoder.cpp b/src/wordEncoder.cpp
+index ab7c004..154b4ef 100644
+--- a/src/wordEncoder.cpp
++++ b/src/wordEncoder.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5514,9 +7085,10 @@ diff -urN a/src/wordEncoder.cpp b/src/wordEncoder.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/charset/main.cpp b/tests/charset/main.cpp
---- a/tests/charset/main.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/charset/main.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/charset/main.cpp b/tests/charset/main.cpp
+index dd043ac..3e3a50b 100644
+--- a/tests/charset/main.cpp
++++ b/tests/charset/main.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5530,9 +7102,10 @@ diff -urN a/tests/charset/main.cpp b/tests/charset/main.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/misc/importanceHelperTest.cpp b/tests/misc/importanceHelperTest.cpp
---- a/tests/misc/importanceHelperTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/misc/importanceHelperTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/misc/importanceHelperTest.cpp b/tests/misc/importanceHelperTest.cpp
+index de3e7fc..d200cdf 100644
+--- a/tests/misc/importanceHelperTest.cpp
++++ b/tests/misc/importanceHelperTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5546,9 +7119,10 @@ diff -urN a/tests/misc/importanceHelperTest.cpp b/tests/misc/importanceHelperTes
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
---- a/tests/net/maildir/maildirStoreTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/net/maildir/maildirStoreTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
+index f24023b..5aad90b 100644
+--- a/tests/net/maildir/maildirStoreTest.cpp
++++ b/tests/net/maildir/maildirStoreTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5562,67 +7136,10 @@ diff -urN a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirSt
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -322,12 +322,28 @@
-
- void testRenameFolder_KMail()
- {
-- testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
-+ try
-+ {
-+ testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
-+ }
-+ catch (vmime::exception& e)
-+ {
-+ std::cerr << e;
-+ throw e;
-+ }
- }
-
- void testRenameFolder_Courier()
- {
-- testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
-+ try
-+ {
-+ testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
-+ }
-+ catch (vmime::exception& e)
-+ {
-+ std::cerr << e;
-+ throw e;
-+ }
- }
-
- void testRenameFolderImpl(const vmime::string* const dirs, const vmime::string* const files)
-@@ -485,7 +501,7 @@
-
- const vmime::utility::url getStoreURL()
- {
-- vmime::utility::fileSystemFactory* fsf =
-+ vmime::ref <vmime::utility::fileSystemFactory> fsf =
- vmime::platform::getHandler()->getFileSystemFactory();
-
- vmime::utility::url url(std::string("maildir://localhost")
-@@ -496,7 +512,7 @@
-
- void createMaildir(const vmime::string* const dirs, const vmime::string* const files)
- {
-- vmime::utility::fileSystemFactory* fsf =
-+ vmime::ref <vmime::utility::fileSystemFactory> fsf =
- vmime::platform::getHandler()->getFileSystemFactory();
-
- vmime::ref <vmime::utility::file> rootDir = fsf->create(m_tempPath);
-@@ -528,7 +544,7 @@
-
- void destroyMaildir()
- {
-- vmime::utility::fileSystemFactory* fsf =
-+ vmime::ref <vmime::utility::fileSystemFactory> fsf =
- vmime::platform::getHandler()->getFileSystemFactory();
-
- recursiveDelete(fsf->create(m_tempPath));
-diff -urN a/tests/net/smtp/SMTPResponseTest.cpp b/tests/net/smtp/SMTPResponseTest.cpp
---- a/tests/net/smtp/SMTPResponseTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/net/smtp/SMTPResponseTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/net/smtp/SMTPResponseTest.cpp b/tests/net/smtp/SMTPResponseTest.cpp
+index 3fbb19a..4ad284f 100644
+--- a/tests/net/smtp/SMTPResponseTest.cpp
++++ b/tests/net/smtp/SMTPResponseTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5636,9 +7153,10 @@ diff -urN a/tests/net/smtp/SMTPResponseTest.cpp b/tests/net/smtp/SMTPResponseTes
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp
---- a/tests/net/smtp/SMTPTransportTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/net/smtp/SMTPTransportTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp
+index 640b2a1..5015552 100644
+--- a/tests/net/smtp/SMTPTransportTest.cpp
++++ b/tests/net/smtp/SMTPTransportTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5652,9 +7170,10 @@ diff -urN a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportT
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelperTest.cpp
---- a/tests/parser/attachmentHelperTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/attachmentHelperTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelperTest.cpp
+index d1ae10a..142730c 100644
+--- a/tests/parser/attachmentHelperTest.cpp
++++ b/tests/parser/attachmentHelperTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5668,9 +7187,10 @@ diff -urN a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelpe
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp
---- a/tests/parser/bodyPartTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/bodyPartTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp
+index d6fff5e..12c4f74 100644
+--- a/tests/parser/bodyPartTest.cpp
++++ b/tests/parser/bodyPartTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5684,9 +7204,10 @@ diff -urN a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/charsetTest.cpp b/tests/parser/charsetTest.cpp
---- a/tests/parser/charsetTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/charsetTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/charsetTest.cpp b/tests/parser/charsetTest.cpp
+index 5a791c5..8ad71d7 100644
+--- a/tests/parser/charsetTest.cpp
++++ b/tests/parser/charsetTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5700,9 +7221,10 @@ diff -urN a/tests/parser/charsetTest.cpp b/tests/parser/charsetTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/datetimeTest.cpp b/tests/parser/datetimeTest.cpp
---- a/tests/parser/datetimeTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/datetimeTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/datetimeTest.cpp b/tests/parser/datetimeTest.cpp
+index b8ceea2..11f9b55 100644
+--- a/tests/parser/datetimeTest.cpp
++++ b/tests/parser/datetimeTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5716,9 +7238,10 @@ diff -urN a/tests/parser/datetimeTest.cpp b/tests/parser/datetimeTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/dispositionTest.cpp b/tests/parser/dispositionTest.cpp
---- a/tests/parser/dispositionTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/dispositionTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/dispositionTest.cpp b/tests/parser/dispositionTest.cpp
+index dc79d66..d0572b0 100644
+--- a/tests/parser/dispositionTest.cpp
++++ b/tests/parser/dispositionTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5732,9 +7255,10 @@ diff -urN a/tests/parser/dispositionTest.cpp b/tests/parser/dispositionTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/headerTest.cpp b/tests/parser/headerTest.cpp
---- a/tests/parser/headerTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/headerTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/headerTest.cpp b/tests/parser/headerTest.cpp
+index e2807ad..04cd14f 100644
+--- a/tests/parser/headerTest.cpp
++++ b/tests/parser/headerTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5748,9 +7272,10 @@ diff -urN a/tests/parser/headerTest.cpp b/tests/parser/headerTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/htmlTextPartTest.cpp b/tests/parser/htmlTextPartTest.cpp
---- a/tests/parser/htmlTextPartTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/htmlTextPartTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/htmlTextPartTest.cpp b/tests/parser/htmlTextPartTest.cpp
+index 6276db2..c9fa588 100644
+--- a/tests/parser/htmlTextPartTest.cpp
++++ b/tests/parser/htmlTextPartTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5764,9 +7289,10 @@ diff -urN a/tests/parser/htmlTextPartTest.cpp b/tests/parser/htmlTextPartTest.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
---- a/tests/parser/mailboxTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/mailboxTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
+index 64b8e45..8411daa 100644
+--- a/tests/parser/mailboxTest.cpp
++++ b/tests/parser/mailboxTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5780,9 +7306,10 @@ diff -urN a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/mediaTypeTest.cpp b/tests/parser/mediaTypeTest.cpp
---- a/tests/parser/mediaTypeTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/mediaTypeTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/mediaTypeTest.cpp b/tests/parser/mediaTypeTest.cpp
+index 4741bda..c69fd89 100644
+--- a/tests/parser/mediaTypeTest.cpp
++++ b/tests/parser/mediaTypeTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5796,9 +7323,10 @@ diff -urN a/tests/parser/mediaTypeTest.cpp b/tests/parser/mediaTypeTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/messageIdSequenceTest.cpp b/tests/parser/messageIdSequenceTest.cpp
---- a/tests/parser/messageIdSequenceTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/messageIdSequenceTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/messageIdSequenceTest.cpp b/tests/parser/messageIdSequenceTest.cpp
+index 82d871f..17e9a96 100644
+--- a/tests/parser/messageIdSequenceTest.cpp
++++ b/tests/parser/messageIdSequenceTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5812,9 +7340,10 @@ diff -urN a/tests/parser/messageIdSequenceTest.cpp b/tests/parser/messageIdSeque
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/messageIdTest.cpp b/tests/parser/messageIdTest.cpp
---- a/tests/parser/messageIdTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/messageIdTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/messageIdTest.cpp b/tests/parser/messageIdTest.cpp
+index 40e38eb..79154a8 100644
+--- a/tests/parser/messageIdTest.cpp
++++ b/tests/parser/messageIdTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5828,9 +7357,10 @@ diff -urN a/tests/parser/messageIdTest.cpp b/tests/parser/messageIdTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
---- a/tests/parser/parameterTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/parameterTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
+index f9a6113..fb7a429 100644
+--- a/tests/parser/parameterTest.cpp
++++ b/tests/parser/parameterTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -5844,172 +7374,10 @@ diff -urN a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -32,7 +32,9 @@
-
- VMIME_TEST_LIST_BEGIN
- VMIME_TEST(testParse)
-+ VMIME_TEST(testParseRFC2231)
- VMIME_TEST(testGenerate)
-+ VMIME_TEST(testGenerateRFC2231)
- VMIME_TEST(testNonStandardEncodedParam)
- VMIME_TEST_LIST_END
-
-@@ -134,57 +136,60 @@
- VASSERT_EQ("7.1", 1, p7.getParameterCount());
- VASSERT_EQ("7.2", "param1", PARAM_NAME(p7, 0));
- VASSERT_EQ("7.3", "this is a slash: \"\\\"", PARAM_VALUE(p7, 0));
-+ }
-
-+ void testParseRFC2231()
-+ {
- // Extended parameter with charset specified in more than one
- // section (this is forbidden by RFC, but is should not fail)
-- parameterizedHeaderField p8;
-- p8.parse("X; param1*0*=charset1'language1'value1;\r\n"
-- " param1*1*=charset2'language2'value2;");
--
-- VASSERT_EQ("8.1", 1, p8.getParameterCount());
-- VASSERT_EQ("8.2", "param1", PARAM_NAME(p8, 0));
-- VASSERT_EQ("8.3", "charset1", PARAM_CHARSET(p8, 0));
-- VASSERT_EQ("8.4", "value1charset2'language2'value2", PARAM_BUFFER(p8, 0));
-+ parameterizedHeaderField p1;
-+ p1.parse("X; param1*0*=charset1'language1'value1;\r\n"
-+ " param1*1*=charset2'language2'value2;");
-+
-+ VASSERT_EQ("1.1", 1, p1.getParameterCount());
-+ VASSERT_EQ("1.2", "param1", PARAM_NAME(p1, 0));
-+ VASSERT_EQ("1.3", "charset1", PARAM_CHARSET(p1, 0));
-+ VASSERT_EQ("1.4", "value1charset2'language2'value2", PARAM_BUFFER(p1, 0));
-
- // Charset not specified in the first section (that is not encoded),
- // but specified in the second one (legal)
-- parameterizedHeaderField p9;
-- p9.parse("X; param1*0=value1;\r\n"
-- " param1*1*=charset'language'value2;");
--
-- VASSERT_EQ("9.1", 1, p9.getParameterCount());
-- VASSERT_EQ("9.2", "param1", PARAM_NAME(p9, 0));
-- VASSERT_EQ("9.3", "charset", PARAM_CHARSET(p9, 0));
-- VASSERT_EQ("9.4", "value1value2", PARAM_BUFFER(p9, 0));
-+ parameterizedHeaderField p2;
-+ p2.parse("X; param1*0=value1;\r\n"
-+ " param1*1*=charset'language'value2;");
-+
-+ VASSERT_EQ("2.1", 1, p2.getParameterCount());
-+ VASSERT_EQ("2.2", "param1", PARAM_NAME(p2, 0));
-+ VASSERT_EQ("2.3", "charset", PARAM_CHARSET(p2, 0));
-+ VASSERT_EQ("2.4", "value1value2", PARAM_BUFFER(p2, 0));
-
- // Characters prefixed with '%' in a simple (not extended) section
- // should not be decoded
-- parameterizedHeaderField p10;
-- p10.parse("X; param1=val%20ue1");
-+ parameterizedHeaderField p3;
-+ p3.parse("X; param1=val%20ue1");
-
-- VASSERT_EQ("10.1", 1, p10.getParameterCount());
-- VASSERT_EQ("10.2", "param1", PARAM_NAME(p10, 0));
-- VASSERT_EQ("10.3", "val%20ue1", PARAM_VALUE(p10, 0));
-+ VASSERT_EQ("3.1", 1, p3.getParameterCount());
-+ VASSERT_EQ("3.2", "param1", PARAM_NAME(p3, 0));
-+ VASSERT_EQ("3.3", "val%20ue1", PARAM_VALUE(p3, 0));
-
- // Multiple sections + charset specified and encoding
-- parameterizedHeaderField p11;
-- p11.parse("X; param1*0*=charset'language'value1a%20;"
-- " param1*1*=value1b%20;"
-- " param1*2=value1c");
--
-- VASSERT_EQ("11.1", 1, p11.getParameterCount());
-- VASSERT_EQ("11.2", "param1", PARAM_NAME(p11, 0));
-- VASSERT_EQ("11.3", "charset", PARAM_CHARSET(p11, 0));
-- VASSERT_EQ("11.4", "value1a value1b value1c", PARAM_BUFFER(p11, 0));
-+ parameterizedHeaderField p4;
-+ p4.parse("X; param1*0*=charset'language'value1a%20;"
-+ " param1*1*=value1b%20;"
-+ " param1*2=value1c");
-+
-+ VASSERT_EQ("4.1", 1, p4.getParameterCount());
-+ VASSERT_EQ("4.2", "param1", PARAM_NAME(p4, 0));
-+ VASSERT_EQ("4.3", "charset", PARAM_CHARSET(p4, 0));
-+ VASSERT_EQ("4.4", "value1a value1b value1c", PARAM_BUFFER(p4, 0));
-
- // No charset specified: defaults to US-ASCII
-- parameterizedHeaderField p12;
-- p12.parse("X; param1*='language'value1");
-+ parameterizedHeaderField p5;
-+ p5.parse("X; param1*='language'value1");
-
-- VASSERT_EQ("12.1", 1, p12.getParameterCount());
-- VASSERT_EQ("12.2", "param1", PARAM_NAME(p12, 0));
-- VASSERT_EQ("12.3", "us-ascii", PARAM_CHARSET(p12, 0));
-- VASSERT_EQ("12.4", "value1", PARAM_BUFFER(p12, 0));
-+ VASSERT_EQ("5.1", 1, p5.getParameterCount());
-+ VASSERT_EQ("5.2", "param1", PARAM_NAME(p5, 0));
-+ VASSERT_EQ("5.3", "us-ascii", PARAM_CHARSET(p5, 0));
-+ VASSERT_EQ("5.4", "value1", PARAM_BUFFER(p5, 0));
- }
-
- void testGenerate()
-@@ -206,21 +211,24 @@
- p2b.appendParameter(vmime::create <vmime::parameter>("param1", "va\\lue\"1"));
-
- VASSERT_EQ("2b", "F: X; param1=\"va\\\\lue\\\"1\"", p2b.generate());
-+ }
-
-+ void testGenerateRFC2231()
-+ {
- // Extended parameter with charset specifier
-- parameterizedHeaderField p3;
-- p3.appendParameter(vmime::create <vmime::parameter>("param1",
-+ parameterizedHeaderField p1;
-+ p1.appendParameter(vmime::create <vmime::parameter>("param1",
- vmime::word("value 1\xe9", vmime::charset("charset"))));
-
-- VASSERT_EQ("3", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p3.generate());
-+ VASSERT_EQ("1", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p1.generate());
-
- // Value that spans on multiple lines
-- parameterizedHeaderField p4;
-- p4.appendParameter(vmime::create <vmime::parameter>("param1",
-+ parameterizedHeaderField p2;
-+ p2.appendParameter(vmime::create <vmime::parameter>("param1",
- vmime::word("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
- vmime::charset("charset"))));
-
-- VASSERT_EQ("4", "F: X; \r\n "
-+ VASSERT_EQ("2", "F: X; \r\n "
- "param1=abcdefghijklm;\r\n "
- "param1*0*=charset''abc;\r\n "
- "param1*1*=defghijkl;\r\n "
-@@ -228,7 +236,23 @@
- "param1*3*=vwxyzABCD;\r\n "
- "param1*4*=EFGHIJKLM;\r\n "
- "param1*5*=NOPQRSTUV;\r\n "
-- "param1*6*=WXYZ", p4.generate(25)); // max line length = 25
-+ "param1*6*=WXYZ", p2.generate(25)); // max line length = 25
-+
-+ // Non-ASCII parameter value
-+ parameterizedHeaderField p3;
-+ p3.appendParameter(vmime::create <vmime::parameter>("param1",
-+ vmime::word("δσσσσσσσσσσσσσσσσσσσσδσδα δσαδσδσαδσαδασδασ δσαδασδσα δσαδασδσα δασδασδασ δασαχφδδσα 2008.doc",
-+ vmime::charset("utf-8"))));
-+
-+ VASSERT_EQ("3", "F: X; \r\n "
-+ "param1=\" 2008.doc\";param1*0*=utf-8''%CE%B4%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
-+ "param1*1*=%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
-+ "param1*2*=%CE%B4%CF%83%CE%B4%CE%B1%20%CE%B4%CF%83%CE%B1%CE%B4%CF%83%CE%B4%CF;\r\n "
-+ "param1*3*=%83%CE%B1%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20;\r\n "
-+ "param1*4*=%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CF;\r\n "
-+ "param1*5*=%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CE%B1%CF%83;\r\n "
-+ "param1*6*=%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20%CE%B4%CE%B1%CF%83%CE%B1%CF;\r\n "
-+ "param1*7*=%87%CF%86%CE%B4%CE%B4%CF%83%CE%B1%202008.doc", p3.generate(80));
- }
-
- void testNonStandardEncodedParam()
-diff -urN a/tests/parser/pathTest.cpp b/tests/parser/pathTest.cpp
---- a/tests/parser/pathTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/pathTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/pathTest.cpp b/tests/parser/pathTest.cpp
+index 76a944f..b977061 100644
+--- a/tests/parser/pathTest.cpp
++++ b/tests/parser/pathTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6023,9 +7391,10 @@ diff -urN a/tests/parser/pathTest.cpp b/tests/parser/pathTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
---- a/tests/parser/textTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/parser/textTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
+index 152dbc4..5c9b521 100644
+--- a/tests/parser/textTest.cpp
++++ b/tests/parser/textTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6039,9 +7408,10 @@ diff -urN a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/security/digest/md5Test.cpp b/tests/security/digest/md5Test.cpp
---- a/tests/security/digest/md5Test.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/security/digest/md5Test.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/security/digest/md5Test.cpp b/tests/security/digest/md5Test.cpp
+index d2049cd..926e023 100644
+--- a/tests/security/digest/md5Test.cpp
++++ b/tests/security/digest/md5Test.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6055,9 +7425,10 @@ diff -urN a/tests/security/digest/md5Test.cpp b/tests/security/digest/md5Test.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/security/digest/sha1Test.cpp b/tests/security/digest/sha1Test.cpp
---- a/tests/security/digest/sha1Test.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/security/digest/sha1Test.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/security/digest/sha1Test.cpp b/tests/security/digest/sha1Test.cpp
+index 2de0296..3a73a80 100644
+--- a/tests/security/digest/sha1Test.cpp
++++ b/tests/security/digest/sha1Test.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6071,9 +7442,10 @@ diff -urN a/tests/security/digest/sha1Test.cpp b/tests/security/digest/sha1Test.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/testRunner.cpp b/tests/testRunner.cpp
---- a/tests/testRunner.cpp 2008-10-12 11:43:03.000000000 +0200
-+++ b/tests/testRunner.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/testRunner.cpp b/tests/testRunner.cpp
+index e286a10..332a14d 100644
+--- a/tests/testRunner.cpp
++++ b/tests/testRunner.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6087,9 +7459,10 @@ diff -urN a/tests/testRunner.cpp b/tests/testRunner.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/testUtils.cpp b/tests/testUtils.cpp
---- a/tests/testUtils.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/testUtils.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp
+index 0fa816c..456b8ad 100644
+--- a/tests/testUtils.cpp
++++ b/tests/testUtils.cpp
@@ -4,7 +4,7 @@
//
// This program is free software; you can redistribute it and/or
@@ -6099,84 +7472,10 @@ diff -urN a/tests/testUtils.cpp b/tests/testUtils.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -51,6 +51,12 @@
- }
-
-
-+testSocket::size_type testSocket::getBlockSize() const
-+{
-+ return 16384;
-+}
-+
-+
- void testSocket::receive(vmime::string& buffer)
- {
- buffer = m_inBuffer;
-@@ -181,3 +187,61 @@
- return vmime::create <testTimeoutHandler>();
- }
-
-+
-+
-+// Exception helper
-+std::ostream& operator<<(std::ostream& os, const vmime::exception& e)
-+{
-+ os << "* vmime::exceptions::" << e.name() << std::endl;
-+ os << " what = " << e.what() << std::endl;
-+
-+ // More information for special exceptions
-+ if (dynamic_cast <const vmime::exceptions::command_error*>(&e))
-+ {
-+ const vmime::exceptions::command_error& cee =
-+ dynamic_cast <const vmime::exceptions::command_error&>(e);
-+
-+ os << " command = " << cee.command() << std::endl;
-+ os << " response = " << cee.response() << std::endl;
-+ }
-+
-+ if (dynamic_cast <const vmime::exceptions::invalid_response*>(&e))
-+ {
-+ const vmime::exceptions::invalid_response& ir =
-+ dynamic_cast <const vmime::exceptions::invalid_response&>(e);
-+
-+ os << " response = " << ir.response() << std::endl;
-+ }
-+
-+ if (dynamic_cast <const vmime::exceptions::connection_greeting_error*>(&e))
-+ {
-+ const vmime::exceptions::connection_greeting_error& cgee =
-+ dynamic_cast <const vmime::exceptions::connection_greeting_error&>(e);
-+
-+ os << " response = " << cgee.response() << std::endl;
-+ }
-+
-+ if (dynamic_cast <const vmime::exceptions::authentication_error*>(&e))
-+ {
-+ const vmime::exceptions::authentication_error& aee =
-+ dynamic_cast <const vmime::exceptions::authentication_error&>(e);
-+
-+ os << " response = " << aee.response() << std::endl;
-+ }
-+
-+ if (dynamic_cast <const vmime::exceptions::filesystem_exception*>(&e))
-+ {
-+ const vmime::exceptions::filesystem_exception& fse =
-+ dynamic_cast <const vmime::exceptions::filesystem_exception&>(e);
-+
-+ os << " path = " << vmime::platform::getHandler()->
-+ getFileSystemFactory()->pathToString(fse.path()) << std::endl;
-+ }
-+
-+ if (e.other() != NULL)
-+ os << *e.other();
-+
-+ return os;
-+}
-+
-+
-diff -urN a/tests/testUtils.hpp b/tests/testUtils.hpp
---- a/tests/testUtils.hpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/testUtils.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp
+index 42e8879..96daba8 100644
+--- a/tests/testUtils.hpp
++++ b/tests/testUtils.hpp
@@ -4,7 +4,7 @@
//
// This program is free software; you can redistribute it and/or
@@ -6186,26 +7485,10 @@ diff -urN a/tests/testUtils.hpp b/tests/testUtils.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -216,6 +216,8 @@
- int receiveRaw(char* buffer, const int count);
- void sendRaw(const char* buffer, const int count);
-
-+ size_type getBlockSize() const;
-+
- /** Send data to client.
- *
- * @buffer data to send
-@@ -303,3 +305,7 @@
- vmime::ref <vmime::net::timeoutHandler> create();
- };
-
-+
-+// Exception helper
-+std::ostream& operator<<(std::ostream& os, const vmime::exception& e);
-+
-diff -urN a/tests/utility/datetimeUtilsTest.cpp b/tests/utility/datetimeUtilsTest.cpp
---- a/tests/utility/datetimeUtilsTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/datetimeUtilsTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/datetimeUtilsTest.cpp b/tests/utility/datetimeUtilsTest.cpp
+index 89e8118..4fd3e43 100644
+--- a/tests/utility/datetimeUtilsTest.cpp
++++ b/tests/utility/datetimeUtilsTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6219,25 +7502,10 @@ diff -urN a/tests/utility/datetimeUtilsTest.cpp b/tests/utility/datetimeUtilsTes
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -143,10 +143,11 @@
- {
- VASSERT_EQ("1.1", 52, datetimeUtils::getWeekOfYear(2003, 12, 27));
- VASSERT_EQ("1.2", 52, datetimeUtils::getWeekOfYear(2003, 12, 28));
-- VASSERT_EQ("1.3", 1, datetimeUtils::getWeekOfYear(2003, 12, 29));
-- VASSERT_EQ("1.4", 1, datetimeUtils::getWeekOfYear(2004, 1, 4));
-- VASSERT_EQ("1.5", 2, datetimeUtils::getWeekOfYear(2004, 1, 5));
-- VASSERT_EQ("1.6", 2, datetimeUtils::getWeekOfYear(2004, 1, 11));
-+ VASSERT_EQ("1.3", 1, datetimeUtils::getWeekOfYear(2003, 12, 29, true));
-+ VASSERT_EQ("1.4", 53, datetimeUtils::getWeekOfYear(2003, 12, 29, false));
-+ VASSERT_EQ("1.5", 1, datetimeUtils::getWeekOfYear(2004, 1, 4));
-+ VASSERT_EQ("1.6", 2, datetimeUtils::getWeekOfYear(2004, 1, 5));
-+ VASSERT_EQ("1.7", 2, datetimeUtils::getWeekOfYear(2004, 1, 11));
-
- VASSERT_EQ("2.1", 52, datetimeUtils::getWeekOfYear(2004, 12, 26));
- VASSERT_EQ("2.2", 53, datetimeUtils::getWeekOfYear(2004, 12, 27));
-diff -urN a/tests/utility/encoderTest.cpp b/tests/utility/encoderTest.cpp
---- a/tests/utility/encoderTest.cpp 2008-10-12 15:54:01.000000000 +0200
-+++ b/tests/utility/encoderTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/encoderTest.cpp b/tests/utility/encoderTest.cpp
+index 648af78..4e2c9a7 100644
+--- a/tests/utility/encoderTest.cpp
++++ b/tests/utility/encoderTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6251,9 +7519,10 @@ diff -urN a/tests/utility/encoderTest.cpp b/tests/utility/encoderTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/utility/filteredStreamTest.cpp b/tests/utility/filteredStreamTest.cpp
---- a/tests/utility/filteredStreamTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/filteredStreamTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/filteredStreamTest.cpp b/tests/utility/filteredStreamTest.cpp
+index bcc785e..ad26e6c 100644
+--- a/tests/utility/filteredStreamTest.cpp
++++ b/tests/utility/filteredStreamTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6267,17 +7536,10 @@ diff -urN a/tests/utility/filteredStreamTest.cpp b/tests/utility/filteredStreamT
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -175,6 +175,7 @@
- testFilteredOutputStreamHelper<FILTER>("4", "foo\nbar", "foo", "\r\nbar");
- testFilteredOutputStreamHelper<FILTER>("5", "foo\nbar", "foo", "\r", "\nbar");
- testFilteredOutputStreamHelper<FILTER>("6", "foo\nbar", "foo", "\r", "\n", "bar");
-+ testFilteredOutputStreamHelper<FILTER>("7", "foo\nba\nr", "foo\r", "\nba\r\nr");
- }
-
- // stopSequenceFilteredInputStream
-diff -urN a/tests/utility/pathTest.cpp b/tests/utility/pathTest.cpp
---- a/tests/utility/pathTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/pathTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/pathTest.cpp b/tests/utility/pathTest.cpp
+index 6c1e442..1c9b4fb 100644
+--- a/tests/utility/pathTest.cpp
++++ b/tests/utility/pathTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6291,9 +7553,10 @@ diff -urN a/tests/utility/pathTest.cpp b/tests/utility/pathTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/utility/smartPtrTest.cpp b/tests/utility/smartPtrTest.cpp
---- a/tests/utility/smartPtrTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/smartPtrTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/smartPtrTest.cpp b/tests/utility/smartPtrTest.cpp
+index ce0b941..4f68be4 100644
+--- a/tests/utility/smartPtrTest.cpp
++++ b/tests/utility/smartPtrTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6307,9 +7570,10 @@ diff -urN a/tests/utility/smartPtrTest.cpp b/tests/utility/smartPtrTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/utility/stringProxyTest.cpp b/tests/utility/stringProxyTest.cpp
---- a/tests/utility/stringProxyTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/stringProxyTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/stringProxyTest.cpp b/tests/utility/stringProxyTest.cpp
+index e1ba6cb..40648d7 100644
+--- a/tests/utility/stringProxyTest.cpp
++++ b/tests/utility/stringProxyTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6323,9 +7587,10 @@ diff -urN a/tests/utility/stringProxyTest.cpp b/tests/utility/stringProxyTest.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/utility/stringUtilsTest.cpp b/tests/utility/stringUtilsTest.cpp
---- a/tests/utility/stringUtilsTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/stringUtilsTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/stringUtilsTest.cpp b/tests/utility/stringUtilsTest.cpp
+index cbdb688..2144bda 100644
+--- a/tests/utility/stringUtilsTest.cpp
++++ b/tests/utility/stringUtilsTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6339,9 +7604,10 @@ diff -urN a/tests/utility/stringUtilsTest.cpp b/tests/utility/stringUtilsTest.cp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/tests/utility/urlTest.cpp b/tests/utility/urlTest.cpp
---- a/tests/utility/urlTest.cpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/tests/utility/urlTest.cpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/tests/utility/urlTest.cpp b/tests/utility/urlTest.cpp
+index 245657a..66d1d08 100644
+--- a/tests/utility/urlTest.cpp
++++ b/tests/utility/urlTest.cpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6355,9 +7621,10 @@ diff -urN a/tests/utility/urlTest.cpp b/tests/utility/urlTest.cpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/address.hpp b/vmime/address.hpp
---- a/vmime/address.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/address.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/address.hpp b/vmime/address.hpp
+index 31d00f0..188d6ec 100644
+--- a/vmime/address.hpp
++++ b/vmime/address.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6371,9 +7638,10 @@ diff -urN a/vmime/address.hpp b/vmime/address.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/addressList.hpp b/vmime/addressList.hpp
---- a/vmime/addressList.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/addressList.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/addressList.hpp b/vmime/addressList.hpp
+index 7bb7635..2e537c0 100644
+--- a/vmime/addressList.hpp
++++ b/vmime/addressList.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6387,9 +7655,10 @@ diff -urN a/vmime/addressList.hpp b/vmime/addressList.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/attachmentHelper.hpp b/vmime/attachmentHelper.hpp
---- a/vmime/attachmentHelper.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/attachmentHelper.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/attachment.hpp b/vmime/attachment.hpp
+index 0df96ca..f45ad28 100644
+--- a/vmime/attachment.hpp
++++ b/vmime/attachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6403,9 +7672,10 @@ diff -urN a/vmime/attachmentHelper.hpp b/vmime/attachmentHelper.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/attachment.hpp b/vmime/attachment.hpp
---- a/vmime/attachment.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/attachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/attachmentHelper.hpp b/vmime/attachmentHelper.hpp
+index f696b7e..3ce86c8 100644
+--- a/vmime/attachmentHelper.hpp
++++ b/vmime/attachmentHelper.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6419,9 +7689,10 @@ diff -urN a/vmime/attachment.hpp b/vmime/attachment.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/base.hpp b/vmime/base.hpp
---- a/vmime/base.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/base.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/base.hpp b/vmime/base.hpp
+index a25ad7a..ad00d3f 100644
+--- a/vmime/base.hpp
++++ b/vmime/base.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6435,27 +7706,10 @@ diff -urN a/vmime/base.hpp b/vmime/base.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -29,6 +29,7 @@
- #include <vector>
- #include <map>
- #include <sstream>
-+#include <cctype>
- #include <locale>
-
- #include "vmime/config.hpp"
-@@ -47,9 +48,6 @@
-
- // "Null" strings
- extern const string NULL_STRING;
--#if VMIME_WIDE_CHAR_SUPPORT
-- extern const wstring NULL_WSTRING;
--#endif
-
- extern const text NULL_TEXT;
- extern const word NULL_WORD;
-diff -urN a/vmime/body.hpp b/vmime/body.hpp
---- a/vmime/body.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/body.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/body.hpp b/vmime/body.hpp
+index 30ac798..80c1bb5 100644
+--- a/vmime/body.hpp
++++ b/vmime/body.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6469,9 +7723,10 @@ diff -urN a/vmime/body.hpp b/vmime/body.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/bodyPartAttachment.hpp b/vmime/bodyPartAttachment.hpp
---- a/vmime/bodyPartAttachment.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/bodyPartAttachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
+index b1edafc..47c11cb 100644
+--- a/vmime/bodyPart.hpp
++++ b/vmime/bodyPart.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6485,9 +7740,10 @@ diff -urN a/vmime/bodyPartAttachment.hpp b/vmime/bodyPartAttachment.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
---- a/vmime/bodyPart.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/bodyPart.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/bodyPartAttachment.hpp b/vmime/bodyPartAttachment.hpp
+index f805b5a..4e1caa0 100644
+--- a/vmime/bodyPartAttachment.hpp
++++ b/vmime/bodyPartAttachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6501,9 +7757,10 @@ diff -urN a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/charsetConverter.hpp b/vmime/charsetConverter.hpp
---- a/vmime/charsetConverter.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/charsetConverter.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/charset.hpp b/vmime/charset.hpp
+index 0630692..1d25b74 100644
+--- a/vmime/charset.hpp
++++ b/vmime/charset.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6517,9 +7774,10 @@ diff -urN a/vmime/charsetConverter.hpp b/vmime/charsetConverter.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/charset.hpp b/vmime/charset.hpp
---- a/vmime/charset.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/charset.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/charsetConverter.hpp b/vmime/charsetConverter.hpp
+index 36b52f2..14f0dd9 100644
+--- a/vmime/charsetConverter.hpp
++++ b/vmime/charsetConverter.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6533,9 +7791,10 @@ diff -urN a/vmime/charset.hpp b/vmime/charset.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/component.hpp b/vmime/component.hpp
---- a/vmime/component.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/component.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/component.hpp b/vmime/component.hpp
+index 007cfc0..f30a76c 100644
+--- a/vmime/component.hpp
++++ b/vmime/component.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6549,9 +7808,10 @@ diff -urN a/vmime/component.hpp b/vmime/component.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/constants.hpp b/vmime/constants.hpp
---- a/vmime/constants.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/constants.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/constants.hpp b/vmime/constants.hpp
+index 30bc6ef..a1a59da 100644
+--- a/vmime/constants.hpp
++++ b/vmime/constants.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6565,9 +7825,10 @@ diff -urN a/vmime/constants.hpp b/vmime/constants.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/contentDispositionField.hpp b/vmime/contentDispositionField.hpp
---- a/vmime/contentDispositionField.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/contentDispositionField.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/contentDisposition.hpp b/vmime/contentDisposition.hpp
+index 19b13c2..9d1749b 100644
+--- a/vmime/contentDisposition.hpp
++++ b/vmime/contentDisposition.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6581,9 +7842,10 @@ diff -urN a/vmime/contentDispositionField.hpp b/vmime/contentDispositionField.hp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/contentDisposition.hpp b/vmime/contentDisposition.hpp
---- a/vmime/contentDisposition.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/contentDisposition.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/contentDispositionField.hpp b/vmime/contentDispositionField.hpp
+index d4be481..3474604 100644
+--- a/vmime/contentDispositionField.hpp
++++ b/vmime/contentDispositionField.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6597,9 +7859,10 @@ diff -urN a/vmime/contentDisposition.hpp b/vmime/contentDisposition.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
---- a/vmime/contentHandler.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/contentHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
+index 303b08c..aa485f5 100644
+--- a/vmime/contentHandler.hpp
++++ b/vmime/contentHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6613,9 +7876,10 @@ diff -urN a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/contentTypeField.hpp b/vmime/contentTypeField.hpp
---- a/vmime/contentTypeField.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/contentTypeField.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/contentTypeField.hpp b/vmime/contentTypeField.hpp
+index 8712941..bd812e2 100644
+--- a/vmime/contentTypeField.hpp
++++ b/vmime/contentTypeField.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6629,9 +7893,10 @@ diff -urN a/vmime/contentTypeField.hpp b/vmime/contentTypeField.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/dateTime.hpp b/vmime/dateTime.hpp
---- a/vmime/dateTime.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/dateTime.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/dateTime.hpp b/vmime/dateTime.hpp
+index 0776575..8e99640 100644
+--- a/vmime/dateTime.hpp
++++ b/vmime/dateTime.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6645,9 +7910,10 @@ diff -urN a/vmime/dateTime.hpp b/vmime/dateTime.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/defaultAttachment.hpp b/vmime/defaultAttachment.hpp
---- a/vmime/defaultAttachment.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/defaultAttachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/defaultAttachment.hpp b/vmime/defaultAttachment.hpp
+index ea3f59c..0d2c3e5 100644
+--- a/vmime/defaultAttachment.hpp
++++ b/vmime/defaultAttachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6661,9 +7927,10 @@ diff -urN a/vmime/defaultAttachment.hpp b/vmime/defaultAttachment.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/disposition.hpp b/vmime/disposition.hpp
---- a/vmime/disposition.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/disposition.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/disposition.hpp b/vmime/disposition.hpp
+index 44bde21..05bfca2 100644
+--- a/vmime/disposition.hpp
++++ b/vmime/disposition.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6677,9 +7944,10 @@ diff -urN a/vmime/disposition.hpp b/vmime/disposition.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
---- a/vmime/emptyContentHandler.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/emptyContentHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
+index d5aaffd..727c065 100644
+--- a/vmime/emptyContentHandler.hpp
++++ b/vmime/emptyContentHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6693,9 +7961,10 @@ diff -urN a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/encoding.hpp b/vmime/encoding.hpp
---- a/vmime/encoding.hpp 2008-10-12 15:43:38.000000000 +0200
-+++ b/vmime/encoding.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/encoding.hpp b/vmime/encoding.hpp
+index aa99853..fa72dfb 100644
+--- a/vmime/encoding.hpp
++++ b/vmime/encoding.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6709,9 +7978,10 @@ diff -urN a/vmime/encoding.hpp b/vmime/encoding.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/exception.hpp b/vmime/exception.hpp
---- a/vmime/exception.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/exception.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/exception.hpp b/vmime/exception.hpp
+index c96d145..5b68bd7 100644
+--- a/vmime/exception.hpp
++++ b/vmime/exception.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6725,9 +7995,10 @@ diff -urN a/vmime/exception.hpp b/vmime/exception.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/fileAttachment.hpp b/vmime/fileAttachment.hpp
---- a/vmime/fileAttachment.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/fileAttachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/fileAttachment.hpp b/vmime/fileAttachment.hpp
+index dbf1710..0662c8e 100644
+--- a/vmime/fileAttachment.hpp
++++ b/vmime/fileAttachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6741,67 +8012,10 @@ diff -urN a/vmime/fileAttachment.hpp b/vmime/fileAttachment.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -41,9 +41,13 @@
- {
- public:
-
-- fileAttachment(const string& filename, const mediaType& type);
-- fileAttachment(const string& filename, const mediaType& type, const text& desc);
-- fileAttachment(const string& filename, const mediaType& type, const text& desc, const encoding& enc);
-+ fileAttachment(const string& filepath, const mediaType& type);
-+ fileAttachment(const string& filepath, const mediaType& type, const text& desc);
-+ fileAttachment(const string& filepath, const mediaType& type, const text& desc, const encoding& enc);
-+
-+ fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type);
-+ fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type, const text& desc);
-+ fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type, const text& desc, const encoding& enc);
-
- /** Stores information about a file attachment.
- */
-@@ -65,7 +69,7 @@
- *
- * @return file name
- */
-- const string& getFilename() const;
-+ const word& getFilename() const;
-
- /** Set the value of the 'filename' property.
- *
-@@ -73,6 +77,12 @@
- */
- void setFilename(const string& name);
-
-+ /** Set the value of the 'filename' property.
-+ *
-+ * @param name file name
-+ */
-+ void setFilename(const word& name);
-+
- /** Check whether the 'creation-date' property is present.
- *
- * @return true if the 'creation-date' property is set,
-@@ -151,7 +161,7 @@
-
- private:
-
-- string* m_filename;
-+ word* m_filename;
- unsigned int* m_size;
- datetime* m_creationDate;
- datetime* m_modifDate;
-@@ -163,7 +173,8 @@
-
- private:
-
-- void setData(const string& filename);
-+ void setData(const string& filepath);
-+ void setData(ref <utility::inputStream> is);
-
- fileInfo m_fileInfo;
-
-diff -urN a/vmime/generatedMessageAttachment.hpp b/vmime/generatedMessageAttachment.hpp
---- a/vmime/generatedMessageAttachment.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/generatedMessageAttachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/generatedMessageAttachment.hpp b/vmime/generatedMessageAttachment.hpp
+index 47da8a5..58eacbd 100644
+--- a/vmime/generatedMessageAttachment.hpp
++++ b/vmime/generatedMessageAttachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6815,9 +8029,10 @@ diff -urN a/vmime/generatedMessageAttachment.hpp b/vmime/generatedMessageAttachm
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/headerFieldFactory.hpp b/vmime/headerFieldFactory.hpp
---- a/vmime/headerFieldFactory.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/headerFieldFactory.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/header.hpp b/vmime/header.hpp
+index 65236cf..95a9326 100644
+--- a/vmime/header.hpp
++++ b/vmime/header.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6831,9 +8046,10 @@ diff -urN a/vmime/headerFieldFactory.hpp b/vmime/headerFieldFactory.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/headerField.hpp b/vmime/headerField.hpp
---- a/vmime/headerField.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/headerField.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/headerField.hpp b/vmime/headerField.hpp
+index 3d8f26a..50494c9 100644
+--- a/vmime/headerField.hpp
++++ b/vmime/headerField.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6847,9 +8063,10 @@ diff -urN a/vmime/headerField.hpp b/vmime/headerField.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/headerFieldValue.hpp b/vmime/headerFieldValue.hpp
---- a/vmime/headerFieldValue.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/headerFieldValue.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/headerFieldFactory.hpp b/vmime/headerFieldFactory.hpp
+index fc074fb..4b1e567 100644
+--- a/vmime/headerFieldFactory.hpp
++++ b/vmime/headerFieldFactory.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6863,9 +8080,10 @@ diff -urN a/vmime/headerFieldValue.hpp b/vmime/headerFieldValue.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/header.hpp b/vmime/header.hpp
---- a/vmime/header.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/header.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/headerFieldValue.hpp b/vmime/headerFieldValue.hpp
+index b313d4d..adfdeb2 100644
+--- a/vmime/headerFieldValue.hpp
++++ b/vmime/headerFieldValue.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6879,9 +8097,10 @@ diff -urN a/vmime/header.hpp b/vmime/header.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/htmlTextPart.hpp b/vmime/htmlTextPart.hpp
---- a/vmime/htmlTextPart.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/htmlTextPart.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/htmlTextPart.hpp b/vmime/htmlTextPart.hpp
+index 140b4dd..5795eeb 100644
+--- a/vmime/htmlTextPart.hpp
++++ b/vmime/htmlTextPart.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6895,9 +8114,10 @@ diff -urN a/vmime/htmlTextPart.hpp b/vmime/htmlTextPart.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mailboxField.hpp b/vmime/mailboxField.hpp
---- a/vmime/mailboxField.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/mailboxField.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mailbox.hpp b/vmime/mailbox.hpp
+index 2717ec5..2072be8 100644
+--- a/vmime/mailbox.hpp
++++ b/vmime/mailbox.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6911,9 +8131,10 @@ diff -urN a/vmime/mailboxField.hpp b/vmime/mailboxField.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mailboxGroup.hpp b/vmime/mailboxGroup.hpp
---- a/vmime/mailboxGroup.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mailboxGroup.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mailboxField.hpp b/vmime/mailboxField.hpp
+index 754ac26..edd2d28 100644
+--- a/vmime/mailboxField.hpp
++++ b/vmime/mailboxField.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6927,9 +8148,10 @@ diff -urN a/vmime/mailboxGroup.hpp b/vmime/mailboxGroup.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mailbox.hpp b/vmime/mailbox.hpp
---- a/vmime/mailbox.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/mailbox.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mailboxGroup.hpp b/vmime/mailboxGroup.hpp
+index 8038c06..0061d5b 100644
+--- a/vmime/mailboxGroup.hpp
++++ b/vmime/mailboxGroup.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6943,9 +8165,10 @@ diff -urN a/vmime/mailbox.hpp b/vmime/mailbox.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mailboxList.hpp b/vmime/mailboxList.hpp
---- a/vmime/mailboxList.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mailboxList.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mailboxList.hpp b/vmime/mailboxList.hpp
+index 33b2ace..11e4e79 100644
+--- a/vmime/mailboxList.hpp
++++ b/vmime/mailboxList.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6959,9 +8182,10 @@ diff -urN a/vmime/mailboxList.hpp b/vmime/mailboxList.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mdn/MDNHelper.hpp b/vmime/mdn/MDNHelper.hpp
---- a/vmime/mdn/MDNHelper.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mdn/MDNHelper.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mdn/MDNHelper.hpp b/vmime/mdn/MDNHelper.hpp
+index ee9f421..f9764fa 100644
+--- a/vmime/mdn/MDNHelper.hpp
++++ b/vmime/mdn/MDNHelper.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6975,9 +8199,10 @@ diff -urN a/vmime/mdn/MDNHelper.hpp b/vmime/mdn/MDNHelper.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mdn/MDNInfos.hpp b/vmime/mdn/MDNInfos.hpp
---- a/vmime/mdn/MDNInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mdn/MDNInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mdn/MDNInfos.hpp b/vmime/mdn/MDNInfos.hpp
+index 5b7624c..3c52a60 100644
+--- a/vmime/mdn/MDNInfos.hpp
++++ b/vmime/mdn/MDNInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -6991,9 +8216,10 @@ diff -urN a/vmime/mdn/MDNInfos.hpp b/vmime/mdn/MDNInfos.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mdn/receivedMDNInfos.hpp b/vmime/mdn/receivedMDNInfos.hpp
---- a/vmime/mdn/receivedMDNInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mdn/receivedMDNInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mdn/receivedMDNInfos.hpp b/vmime/mdn/receivedMDNInfos.hpp
+index 685bd79..1c258a2 100644
+--- a/vmime/mdn/receivedMDNInfos.hpp
++++ b/vmime/mdn/receivedMDNInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7007,9 +8233,10 @@ diff -urN a/vmime/mdn/receivedMDNInfos.hpp b/vmime/mdn/receivedMDNInfos.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mdn/sendableMDNInfos.hpp b/vmime/mdn/sendableMDNInfos.hpp
---- a/vmime/mdn/sendableMDNInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mdn/sendableMDNInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mdn/sendableMDNInfos.hpp b/vmime/mdn/sendableMDNInfos.hpp
+index 451a467..1f766ea 100644
+--- a/vmime/mdn/sendableMDNInfos.hpp
++++ b/vmime/mdn/sendableMDNInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7023,9 +8250,10 @@ diff -urN a/vmime/mdn/sendableMDNInfos.hpp b/vmime/mdn/sendableMDNInfos.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/mediaType.hpp b/vmime/mediaType.hpp
---- a/vmime/mediaType.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/mediaType.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/mediaType.hpp b/vmime/mediaType.hpp
+index 59d8020..658b21f 100644
+--- a/vmime/mediaType.hpp
++++ b/vmime/mediaType.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7039,9 +8267,10 @@ diff -urN a/vmime/mediaType.hpp b/vmime/mediaType.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/messageAttachment.hpp b/vmime/messageAttachment.hpp
---- a/vmime/messageAttachment.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/messageAttachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/message.hpp b/vmime/message.hpp
+index 449348e..f3be229 100644
+--- a/vmime/message.hpp
++++ b/vmime/message.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7055,9 +8284,10 @@ diff -urN a/vmime/messageAttachment.hpp b/vmime/messageAttachment.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/messageBuilder.hpp b/vmime/messageBuilder.hpp
---- a/vmime/messageBuilder.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/messageBuilder.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/messageAttachment.hpp b/vmime/messageAttachment.hpp
+index 2cc3abc..bdd4e8b 100644
+--- a/vmime/messageAttachment.hpp
++++ b/vmime/messageAttachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7071,9 +8301,10 @@ diff -urN a/vmime/messageBuilder.hpp b/vmime/messageBuilder.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/message.hpp b/vmime/message.hpp
---- a/vmime/message.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/message.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/messageBuilder.hpp b/vmime/messageBuilder.hpp
+index b94fe82..0371288 100644
+--- a/vmime/messageBuilder.hpp
++++ b/vmime/messageBuilder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7087,9 +8318,10 @@ diff -urN a/vmime/message.hpp b/vmime/message.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/messageId.hpp b/vmime/messageId.hpp
---- a/vmime/messageId.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/messageId.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/messageId.hpp b/vmime/messageId.hpp
+index 60f62ad..3686b11 100644
+--- a/vmime/messageId.hpp
++++ b/vmime/messageId.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7103,9 +8335,10 @@ diff -urN a/vmime/messageId.hpp b/vmime/messageId.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/messageIdSequence.hpp b/vmime/messageIdSequence.hpp
---- a/vmime/messageIdSequence.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/messageIdSequence.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/messageIdSequence.hpp b/vmime/messageIdSequence.hpp
+index e1989fe..5dfb840 100644
+--- a/vmime/messageIdSequence.hpp
++++ b/vmime/messageIdSequence.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7119,9 +8352,10 @@ diff -urN a/vmime/messageIdSequence.hpp b/vmime/messageIdSequence.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/messageParser.hpp b/vmime/messageParser.hpp
---- a/vmime/messageParser.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/messageParser.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/messageParser.hpp b/vmime/messageParser.hpp
+index 211fac7..c7d5646 100644
+--- a/vmime/messageParser.hpp
++++ b/vmime/messageParser.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7135,9 +8369,10 @@ diff -urN a/vmime/messageParser.hpp b/vmime/messageParser.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/misc/importanceHelper.hpp b/vmime/misc/importanceHelper.hpp
---- a/vmime/misc/importanceHelper.hpp 2008-10-12 11:12:23.000000000 +0200
-+++ b/vmime/misc/importanceHelper.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/misc/importanceHelper.hpp b/vmime/misc/importanceHelper.hpp
+index a139ffb..37f3497 100644
+--- a/vmime/misc/importanceHelper.hpp
++++ b/vmime/misc/importanceHelper.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7151,9 +8386,10 @@ diff -urN a/vmime/misc/importanceHelper.hpp b/vmime/misc/importanceHelper.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/connectionInfos.hpp b/vmime/net/connectionInfos.hpp
---- a/vmime/net/connectionInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/connectionInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/connectionInfos.hpp b/vmime/net/connectionInfos.hpp
+index 302aecb..03f01b9 100644
+--- a/vmime/net/connectionInfos.hpp
++++ b/vmime/net/connectionInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7167,9 +8403,10 @@ diff -urN a/vmime/net/connectionInfos.hpp b/vmime/net/connectionInfos.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/defaultConnectionInfos.hpp b/vmime/net/defaultConnectionInfos.hpp
---- a/vmime/net/defaultConnectionInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/defaultConnectionInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/defaultConnectionInfos.hpp b/vmime/net/defaultConnectionInfos.hpp
+index 0c99684..518b4bc 100644
+--- a/vmime/net/defaultConnectionInfos.hpp
++++ b/vmime/net/defaultConnectionInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7183,9 +8420,10 @@ diff -urN a/vmime/net/defaultConnectionInfos.hpp b/vmime/net/defaultConnectionIn
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/events.hpp b/vmime/net/events.hpp
---- a/vmime/net/events.hpp 2008-10-12 11:25:06.000000000 +0200
-+++ b/vmime/net/events.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/events.hpp b/vmime/net/events.hpp
+index 66ce207..be05c6e 100644
+--- a/vmime/net/events.hpp
++++ b/vmime/net/events.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7199,9 +8437,10 @@ diff -urN a/vmime/net/events.hpp b/vmime/net/events.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/folder.hpp b/vmime/net/folder.hpp
---- a/vmime/net/folder.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/folder.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/folder.hpp b/vmime/net/folder.hpp
+index 0ae33c5..b20e9c9 100644
+--- a/vmime/net/folder.hpp
++++ b/vmime/net/folder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7215,9 +8454,10 @@ diff -urN a/vmime/net/folder.hpp b/vmime/net/folder.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp
---- a/vmime/net/imap/IMAPConnection.hpp 2008-10-12 11:28:12.000000000 +0200
-+++ b/vmime/net/imap/IMAPConnection.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp
+index 865a4df..147c4df 100644
+--- a/vmime/net/imap/IMAPConnection.hpp
++++ b/vmime/net/imap/IMAPConnection.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7231,18 +8471,10 @@ diff -urN a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -96,6 +96,8 @@
- bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
-
-+ ref <const socket> getSocket() const;
-+
- private:
-
- void authenticate();
-diff -urN a/vmime/net/imap/IMAPFolder.hpp b/vmime/net/imap/IMAPFolder.hpp
---- a/vmime/net/imap/IMAPFolder.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPFolder.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPFolder.hpp b/vmime/net/imap/IMAPFolder.hpp
+index 434653a..dec3878 100644
+--- a/vmime/net/imap/IMAPFolder.hpp
++++ b/vmime/net/imap/IMAPFolder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7256,9 +8488,10 @@ diff -urN a/vmime/net/imap/IMAPFolder.hpp b/vmime/net/imap/IMAPFolder.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
---- a/vmime/net/imap/IMAPMessage.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPMessage.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
+index caab819..690e5e2 100644
+--- a/vmime/net/imap/IMAPMessage.hpp
++++ b/vmime/net/imap/IMAPMessage.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7272,9 +8505,10 @@ diff -urN a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp
---- a/vmime/net/imap/IMAPParser.hpp 2008-10-12 15:50:19.000000000 +0200
-+++ b/vmime/net/imap/IMAPParser.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp
+index b307957..0f3e9ec 100644
+--- a/vmime/net/imap/IMAPParser.hpp
++++ b/vmime/net/imap/IMAPParser.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7288,9 +8522,10 @@ diff -urN a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPServiceInfos.hpp b/vmime/net/imap/IMAPServiceInfos.hpp
---- a/vmime/net/imap/IMAPServiceInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPServiceInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPSStore.hpp b/vmime/net/imap/IMAPSStore.hpp
+index efd8126..5772ad9 100644
+--- a/vmime/net/imap/IMAPSStore.hpp
++++ b/vmime/net/imap/IMAPSStore.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7304,9 +8539,10 @@ diff -urN a/vmime/net/imap/IMAPServiceInfos.hpp b/vmime/net/imap/IMAPServiceInfo
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPSStore.hpp b/vmime/net/imap/IMAPSStore.hpp
---- a/vmime/net/imap/IMAPSStore.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPSStore.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPServiceInfos.hpp b/vmime/net/imap/IMAPServiceInfos.hpp
+index 82b8c15..7286b3a 100644
+--- a/vmime/net/imap/IMAPServiceInfos.hpp
++++ b/vmime/net/imap/IMAPServiceInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7320,9 +8556,10 @@ diff -urN a/vmime/net/imap/IMAPSStore.hpp b/vmime/net/imap/IMAPSStore.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPStore.hpp b/vmime/net/imap/IMAPStore.hpp
---- a/vmime/net/imap/IMAPStore.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPStore.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPStore.hpp b/vmime/net/imap/IMAPStore.hpp
+index bf8235e..ebff2e6 100644
+--- a/vmime/net/imap/IMAPStore.hpp
++++ b/vmime/net/imap/IMAPStore.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7336,9 +8573,10 @@ diff -urN a/vmime/net/imap/IMAPStore.hpp b/vmime/net/imap/IMAPStore.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPTag.hpp b/vmime/net/imap/IMAPTag.hpp
---- a/vmime/net/imap/IMAPTag.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPTag.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPTag.hpp b/vmime/net/imap/IMAPTag.hpp
+index 04c8b94..cab2d48 100644
+--- a/vmime/net/imap/IMAPTag.hpp
++++ b/vmime/net/imap/IMAPTag.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7352,9 +8590,10 @@ diff -urN a/vmime/net/imap/IMAPTag.hpp b/vmime/net/imap/IMAPTag.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/imap/IMAPUtils.hpp b/vmime/net/imap/IMAPUtils.hpp
---- a/vmime/net/imap/IMAPUtils.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/imap/IMAPUtils.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/imap/IMAPUtils.hpp b/vmime/net/imap/IMAPUtils.hpp
+index 181bd46..d1ed5c8 100644
+--- a/vmime/net/imap/IMAPUtils.hpp
++++ b/vmime/net/imap/IMAPUtils.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7368,9 +8607,10 @@ diff -urN a/vmime/net/imap/IMAPUtils.hpp b/vmime/net/imap/IMAPUtils.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/format/courierMaildirFormat.hpp b/vmime/net/maildir/format/courierMaildirFormat.hpp
---- a/vmime/net/maildir/format/courierMaildirFormat.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/format/courierMaildirFormat.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/format/courierMaildirFormat.hpp b/vmime/net/maildir/format/courierMaildirFormat.hpp
+index b533abc..e8036d5 100644
+--- a/vmime/net/maildir/format/courierMaildirFormat.hpp
++++ b/vmime/net/maildir/format/courierMaildirFormat.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7384,9 +8624,10 @@ diff -urN a/vmime/net/maildir/format/courierMaildirFormat.hpp b/vmime/net/maildi
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/format/kmailMaildirFormat.hpp b/vmime/net/maildir/format/kmailMaildirFormat.hpp
---- a/vmime/net/maildir/format/kmailMaildirFormat.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/format/kmailMaildirFormat.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/format/kmailMaildirFormat.hpp b/vmime/net/maildir/format/kmailMaildirFormat.hpp
+index 0dfb964..e5f7222 100644
+--- a/vmime/net/maildir/format/kmailMaildirFormat.hpp
++++ b/vmime/net/maildir/format/kmailMaildirFormat.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7400,9 +8641,10 @@ diff -urN a/vmime/net/maildir/format/kmailMaildirFormat.hpp b/vmime/net/maildir/
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/maildirFolder.hpp b/vmime/net/maildir/maildirFolder.hpp
---- a/vmime/net/maildir/maildirFolder.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/maildirFolder.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/maildirFolder.hpp b/vmime/net/maildir/maildirFolder.hpp
+index c0165fa..7474b1a 100644
+--- a/vmime/net/maildir/maildirFolder.hpp
++++ b/vmime/net/maildir/maildirFolder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7416,9 +8658,10 @@ diff -urN a/vmime/net/maildir/maildirFolder.hpp b/vmime/net/maildir/maildirFolde
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/maildirFormat.hpp b/vmime/net/maildir/maildirFormat.hpp
---- a/vmime/net/maildir/maildirFormat.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/maildirFormat.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/maildirFormat.hpp b/vmime/net/maildir/maildirFormat.hpp
+index e00dfdf..a47c854 100644
+--- a/vmime/net/maildir/maildirFormat.hpp
++++ b/vmime/net/maildir/maildirFormat.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7432,18 +8675,10 @@ diff -urN a/vmime/net/maildir/maildirFormat.hpp b/vmime/net/maildir/maildirForma
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -55,7 +55,7 @@
-
- private:
-
-- ref <maildirStore> m_store;
-+ weak_ref <maildirStore> m_store;
- };
-
-
-diff -urN a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp
---- a/vmime/net/maildir/maildirMessage.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/maildirMessage.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp
+index 067bdcb..ba3c88e 100644
+--- a/vmime/net/maildir/maildirMessage.hpp
++++ b/vmime/net/maildir/maildirMessage.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7457,9 +8692,10 @@ diff -urN a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMess
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/maildirServiceInfos.hpp b/vmime/net/maildir/maildirServiceInfos.hpp
---- a/vmime/net/maildir/maildirServiceInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/maildirServiceInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/maildirServiceInfos.hpp b/vmime/net/maildir/maildirServiceInfos.hpp
+index 88ac754..f3b0df8 100644
+--- a/vmime/net/maildir/maildirServiceInfos.hpp
++++ b/vmime/net/maildir/maildirServiceInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7473,9 +8709,10 @@ diff -urN a/vmime/net/maildir/maildirServiceInfos.hpp b/vmime/net/maildir/maildi
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/maildirStore.hpp b/vmime/net/maildir/maildirStore.hpp
---- a/vmime/net/maildir/maildirStore.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/maildirStore.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/maildirStore.hpp b/vmime/net/maildir/maildirStore.hpp
+index 0c78943..40ecec3 100644
+--- a/vmime/net/maildir/maildirStore.hpp
++++ b/vmime/net/maildir/maildirStore.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7489,9 +8726,10 @@ diff -urN a/vmime/net/maildir/maildirStore.hpp b/vmime/net/maildir/maildirStore.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/maildir/maildirUtils.hpp b/vmime/net/maildir/maildirUtils.hpp
---- a/vmime/net/maildir/maildirUtils.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/maildir/maildirUtils.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/maildir/maildirUtils.hpp b/vmime/net/maildir/maildirUtils.hpp
+index 8c9920b..c4aa0b6 100644
+--- a/vmime/net/maildir/maildirUtils.hpp
++++ b/vmime/net/maildir/maildirUtils.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7505,9 +8743,10 @@ diff -urN a/vmime/net/maildir/maildirUtils.hpp b/vmime/net/maildir/maildirUtils.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/message.hpp b/vmime/net/message.hpp
---- a/vmime/net/message.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/message.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp
+index 2d8dc1a..a0cc1da 100644
+--- a/vmime/net/message.hpp
++++ b/vmime/net/message.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7521,9 +8760,10 @@ diff -urN a/vmime/net/message.hpp b/vmime/net/message.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/pop3/POP3Folder.hpp b/vmime/net/pop3/POP3Folder.hpp
---- a/vmime/net/pop3/POP3Folder.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/pop3/POP3Folder.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/pop3/POP3Folder.hpp b/vmime/net/pop3/POP3Folder.hpp
+index 951abc5..abaa8eb 100644
+--- a/vmime/net/pop3/POP3Folder.hpp
++++ b/vmime/net/pop3/POP3Folder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7537,9 +8777,10 @@ diff -urN a/vmime/net/pop3/POP3Folder.hpp b/vmime/net/pop3/POP3Folder.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
---- a/vmime/net/pop3/POP3Message.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/pop3/POP3Message.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
+index ccfa089..5dbea3f 100644
+--- a/vmime/net/pop3/POP3Message.hpp
++++ b/vmime/net/pop3/POP3Message.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7553,9 +8794,10 @@ diff -urN a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/pop3/POP3ServiceInfos.hpp b/vmime/net/pop3/POP3ServiceInfos.hpp
---- a/vmime/net/pop3/POP3ServiceInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/pop3/POP3ServiceInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/pop3/POP3SStore.hpp b/vmime/net/pop3/POP3SStore.hpp
+index 9144f95..1f98bfa 100644
+--- a/vmime/net/pop3/POP3SStore.hpp
++++ b/vmime/net/pop3/POP3SStore.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7569,9 +8811,10 @@ diff -urN a/vmime/net/pop3/POP3ServiceInfos.hpp b/vmime/net/pop3/POP3ServiceInfo
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/pop3/POP3SStore.hpp b/vmime/net/pop3/POP3SStore.hpp
---- a/vmime/net/pop3/POP3SStore.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/pop3/POP3SStore.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/pop3/POP3ServiceInfos.hpp b/vmime/net/pop3/POP3ServiceInfos.hpp
+index 23bc81d..d2dff58 100644
+--- a/vmime/net/pop3/POP3ServiceInfos.hpp
++++ b/vmime/net/pop3/POP3ServiceInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7585,9 +8828,10 @@ diff -urN a/vmime/net/pop3/POP3SStore.hpp b/vmime/net/pop3/POP3SStore.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/pop3/POP3Store.hpp b/vmime/net/pop3/POP3Store.hpp
---- a/vmime/net/pop3/POP3Store.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/pop3/POP3Store.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/pop3/POP3Store.hpp b/vmime/net/pop3/POP3Store.hpp
+index 55c0ce4..16fcce4 100644
+--- a/vmime/net/pop3/POP3Store.hpp
++++ b/vmime/net/pop3/POP3Store.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7601,9 +8845,10 @@ diff -urN a/vmime/net/pop3/POP3Store.hpp b/vmime/net/pop3/POP3Store.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/pop3/POP3Utils.hpp b/vmime/net/pop3/POP3Utils.hpp
---- a/vmime/net/pop3/POP3Utils.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/pop3/POP3Utils.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/pop3/POP3Utils.hpp b/vmime/net/pop3/POP3Utils.hpp
+index 51bb527..2640c0e 100644
+--- a/vmime/net/pop3/POP3Utils.hpp
++++ b/vmime/net/pop3/POP3Utils.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7617,9 +8862,10 @@ diff -urN a/vmime/net/pop3/POP3Utils.hpp b/vmime/net/pop3/POP3Utils.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/securedConnectionInfos.hpp b/vmime/net/securedConnectionInfos.hpp
---- a/vmime/net/securedConnectionInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/securedConnectionInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/securedConnectionInfos.hpp b/vmime/net/securedConnectionInfos.hpp
+index 880e6c9..b27d30b 100644
+--- a/vmime/net/securedConnectionInfos.hpp
++++ b/vmime/net/securedConnectionInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7633,9 +8879,10 @@ diff -urN a/vmime/net/securedConnectionInfos.hpp b/vmime/net/securedConnectionIn
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/sendmail/sendmailServiceInfos.hpp b/vmime/net/sendmail/sendmailServiceInfos.hpp
---- a/vmime/net/sendmail/sendmailServiceInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/sendmail/sendmailServiceInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/sendmail/sendmailServiceInfos.hpp b/vmime/net/sendmail/sendmailServiceInfos.hpp
+index 4c2df63..a86a4dd 100644
+--- a/vmime/net/sendmail/sendmailServiceInfos.hpp
++++ b/vmime/net/sendmail/sendmailServiceInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7649,9 +8896,10 @@ diff -urN a/vmime/net/sendmail/sendmailServiceInfos.hpp b/vmime/net/sendmail/sen
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/sendmail/sendmailTransport.hpp b/vmime/net/sendmail/sendmailTransport.hpp
---- a/vmime/net/sendmail/sendmailTransport.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/sendmail/sendmailTransport.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/sendmail/sendmailTransport.hpp b/vmime/net/sendmail/sendmailTransport.hpp
+index 8383e11..5ff8cf2 100644
+--- a/vmime/net/sendmail/sendmailTransport.hpp
++++ b/vmime/net/sendmail/sendmailTransport.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7665,9 +8913,10 @@ diff -urN a/vmime/net/sendmail/sendmailTransport.hpp b/vmime/net/sendmail/sendma
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/serviceFactory.hpp b/vmime/net/serviceFactory.hpp
---- a/vmime/net/serviceFactory.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/serviceFactory.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/service.hpp b/vmime/net/service.hpp
+index c260f2a..5205fee 100644
+--- a/vmime/net/service.hpp
++++ b/vmime/net/service.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7681,9 +8930,10 @@ diff -urN a/vmime/net/serviceFactory.hpp b/vmime/net/serviceFactory.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/service.hpp b/vmime/net/service.hpp
---- a/vmime/net/service.hpp 2008-10-12 10:58:53.000000000 +0200
-+++ b/vmime/net/service.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/serviceFactory.hpp b/vmime/net/serviceFactory.hpp
+index 730df2e..0362b47 100644
+--- a/vmime/net/serviceFactory.hpp
++++ b/vmime/net/serviceFactory.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7697,9 +8947,10 @@ diff -urN a/vmime/net/service.hpp b/vmime/net/service.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/serviceInfos.hpp b/vmime/net/serviceInfos.hpp
---- a/vmime/net/serviceInfos.hpp 2008-10-12 10:58:26.000000000 +0200
-+++ b/vmime/net/serviceInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/serviceInfos.hpp b/vmime/net/serviceInfos.hpp
+index 745f85e..eac77a1 100644
+--- a/vmime/net/serviceInfos.hpp
++++ b/vmime/net/serviceInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7713,9 +8964,10 @@ diff -urN a/vmime/net/serviceInfos.hpp b/vmime/net/serviceInfos.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/session.hpp b/vmime/net/session.hpp
---- a/vmime/net/session.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/session.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/session.hpp b/vmime/net/session.hpp
+index 3eb4cfb..426fe7a 100644
+--- a/vmime/net/session.hpp
++++ b/vmime/net/session.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7729,9 +8981,10 @@ diff -urN a/vmime/net/session.hpp b/vmime/net/session.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/smtp/SMTPResponse.hpp b/vmime/net/smtp/SMTPResponse.hpp
---- a/vmime/net/smtp/SMTPResponse.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/smtp/SMTPResponse.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/smtp/SMTPResponse.hpp b/vmime/net/smtp/SMTPResponse.hpp
+index 313f6a3..5ef4f09 100644
+--- a/vmime/net/smtp/SMTPResponse.hpp
++++ b/vmime/net/smtp/SMTPResponse.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7745,9 +8998,10 @@ diff -urN a/vmime/net/smtp/SMTPResponse.hpp b/vmime/net/smtp/SMTPResponse.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/smtp/SMTPServiceInfos.hpp b/vmime/net/smtp/SMTPServiceInfos.hpp
---- a/vmime/net/smtp/SMTPServiceInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/smtp/SMTPServiceInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/smtp/SMTPSTransport.hpp b/vmime/net/smtp/SMTPSTransport.hpp
+index 4922ba2..393a4f5 100644
+--- a/vmime/net/smtp/SMTPSTransport.hpp
++++ b/vmime/net/smtp/SMTPSTransport.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7761,9 +9015,10 @@ diff -urN a/vmime/net/smtp/SMTPServiceInfos.hpp b/vmime/net/smtp/SMTPServiceInfo
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/smtp/SMTPSTransport.hpp b/vmime/net/smtp/SMTPSTransport.hpp
---- a/vmime/net/smtp/SMTPSTransport.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/smtp/SMTPSTransport.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/smtp/SMTPServiceInfos.hpp b/vmime/net/smtp/SMTPServiceInfos.hpp
+index 15ea735..61f5aa8 100644
+--- a/vmime/net/smtp/SMTPServiceInfos.hpp
++++ b/vmime/net/smtp/SMTPServiceInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7777,9 +9032,10 @@ diff -urN a/vmime/net/smtp/SMTPSTransport.hpp b/vmime/net/smtp/SMTPSTransport.hp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/smtp/SMTPTransport.hpp b/vmime/net/smtp/SMTPTransport.hpp
---- a/vmime/net/smtp/SMTPTransport.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/smtp/SMTPTransport.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/smtp/SMTPTransport.hpp b/vmime/net/smtp/SMTPTransport.hpp
+index de0092e..050fedd 100644
+--- a/vmime/net/smtp/SMTPTransport.hpp
++++ b/vmime/net/smtp/SMTPTransport.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7793,9 +9049,10 @@ diff -urN a/vmime/net/smtp/SMTPTransport.hpp b/vmime/net/smtp/SMTPTransport.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/socket.hpp b/vmime/net/socket.hpp
---- a/vmime/net/socket.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/socket.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/socket.hpp b/vmime/net/socket.hpp
+index 88e1f3c..9b0319c 100644
+--- a/vmime/net/socket.hpp
++++ b/vmime/net/socket.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7809,46 +9066,10 @@ diff -urN a/vmime/net/socket.hpp b/vmime/net/socket.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -41,6 +41,11 @@
-
- virtual ~socket() { }
-
-+ /** Type used for lengths in streams.
-+ */
-+ typedef int size_type;
-+
-+
- /** Connect to the specified address and port.
- *
- * @param address server address (this can be a full qualified domain name
-@@ -71,7 +76,7 @@
- * @param count maximum number of bytes to receive (size of buffer)
- * @return number of bytes received/written into output buffer
- */
-- virtual int receiveRaw(char* buffer, const int count) = 0;
-+ virtual int receiveRaw(char* buffer, const size_type count) = 0;
-
- /** Send (text) data to the socket.
- *
-@@ -84,7 +89,14 @@
- * @param buffer data to send
- * @param count number of bytes to send (size of buffer)
- */
-- virtual void sendRaw(const char* buffer, const int count) = 0;
-+ virtual void sendRaw(const char* buffer, const size_type count) = 0;
-+
-+ /** Return the preferred maximum block size when reading
-+ * from or writing to this stream.
-+ *
-+ * @return block size, in bytes
-+ */
-+ virtual size_type getBlockSize() const = 0;
-
- protected:
-
-diff -urN a/vmime/net/store.hpp b/vmime/net/store.hpp
---- a/vmime/net/store.hpp 2008-10-12 11:29:46.000000000 +0200
-+++ b/vmime/net/store.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/store.hpp b/vmime/net/store.hpp
+index e60721b..1c9ac1c 100644
+--- a/vmime/net/store.hpp
++++ b/vmime/net/store.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7862,9 +9083,10 @@ diff -urN a/vmime/net/store.hpp b/vmime/net/store.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/timeoutHandler.hpp b/vmime/net/timeoutHandler.hpp
---- a/vmime/net/timeoutHandler.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/timeoutHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/timeoutHandler.hpp b/vmime/net/timeoutHandler.hpp
+index 0877ec1..6a20665 100644
+--- a/vmime/net/timeoutHandler.hpp
++++ b/vmime/net/timeoutHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7878,9 +9100,10 @@ diff -urN a/vmime/net/timeoutHandler.hpp b/vmime/net/timeoutHandler.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
---- a/vmime/net/tls/TLSSecuredConnectionInfos.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/tls/TLSSecuredConnectionInfos.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
+index 5451633..d0e4087 100644
+--- a/vmime/net/tls/TLSSecuredConnectionInfos.hpp
++++ b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7894,9 +9117,10 @@ diff -urN a/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/vmime/net/tls/TLSSecur
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/tls/TLSSession.hpp b/vmime/net/tls/TLSSession.hpp
---- a/vmime/net/tls/TLSSession.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/tls/TLSSession.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/tls/TLSSession.hpp b/vmime/net/tls/TLSSession.hpp
+index 639babe..e6bd64f 100644
+--- a/vmime/net/tls/TLSSession.hpp
++++ b/vmime/net/tls/TLSSession.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7910,9 +9134,10 @@ diff -urN a/vmime/net/tls/TLSSession.hpp b/vmime/net/tls/TLSSession.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/net/tls/TLSSocket.hpp b/vmime/net/tls/TLSSocket.hpp
---- a/vmime/net/tls/TLSSocket.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/net/tls/TLSSocket.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/tls/TLSSocket.hpp b/vmime/net/tls/TLSSocket.hpp
+index 1c1d324..5112550 100644
+--- a/vmime/net/tls/TLSSocket.hpp
++++ b/vmime/net/tls/TLSSocket.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7926,24 +9151,10 @@ diff -urN a/vmime/net/tls/TLSSocket.hpp b/vmime/net/tls/TLSSocket.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -84,10 +84,12 @@
- bool isConnected() const;
-
- void receive(string& buffer);
-- int receiveRaw(char* buffer, const int count);
-+ size_type receiveRaw(char* buffer, const size_type count);
-
- void send(const string& buffer);
-- void sendRaw(const char* buffer, const int count);
-+ void sendRaw(const char* buffer, const size_type count);
-+
-+ size_type getBlockSize() const;
-
- private:
-
-diff -urN a/vmime/net/transport.hpp b/vmime/net/transport.hpp
---- a/vmime/net/transport.hpp 2008-10-12 11:29:56.000000000 +0200
-+++ b/vmime/net/transport.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/net/transport.hpp b/vmime/net/transport.hpp
+index 4ece804..45dc5a5 100644
+--- a/vmime/net/transport.hpp
++++ b/vmime/net/transport.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7957,9 +9168,10 @@ diff -urN a/vmime/net/transport.hpp b/vmime/net/transport.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/object.hpp b/vmime/object.hpp
---- a/vmime/object.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/object.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/object.hpp b/vmime/object.hpp
+index 2782189..2a33aed 100644
+--- a/vmime/object.hpp
++++ b/vmime/object.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7973,9 +9185,10 @@ diff -urN a/vmime/object.hpp b/vmime/object.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/options.hpp b/vmime/options.hpp
---- a/vmime/options.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/options.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/options.hpp b/vmime/options.hpp
+index 5edb051..7e96c2b 100644
+--- a/vmime/options.hpp
++++ b/vmime/options.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -7989,9 +9202,10 @@ diff -urN a/vmime/options.hpp b/vmime/options.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/parameter.hpp b/vmime/parameter.hpp
---- a/vmime/parameter.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/parameter.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/parameter.hpp b/vmime/parameter.hpp
+index 2d21cd1..e1b13a1 100644
+--- a/vmime/parameter.hpp
++++ b/vmime/parameter.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8005,9 +9219,10 @@ diff -urN a/vmime/parameter.hpp b/vmime/parameter.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.hpp
---- a/vmime/parameterizedHeaderField.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/parameterizedHeaderField.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.hpp
+index c2c8502..2940ca3 100644
+--- a/vmime/parameterizedHeaderField.hpp
++++ b/vmime/parameterizedHeaderField.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8021,9 +9236,10 @@ diff -urN a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/parsedMessageAttachment.hpp b/vmime/parsedMessageAttachment.hpp
---- a/vmime/parsedMessageAttachment.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/parsedMessageAttachment.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/parsedMessageAttachment.hpp b/vmime/parsedMessageAttachment.hpp
+index e66c6c0..abc2ff5 100644
+--- a/vmime/parsedMessageAttachment.hpp
++++ b/vmime/parsedMessageAttachment.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8037,9 +9253,10 @@ diff -urN a/vmime/parsedMessageAttachment.hpp b/vmime/parsedMessageAttachment.hp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/parserHelpers.hpp b/vmime/parserHelpers.hpp
---- a/vmime/parserHelpers.hpp 2008-10-12 10:57:27.000000000 +0200
-+++ b/vmime/parserHelpers.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/parserHelpers.hpp b/vmime/parserHelpers.hpp
+index 9be6e4a..9b075f7 100644
+--- a/vmime/parserHelpers.hpp
++++ b/vmime/parserHelpers.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8053,9 +9270,10 @@ diff -urN a/vmime/parserHelpers.hpp b/vmime/parserHelpers.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/path.hpp b/vmime/path.hpp
---- a/vmime/path.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/path.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/path.hpp b/vmime/path.hpp
+index aa0d8cb..beaa72b 100644
+--- a/vmime/path.hpp
++++ b/vmime/path.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8069,9 +9287,10 @@ diff -urN a/vmime/path.hpp b/vmime/path.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/plainTextPart.hpp b/vmime/plainTextPart.hpp
---- a/vmime/plainTextPart.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/plainTextPart.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/plainTextPart.hpp b/vmime/plainTextPart.hpp
+index c9419b5..72c12ac 100644
+--- a/vmime/plainTextPart.hpp
++++ b/vmime/plainTextPart.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8085,9 +9304,10 @@ diff -urN a/vmime/plainTextPart.hpp b/vmime/plainTextPart.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/platform.hpp b/vmime/platform.hpp
---- a/vmime/platform.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/platform.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platform.hpp b/vmime/platform.hpp
+index 293320f..d390571 100644
+--- a/vmime/platform.hpp
++++ b/vmime/platform.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8101,44 +9321,10 @@ diff -urN a/vmime/platform.hpp b/vmime/platform.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -108,7 +108,7 @@
- *
- * @return socket factory
- */
-- virtual ref <net::socketFactory> getSocketFactory() const = 0;
-+ virtual ref <net::socketFactory> getSocketFactory() = 0;
- #endif
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-@@ -116,14 +116,14 @@
- *
- * @return file-system factory
- */
-- virtual utility::fileSystemFactory* getFileSystemFactory() const = 0;
-+ virtual ref <utility::fileSystemFactory> getFileSystemFactory() = 0;
-
- /** Return a pointer to a factory that creates child process objects,
- * which are used to spawn processes (run executable files).
- *
- * @return child process factory
- */
-- virtual utility::childProcessFactory* getChildProcessFactory() const = 0;
-+ virtual ref <utility::childProcessFactory> getChildProcessFactory() = 0;
- #endif
-
- };
-@@ -135,7 +135,7 @@
- sm_handler = vmime::create <TYPE>();
- }
-
-- static ref <const handler> getHandler()
-+ static ref <handler> getHandler()
- {
- if (!sm_handler)
- throw exceptions::no_platform_handler();
-diff -urN a/vmime/platforms/posix/posixChildProcess.hpp b/vmime/platforms/posix/posixChildProcess.hpp
---- a/vmime/platforms/posix/posixChildProcess.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/platforms/posix/posixChildProcess.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/posix/posixChildProcess.hpp b/vmime/platforms/posix/posixChildProcess.hpp
+index e689065..c25aaca 100644
+--- a/vmime/platforms/posix/posixChildProcess.hpp
++++ b/vmime/platforms/posix/posixChildProcess.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8152,9 +9338,10 @@ diff -urN a/vmime/platforms/posix/posixChildProcess.hpp b/vmime/platforms/posix/
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/platforms/posix/posixFile.hpp b/vmime/platforms/posix/posixFile.hpp
---- a/vmime/platforms/posix/posixFile.hpp 2008-10-12 11:41:34.000000000 +0200
-+++ b/vmime/platforms/posix/posixFile.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/posix/posixFile.hpp b/vmime/platforms/posix/posixFile.hpp
+index b7296c6..70986df 100644
+--- a/vmime/platforms/posix/posixFile.hpp
++++ b/vmime/platforms/posix/posixFile.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8168,9 +9355,10 @@ diff -urN a/vmime/platforms/posix/posixFile.hpp b/vmime/platforms/posix/posixFil
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp
---- a/vmime/platforms/posix/posixHandler.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/platforms/posix/posixHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp
+index bc78719..397a5dd 100644
+--- a/vmime/platforms/posix/posixHandler.hpp
++++ b/vmime/platforms/posix/posixHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8184,37 +9372,10 @@ diff -urN a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posix
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -61,13 +61,13 @@
- unsigned int getProcessId() const;
-
- #if VMIME_HAVE_MESSAGING_FEATURES
-- ref <vmime::net::socketFactory> getSocketFactory() const;
-+ ref <vmime::net::socketFactory> getSocketFactory();
- #endif
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-- vmime::utility::fileSystemFactory* getFileSystemFactory() const;
-+ ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
-
-- vmime::utility::childProcessFactory* getChildProcessFactory() const;
-+ ref <vmime::utility::childProcessFactory> getChildProcessFactory();
- #endif
-
- void wait() const;
-@@ -79,8 +79,8 @@
- #endif
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-- posixFileSystemFactory* m_fileSysFactory;
-- posixChildProcessFactory* m_childProcFactory;
-+ ref <posixFileSystemFactory> m_fileSysFactory;
-+ ref <posixChildProcessFactory> m_childProcFactory;
- #endif
- };
-
-diff -urN a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixSocket.hpp
---- a/vmime/platforms/posix/posixSocket.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/platforms/posix/posixSocket.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixSocket.hpp
+index c230944..0d0dae6 100644
+--- a/vmime/platforms/posix/posixSocket.hpp
++++ b/vmime/platforms/posix/posixSocket.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8228,24 +9389,10 @@ diff -urN a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixS
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -48,10 +48,12 @@
- void disconnect();
-
- void receive(vmime::string& buffer);
-- int receiveRaw(char* buffer, const int count);
-+ size_type receiveRaw(char* buffer, const size_type count);
-
- void send(const vmime::string& buffer);
-- void sendRaw(const char* buffer, const int count);
-+ void sendRaw(const char* buffer, const size_type count);
-+
-+ size_type getBlockSize() const;
-
- protected:
-
-diff -urN a/vmime/platforms/windows/windowsFile.hpp b/vmime/platforms/windows/windowsFile.hpp
---- a/vmime/platforms/windows/windowsFile.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/platforms/windows/windowsFile.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/windows/windowsFile.hpp b/vmime/platforms/windows/windowsFile.hpp
+index 7e81859..a2a9e92 100644
+--- a/vmime/platforms/windows/windowsFile.hpp
++++ b/vmime/platforms/windows/windowsFile.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://vmime.sourceforge.net)
@@ -8259,18 +9406,10 @@ diff -urN a/vmime/platforms/windows/windowsFile.hpp b/vmime/platforms/windows/wi
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -73,7 +73,7 @@
- bool canRead() const;
- bool canWrite() const;
-
-- const length_type getLength();
-+ length_type getLength();
-
- const path& getFullPath() const;
-
-diff -urN a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp
---- a/vmime/platforms/windows/windowsHandler.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/platforms/windows/windowsHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp
+index 2f65651..701edf0 100644
+--- a/vmime/platforms/windows/windowsHandler.hpp
++++ b/vmime/platforms/windows/windowsHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://vmime.sourceforge.net)
@@ -8284,35 +9423,10 @@ diff -urN a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -60,13 +60,13 @@
- unsigned int getProcessId() const;
-
- #if VMIME_HAVE_MESSAGING_FEATURES
-- ref <vmime::net::socketFactory> getSocketFactory() const;
-+ ref <vmime::net::socketFactory> getSocketFactory();
- #endif
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-- vmime::utility::fileSystemFactory* getFileSystemFactory() const;
-+ ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
-
-- vmime::utility::childProcessFactory* getChildProcessFactory() const;
-+ ref <vmime::utility::childProcessFactory> getChildProcessFactory();
- #endif
-
- void wait() const;
-@@ -78,7 +78,7 @@
- #endif
-
- #if VMIME_HAVE_FILESYSTEM_FEATURES
-- windowsFileSystemFactory* m_fileSysFactory;
-+ ref <windowsFileSystemFactory> m_fileSysFactory;
- #endif
- };
-
-diff -urN a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/windowsSocket.hpp
---- a/vmime/platforms/windows/windowsSocket.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/platforms/windows/windowsSocket.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/windowsSocket.hpp
+index 6890ddc..61475c3 100644
+--- a/vmime/platforms/windows/windowsSocket.hpp
++++ b/vmime/platforms/windows/windowsSocket.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://vmime.sourceforge.net)
@@ -8326,24 +9440,10 @@ diff -urN a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -50,10 +50,12 @@
- void disconnect();
-
- void receive(vmime::string& buffer);
-- int receiveRaw(char* buffer, const int count);
-+ size_type receiveRaw(char* buffer, const size_type count);
-
- void send(const vmime::string& buffer);
-- void sendRaw(const char* buffer, const int count);
-+ void sendRaw(const char* buffer, const size_type count);
-+
-+ size_type getBlockSize() const;
-
- private:
-
-diff -urN a/vmime/propertySet.hpp b/vmime/propertySet.hpp
---- a/vmime/propertySet.hpp 2008-10-12 10:58:07.000000000 +0200
-+++ b/vmime/propertySet.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/propertySet.hpp b/vmime/propertySet.hpp
+index 94cf1fd..e5cbf1f 100644
+--- a/vmime/propertySet.hpp
++++ b/vmime/propertySet.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8357,18 +9457,10 @@ diff -urN a/vmime/propertySet.hpp b/vmime/propertySet.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -432,7 +432,7 @@
-
- #ifndef VMIME_INLINE_TEMPLATE_SPECIALIZATION
-
--template <> void propertySet::property::setValue(const string& value);
-+template <> void propertySet::property::setValue <string>(const string& value);
- template <> void propertySet::property::setValue(const bool& value);
-
- template <> string propertySet::property::getValue() const;
-diff -urN a/vmime/relay.hpp b/vmime/relay.hpp
---- a/vmime/relay.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/relay.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/relay.hpp b/vmime/relay.hpp
+index 46b6351..583ad80 100644
+--- a/vmime/relay.hpp
++++ b/vmime/relay.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8382,9 +9474,10 @@ diff -urN a/vmime/relay.hpp b/vmime/relay.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/authenticator.hpp b/vmime/security/authenticator.hpp
---- a/vmime/security/authenticator.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/authenticator.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/authenticator.hpp b/vmime/security/authenticator.hpp
+index d339975..a31fc5e 100644
+--- a/vmime/security/authenticator.hpp
++++ b/vmime/security/authenticator.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8398,9 +9491,10 @@ diff -urN a/vmime/security/authenticator.hpp b/vmime/security/authenticator.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/cert/certificateChain.hpp b/vmime/security/cert/certificateChain.hpp
---- a/vmime/security/cert/certificateChain.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/cert/certificateChain.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/cert/X509Certificate.hpp b/vmime/security/cert/X509Certificate.hpp
+index e7ca309..b916cff 100644
+--- a/vmime/security/cert/X509Certificate.hpp
++++ b/vmime/security/cert/X509Certificate.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8414,9 +9508,10 @@ diff -urN a/vmime/security/cert/certificateChain.hpp b/vmime/security/cert/certi
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/cert/certificate.hpp b/vmime/security/cert/certificate.hpp
---- a/vmime/security/cert/certificate.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/cert/certificate.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/cert/certificate.hpp b/vmime/security/cert/certificate.hpp
+index 440a1a8..b7447fe 100644
+--- a/vmime/security/cert/certificate.hpp
++++ b/vmime/security/cert/certificate.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8430,9 +9525,10 @@ diff -urN a/vmime/security/cert/certificate.hpp b/vmime/security/cert/certificat
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/cert/certificateVerifier.hpp b/vmime/security/cert/certificateVerifier.hpp
---- a/vmime/security/cert/certificateVerifier.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/cert/certificateVerifier.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/cert/certificateChain.hpp b/vmime/security/cert/certificateChain.hpp
+index bb21313..02e3d55 100644
+--- a/vmime/security/cert/certificateChain.hpp
++++ b/vmime/security/cert/certificateChain.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8446,9 +9542,10 @@ diff -urN a/vmime/security/cert/certificateVerifier.hpp b/vmime/security/cert/ce
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/cert/defaultCertificateVerifier.hpp b/vmime/security/cert/defaultCertificateVerifier.hpp
---- a/vmime/security/cert/defaultCertificateVerifier.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/cert/defaultCertificateVerifier.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/cert/certificateVerifier.hpp b/vmime/security/cert/certificateVerifier.hpp
+index e04b11c..cf03826 100644
+--- a/vmime/security/cert/certificateVerifier.hpp
++++ b/vmime/security/cert/certificateVerifier.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8462,9 +9559,10 @@ diff -urN a/vmime/security/cert/defaultCertificateVerifier.hpp b/vmime/security/
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/cert/X509Certificate.hpp b/vmime/security/cert/X509Certificate.hpp
---- a/vmime/security/cert/X509Certificate.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/cert/X509Certificate.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/cert/defaultCertificateVerifier.hpp b/vmime/security/cert/defaultCertificateVerifier.hpp
+index 5b4bab6..6f650f3 100644
+--- a/vmime/security/cert/defaultCertificateVerifier.hpp
++++ b/vmime/security/cert/defaultCertificateVerifier.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8478,9 +9576,10 @@ diff -urN a/vmime/security/cert/X509Certificate.hpp b/vmime/security/cert/X509Ce
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/defaultAuthenticator.hpp b/vmime/security/defaultAuthenticator.hpp
---- a/vmime/security/defaultAuthenticator.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/defaultAuthenticator.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/security/defaultAuthenticator.hpp b/vmime/security/defaultAuthenticator.hpp
+index 641dcfe..dfb8298 100644
+--- a/vmime/security/defaultAuthenticator.hpp
++++ b/vmime/security/defaultAuthenticator.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8494,9 +9593,10 @@ diff -urN a/vmime/security/defaultAuthenticator.hpp b/vmime/security/defaultAuth
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/digest/md5/md5MessageDigest.hpp b/vmime/security/digest/md5/md5MessageDigest.hpp
---- a/vmime/security/digest/md5/md5MessageDigest.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/digest/md5/md5MessageDigest.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/digest/md5/md5MessageDigest.hpp b/vmime/security/digest/md5/md5MessageDigest.hpp
+index 893cb05..682e7cc 100644
+--- a/vmime/security/digest/md5/md5MessageDigest.hpp
++++ b/vmime/security/digest/md5/md5MessageDigest.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8510,9 +9610,10 @@ diff -urN a/vmime/security/digest/md5/md5MessageDigest.hpp b/vmime/security/dige
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/digest/messageDigestFactory.hpp b/vmime/security/digest/messageDigestFactory.hpp
---- a/vmime/security/digest/messageDigestFactory.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/digest/messageDigestFactory.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/digest/messageDigest.hpp b/vmime/security/digest/messageDigest.hpp
+index 95c3b2b..9e432c7 100644
+--- a/vmime/security/digest/messageDigest.hpp
++++ b/vmime/security/digest/messageDigest.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8526,9 +9627,10 @@ diff -urN a/vmime/security/digest/messageDigestFactory.hpp b/vmime/security/dige
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/digest/messageDigest.hpp b/vmime/security/digest/messageDigest.hpp
---- a/vmime/security/digest/messageDigest.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/digest/messageDigest.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/digest/messageDigestFactory.hpp b/vmime/security/digest/messageDigestFactory.hpp
+index 54d6d76..763d5fa 100644
+--- a/vmime/security/digest/messageDigestFactory.hpp
++++ b/vmime/security/digest/messageDigestFactory.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8542,9 +9644,10 @@ diff -urN a/vmime/security/digest/messageDigest.hpp b/vmime/security/digest/mess
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/digest/sha1/sha1MessageDigest.hpp b/vmime/security/digest/sha1/sha1MessageDigest.hpp
---- a/vmime/security/digest/sha1/sha1MessageDigest.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/digest/sha1/sha1MessageDigest.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/digest/sha1/sha1MessageDigest.hpp b/vmime/security/digest/sha1/sha1MessageDigest.hpp
+index 129db80..906009a 100644
+--- a/vmime/security/digest/sha1/sha1MessageDigest.hpp
++++ b/vmime/security/digest/sha1/sha1MessageDigest.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8558,9 +9661,10 @@ diff -urN a/vmime/security/digest/sha1/sha1MessageDigest.hpp b/vmime/security/di
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/builtinSASLMechanism.hpp b/vmime/security/sasl/builtinSASLMechanism.hpp
---- a/vmime/security/sasl/builtinSASLMechanism.hpp 2008-10-12 11:37:42.000000000 +0200
-+++ b/vmime/security/sasl/builtinSASLMechanism.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/SASLAuthenticator.hpp b/vmime/security/sasl/SASLAuthenticator.hpp
+index 76e1c5d..daa090a 100644
+--- a/vmime/security/sasl/SASLAuthenticator.hpp
++++ b/vmime/security/sasl/SASLAuthenticator.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8574,9 +9678,10 @@ diff -urN a/vmime/security/sasl/builtinSASLMechanism.hpp b/vmime/security/sasl/b
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sasl/defaultSASLAuthenticator.hpp
---- a/vmime/security/sasl/defaultSASLAuthenticator.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/sasl/defaultSASLAuthenticator.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/SASLContext.hpp b/vmime/security/sasl/SASLContext.hpp
+index e1d2de4..7703ab1 100644
+--- a/vmime/security/sasl/SASLContext.hpp
++++ b/vmime/security/sasl/SASLContext.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8590,9 +9695,10 @@ diff -urN a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sa
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/SASLAuthenticator.hpp b/vmime/security/sasl/SASLAuthenticator.hpp
---- a/vmime/security/sasl/SASLAuthenticator.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/sasl/SASLAuthenticator.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/SASLMechanism.hpp b/vmime/security/sasl/SASLMechanism.hpp
+index 3283831..dbb7cd2 100644
+--- a/vmime/security/sasl/SASLMechanism.hpp
++++ b/vmime/security/sasl/SASLMechanism.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8606,9 +9712,10 @@ diff -urN a/vmime/security/sasl/SASLAuthenticator.hpp b/vmime/security/sasl/SASL
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/SASLContext.hpp b/vmime/security/sasl/SASLContext.hpp
---- a/vmime/security/sasl/SASLContext.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/sasl/SASLContext.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/SASLMechanismFactory.hpp b/vmime/security/sasl/SASLMechanismFactory.hpp
+index 13d0efd..7b86061 100644
+--- a/vmime/security/sasl/SASLMechanismFactory.hpp
++++ b/vmime/security/sasl/SASLMechanismFactory.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8622,9 +9729,10 @@ diff -urN a/vmime/security/sasl/SASLContext.hpp b/vmime/security/sasl/SASLContex
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/SASLMechanismFactory.hpp b/vmime/security/sasl/SASLMechanismFactory.hpp
---- a/vmime/security/sasl/SASLMechanismFactory.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/sasl/SASLMechanismFactory.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/SASLSession.hpp b/vmime/security/sasl/SASLSession.hpp
+index 8c9eca6..79acfa9 100644
+--- a/vmime/security/sasl/SASLSession.hpp
++++ b/vmime/security/sasl/SASLSession.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8638,9 +9746,10 @@ diff -urN a/vmime/security/sasl/SASLMechanismFactory.hpp b/vmime/security/sasl/S
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/SASLMechanism.hpp b/vmime/security/sasl/SASLMechanism.hpp
---- a/vmime/security/sasl/SASLMechanism.hpp 2008-10-12 11:31:17.000000000 +0200
-+++ b/vmime/security/sasl/SASLMechanism.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.hpp
+index fc6fc39..3ff27e3 100644
+--- a/vmime/security/sasl/SASLSocket.hpp
++++ b/vmime/security/sasl/SASLSocket.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8654,9 +9763,10 @@ diff -urN a/vmime/security/sasl/SASLMechanism.hpp b/vmime/security/sasl/SASLMech
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/SASLSession.hpp b/vmime/security/sasl/SASLSession.hpp
---- a/vmime/security/sasl/SASLSession.hpp 2008-10-12 11:31:38.000000000 +0200
-+++ b/vmime/security/sasl/SASLSession.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/builtinSASLMechanism.hpp b/vmime/security/sasl/builtinSASLMechanism.hpp
+index a1ea531..ac7421c 100644
+--- a/vmime/security/sasl/builtinSASLMechanism.hpp
++++ b/vmime/security/sasl/builtinSASLMechanism.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8670,9 +9780,10 @@ diff -urN a/vmime/security/sasl/SASLSession.hpp b/vmime/security/sasl/SASLSessio
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.hpp
---- a/vmime/security/sasl/SASLSocket.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/security/sasl/SASLSocket.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sasl/defaultSASLAuthenticator.hpp
+index 0b1c06e..a896b65 100644
+--- a/vmime/security/sasl/defaultSASLAuthenticator.hpp
++++ b/vmime/security/sasl/defaultSASLAuthenticator.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8686,24 +9797,10 @@ diff -urN a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -53,10 +53,12 @@
- bool isConnected() const;
-
- void receive(string& buffer);
-- int receiveRaw(char* buffer, const int count);
-+ size_type receiveRaw(char* buffer, const size_type count);
-
- void send(const string& buffer);
-- void sendRaw(const char* buffer, const int count);
-+ void sendRaw(const char* buffer, const size_type count);
-+
-+ size_type getBlockSize() const;
-
- private:
-
-diff -urN a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
---- a/vmime/streamContentHandler.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/streamContentHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
+index b9e8e97..aa62b2f 100644
+--- a/vmime/streamContentHandler.hpp
++++ b/vmime/streamContentHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8717,9 +9814,10 @@ diff -urN a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
---- a/vmime/stringContentHandler.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/stringContentHandler.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
+index 0e7d1e3..8d36889 100644
+--- a/vmime/stringContentHandler.hpp
++++ b/vmime/stringContentHandler.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8733,9 +9831,10 @@ diff -urN a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/text.hpp b/vmime/text.hpp
---- a/vmime/text.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/text.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/text.hpp b/vmime/text.hpp
+index 34427b5..dd4534d 100644
+--- a/vmime/text.hpp
++++ b/vmime/text.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8749,30 +9848,10 @@ diff -urN a/vmime/text.hpp b/vmime/text.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -129,10 +129,6 @@
- */
- const std::vector <ref <word> > getWordList();
-
-- // Decoding
--#if VMIME_WIDE_CHAR_SUPPORT
-- const wstring getDecodedText() const;
--#endif
-
- /** Return the text converted into the specified charset.
- * The encoded-words are decoded and then converted in the
-@@ -197,7 +193,8 @@
-
- FORCE_NO_ENCODING = (1 << 0), /**< Just fold lines, don't encode them. */
- FORCE_ENCODING = (1 << 1), /**< Encode lines even if they are plain ASCII text. */
-- NO_NEW_LINE_SEQUENCE = (1 << 2) /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
-+ NO_NEW_LINE_SEQUENCE = (1 << 2), /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
-+ QUOTE_IF_POSSIBLE = (1 << 3) /**< Use quoting instead of encoding when possible (even if FORCE_ENCODING is specified). */
- };
-
- /** Encode and fold text in respect to RFC-2047.
-diff -urN a/vmime/textPartFactory.hpp b/vmime/textPartFactory.hpp
---- a/vmime/textPartFactory.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/textPartFactory.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/textPart.hpp b/vmime/textPart.hpp
+index 1e8a485..acd9fb3 100644
+--- a/vmime/textPart.hpp
++++ b/vmime/textPart.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8786,9 +9865,10 @@ diff -urN a/vmime/textPartFactory.hpp b/vmime/textPartFactory.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/textPart.hpp b/vmime/textPart.hpp
---- a/vmime/textPart.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/textPart.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/textPartFactory.hpp b/vmime/textPartFactory.hpp
+index 89e48e3..3650293 100644
+--- a/vmime/textPartFactory.hpp
++++ b/vmime/textPartFactory.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8802,9 +9882,10 @@ diff -urN a/vmime/textPart.hpp b/vmime/textPart.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/types.hpp b/vmime/types.hpp
---- a/vmime/types.hpp 2008-10-12 10:54:34.000000000 +0200
-+++ b/vmime/types.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/types.hpp b/vmime/types.hpp
+index de02192..bdf627e 100644
+--- a/vmime/types.hpp
++++ b/vmime/types.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8818,19 +9899,10 @@ diff -urN a/vmime/types.hpp b/vmime/types.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -36,9 +36,6 @@
- namespace vmime
- {
- typedef std::string string;
--#if VMIME_WIDE_CHAR_SUPPORT
-- typedef std::wstring wstring;
--#endif
-
- typedef unsigned short port_t;
-
-diff -urN a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp
---- a/vmime/utility/childProcess.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/childProcess.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp
+index b4bc257..33cb633 100644
+--- a/vmime/utility/childProcess.hpp
++++ b/vmime/utility/childProcess.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8844,18 +9916,10 @@ diff -urN a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -85,7 +85,7 @@
- /** Create 'childProcess' objects.
- */
-
--class childProcessFactory
-+class childProcessFactory : public object
- {
- public:
-
-diff -urN a/vmime/utility/datetimeUtils.hpp b/vmime/utility/datetimeUtils.hpp
---- a/vmime/utility/datetimeUtils.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/datetimeUtils.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/datetimeUtils.hpp b/vmime/utility/datetimeUtils.hpp
+index 23d1a96..b56533c 100644
+--- a/vmime/utility/datetimeUtils.hpp
++++ b/vmime/utility/datetimeUtils.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8869,22 +9933,10 @@ diff -urN a/vmime/utility/datetimeUtils.hpp b/vmime/utility/datetimeUtils.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -84,9 +84,11 @@
- * @param year year in 4-digit format
- * @param month month (1-12), January is 1, December is 12 (see datetime::Months enum)
- * @param day month day (1-31)
-+ * @param iso if TRUE, use ISO week-numbering year (default is to use calendar year).
-+ * For more information, read here: http://en.wikipedia.org/wiki/ISO_8601#Week_dates
- * @return the week number (1 is the first week of the year)
- */
-- static int getWeekOfYear(const int year, const int month, const int day);
-+ static int getWeekOfYear(const int year, const int month, const int day, const bool iso = false);
- };
-
-
-diff -urN a/vmime/utility/encoder/b64Encoder.hpp b/vmime/utility/encoder/b64Encoder.hpp
---- a/vmime/utility/encoder/b64Encoder.hpp 2008-10-12 15:39:13.000000000 +0200
-+++ b/vmime/utility/encoder/b64Encoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/b64Encoder.hpp b/vmime/utility/encoder/b64Encoder.hpp
+index 831e9f6..6a3a3c6 100644
+--- a/vmime/utility/encoder/b64Encoder.hpp
++++ b/vmime/utility/encoder/b64Encoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8898,9 +9950,10 @@ diff -urN a/vmime/utility/encoder/b64Encoder.hpp b/vmime/utility/encoder/b64Enco
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/binaryEncoder.hpp b/vmime/utility/encoder/binaryEncoder.hpp
---- a/vmime/utility/encoder/binaryEncoder.hpp 2008-10-12 15:27:36.000000000 +0200
-+++ b/vmime/utility/encoder/binaryEncoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/binaryEncoder.hpp b/vmime/utility/encoder/binaryEncoder.hpp
+index 783f831..02ff794 100644
+--- a/vmime/utility/encoder/binaryEncoder.hpp
++++ b/vmime/utility/encoder/binaryEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8914,9 +9967,10 @@ diff -urN a/vmime/utility/encoder/binaryEncoder.hpp b/vmime/utility/encoder/bina
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/defaultEncoder.hpp b/vmime/utility/encoder/defaultEncoder.hpp
---- a/vmime/utility/encoder/defaultEncoder.hpp 2008-10-12 15:48:42.000000000 +0200
-+++ b/vmime/utility/encoder/defaultEncoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/defaultEncoder.hpp b/vmime/utility/encoder/defaultEncoder.hpp
+index 3ddad1f..daba3ee 100644
+--- a/vmime/utility/encoder/defaultEncoder.hpp
++++ b/vmime/utility/encoder/defaultEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8930,9 +9984,10 @@ diff -urN a/vmime/utility/encoder/defaultEncoder.hpp b/vmime/utility/encoder/def
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/eightBitEncoder.hpp b/vmime/utility/encoder/eightBitEncoder.hpp
---- a/vmime/utility/encoder/eightBitEncoder.hpp 2008-10-12 15:22:29.000000000 +0200
-+++ b/vmime/utility/encoder/eightBitEncoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/eightBitEncoder.hpp b/vmime/utility/encoder/eightBitEncoder.hpp
+index 2e9b138..2de002f 100644
+--- a/vmime/utility/encoder/eightBitEncoder.hpp
++++ b/vmime/utility/encoder/eightBitEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8946,9 +10001,10 @@ diff -urN a/vmime/utility/encoder/eightBitEncoder.hpp b/vmime/utility/encoder/ei
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/encoderFactory.hpp b/vmime/utility/encoder/encoderFactory.hpp
---- a/vmime/utility/encoder/encoderFactory.hpp 2008-10-12 15:11:07.000000000 +0200
-+++ b/vmime/utility/encoder/encoderFactory.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/encoder.hpp b/vmime/utility/encoder/encoder.hpp
+index eec0003..49f3c30 100644
+--- a/vmime/utility/encoder/encoder.hpp
++++ b/vmime/utility/encoder/encoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8962,9 +10018,10 @@ diff -urN a/vmime/utility/encoder/encoderFactory.hpp b/vmime/utility/encoder/enc
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/encoder.hpp b/vmime/utility/encoder/encoder.hpp
---- a/vmime/utility/encoder/encoder.hpp 2008-10-12 15:12:28.000000000 +0200
-+++ b/vmime/utility/encoder/encoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/encoderFactory.hpp b/vmime/utility/encoder/encoderFactory.hpp
+index 22f28f4..6abb223 100644
+--- a/vmime/utility/encoder/encoderFactory.hpp
++++ b/vmime/utility/encoder/encoderFactory.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8978,9 +10035,10 @@ diff -urN a/vmime/utility/encoder/encoder.hpp b/vmime/utility/encoder/encoder.hp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/qpEncoder.hpp b/vmime/utility/encoder/qpEncoder.hpp
---- a/vmime/utility/encoder/qpEncoder.hpp 2008-10-12 15:32:02.000000000 +0200
-+++ b/vmime/utility/encoder/qpEncoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/qpEncoder.hpp b/vmime/utility/encoder/qpEncoder.hpp
+index 6af3c90..098b4c8 100644
+--- a/vmime/utility/encoder/qpEncoder.hpp
++++ b/vmime/utility/encoder/qpEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -8994,9 +10052,10 @@ diff -urN a/vmime/utility/encoder/qpEncoder.hpp b/vmime/utility/encoder/qpEncode
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/sevenBitEncoder.hpp b/vmime/utility/encoder/sevenBitEncoder.hpp
---- a/vmime/utility/encoder/sevenBitEncoder.hpp 2008-10-12 15:22:12.000000000 +0200
-+++ b/vmime/utility/encoder/sevenBitEncoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/sevenBitEncoder.hpp b/vmime/utility/encoder/sevenBitEncoder.hpp
+index 98a999a..2f4870d 100644
+--- a/vmime/utility/encoder/sevenBitEncoder.hpp
++++ b/vmime/utility/encoder/sevenBitEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9010,9 +10069,10 @@ diff -urN a/vmime/utility/encoder/sevenBitEncoder.hpp b/vmime/utility/encoder/se
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/encoder/uuEncoder.hpp b/vmime/utility/encoder/uuEncoder.hpp
---- a/vmime/utility/encoder/uuEncoder.hpp 2008-10-12 15:36:17.000000000 +0200
-+++ b/vmime/utility/encoder/uuEncoder.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/encoder/uuEncoder.hpp b/vmime/utility/encoder/uuEncoder.hpp
+index 6cb5fa1..6289ae0 100644
+--- a/vmime/utility/encoder/uuEncoder.hpp
++++ b/vmime/utility/encoder/uuEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9026,9 +10086,10 @@ diff -urN a/vmime/utility/encoder/uuEncoder.hpp b/vmime/utility/encoder/uuEncode
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/file.hpp b/vmime/utility/file.hpp
---- a/vmime/utility/file.hpp 2008-10-12 11:00:26.000000000 +0200
-+++ b/vmime/utility/file.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/file.hpp b/vmime/utility/file.hpp
+index 390c4f4..61ede80 100644
+--- a/vmime/utility/file.hpp
++++ b/vmime/utility/file.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9042,18 +10103,10 @@ diff -urN a/vmime/utility/file.hpp b/vmime/utility/file.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -214,7 +214,7 @@
- /** Constructs 'file' objects.
- */
-
--class fileSystemFactory
-+class fileSystemFactory : public object
- {
- public:
-
-diff -urN a/vmime/utility/filteredStream.hpp b/vmime/utility/filteredStream.hpp
---- a/vmime/utility/filteredStream.hpp 2008-10-12 10:59:33.000000000 +0200
-+++ b/vmime/utility/filteredStream.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/filteredStream.hpp b/vmime/utility/filteredStream.hpp
+index 1e03697..00be785 100644
+--- a/vmime/utility/filteredStream.hpp
++++ b/vmime/utility/filteredStream.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9067,27 +10120,10 @@ diff -urN a/vmime/utility/filteredStream.hpp b/vmime/utility/filteredStream.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -41,6 +41,8 @@
- {
- public:
-
-+ virtual size_type getBlockSize();
-+
- /** Return a reference to the stream being filtered.
- *
- * @return stream being filtered
-@@ -56,6 +58,8 @@
- {
- public:
-
-+ virtual size_type getBlockSize();
-+
- /** Return a reference to the stream being filtered.
- *
- * @return destination stream for filtered data
-diff -urN a/vmime/utility/path.hpp b/vmime/utility/path.hpp
---- a/vmime/utility/path.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/path.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/path.hpp b/vmime/utility/path.hpp
+index c4aed26..e43291c 100644
+--- a/vmime/utility/path.hpp
++++ b/vmime/utility/path.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9101,9 +10137,10 @@ diff -urN a/vmime/utility/path.hpp b/vmime/utility/path.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/progressListener.hpp b/vmime/utility/progressListener.hpp
---- a/vmime/utility/progressListener.hpp 2008-10-12 10:54:32.000000000 +0200
-+++ b/vmime/utility/progressListener.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/progressListener.hpp b/vmime/utility/progressListener.hpp
+index f26599d..39b884a 100644
+--- a/vmime/utility/progressListener.hpp
++++ b/vmime/utility/progressListener.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9117,9 +10154,10 @@ diff -urN a/vmime/utility/progressListener.hpp b/vmime/utility/progressListener.
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/random.hpp b/vmime/utility/random.hpp
---- a/vmime/utility/random.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/random.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/random.hpp b/vmime/utility/random.hpp
+index 1db15f5..f706c55 100644
+--- a/vmime/utility/random.hpp
++++ b/vmime/utility/random.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9133,9 +10171,10 @@ diff -urN a/vmime/utility/random.hpp b/vmime/utility/random.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/smartPtr.hpp b/vmime/utility/smartPtr.hpp
---- a/vmime/utility/smartPtr.hpp 2008-10-12 10:55:33.000000000 +0200
-+++ b/vmime/utility/smartPtr.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/smartPtr.hpp b/vmime/utility/smartPtr.hpp
+index d2a78a6..c448632 100644
+--- a/vmime/utility/smartPtr.hpp
++++ b/vmime/utility/smartPtr.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9149,9 +10188,10 @@ diff -urN a/vmime/utility/smartPtr.hpp b/vmime/utility/smartPtr.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/smartPtrInt.hpp b/vmime/utility/smartPtrInt.hpp
---- a/vmime/utility/smartPtrInt.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/smartPtrInt.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/smartPtrInt.hpp b/vmime/utility/smartPtrInt.hpp
+index a7c7345..453c00e 100644
+--- a/vmime/utility/smartPtrInt.hpp
++++ b/vmime/utility/smartPtrInt.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9165,9 +10205,10 @@ diff -urN a/vmime/utility/smartPtrInt.hpp b/vmime/utility/smartPtrInt.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/stream.hpp b/vmime/utility/stream.hpp
---- a/vmime/utility/stream.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/stream.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/stream.hpp b/vmime/utility/stream.hpp
+index 5f7bfa2..1faab55 100644
+--- a/vmime/utility/stream.hpp
++++ b/vmime/utility/stream.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9181,44 +10222,10 @@ diff -urN a/vmime/utility/stream.hpp b/vmime/utility/stream.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -77,7 +77,7 @@
- *
- * @return block size, in bytes
- */
-- virtual size_type getBlockSize() const;
-+ virtual size_type getBlockSize();
- };
-
-
-@@ -239,6 +239,7 @@
- void write(const value_type* const data, const size_type count);
- void flush();
-
-+size_type getBlockSize(){return 8192;}
- private:
-
- string& m_buffer;
-@@ -402,7 +403,7 @@
- void write(const value_type* const data, const size_type count);
- void flush();
-
-- size_type getBlockSize() const;
-+ size_type getBlockSize();
-
- private:
-
-@@ -426,7 +427,7 @@
- size_type read(value_type* const data, const size_type count);
- size_type skip(const size_type count);
-
-- size_type getBlockSize() const;
-+ size_type getBlockSize();
-
- private:
-
-diff -urN a/vmime/utility/stringProxy.hpp b/vmime/utility/stringProxy.hpp
---- a/vmime/utility/stringProxy.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/stringProxy.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/stringProxy.hpp b/vmime/utility/stringProxy.hpp
+index d080e67..21c65ea 100644
+--- a/vmime/utility/stringProxy.hpp
++++ b/vmime/utility/stringProxy.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9232,9 +10239,10 @@ diff -urN a/vmime/utility/stringProxy.hpp b/vmime/utility/stringProxy.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/stringUtils.hpp b/vmime/utility/stringUtils.hpp
---- a/vmime/utility/stringUtils.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/stringUtils.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/stringUtils.hpp b/vmime/utility/stringUtils.hpp
+index 89fd386..b6589db 100644
+--- a/vmime/utility/stringUtils.hpp
++++ b/vmime/utility/stringUtils.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9248,9 +10256,10 @@ diff -urN a/vmime/utility/stringUtils.hpp b/vmime/utility/stringUtils.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/url.hpp b/vmime/utility/url.hpp
---- a/vmime/utility/url.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/url.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/url.hpp b/vmime/utility/url.hpp
+index 99585b1..7537428 100644
+--- a/vmime/utility/url.hpp
++++ b/vmime/utility/url.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9264,9 +10273,10 @@ diff -urN a/vmime/utility/url.hpp b/vmime/utility/url.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/utility/urlUtils.hpp b/vmime/utility/urlUtils.hpp
---- a/vmime/utility/urlUtils.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/utility/urlUtils.hpp 2010-02-09 14:34:53.000000000 +0100
+diff --git a/vmime/utility/urlUtils.hpp b/vmime/utility/urlUtils.hpp
+index 3d2955a..ba0fbf6 100644
+--- a/vmime/utility/urlUtils.hpp
++++ b/vmime/utility/urlUtils.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9280,9 +10290,10 @@ diff -urN a/vmime/utility/urlUtils.hpp b/vmime/utility/urlUtils.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/vmime.hpp b/vmime/vmime.hpp
---- a/vmime/vmime.hpp 2008-10-12 15:14:17.000000000 +0200
-+++ b/vmime/vmime.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/vmime.hpp b/vmime/vmime.hpp
+index 0e54d7b..f187b9e 100644
+--- a/vmime/vmime.hpp
++++ b/vmime/vmime.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9296,9 +10307,10 @@ diff -urN a/vmime/vmime.hpp b/vmime/vmime.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
---- a/vmime/wordEncoder.hpp 2008-10-12 15:46:34.000000000 +0200
-+++ b/vmime/wordEncoder.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/word.hpp b/vmime/word.hpp
+index 14f8b0e..d787073 100644
+--- a/vmime/word.hpp
++++ b/vmime/word.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9312,9 +10324,10 @@ diff -urN a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-diff -urN a/vmime/word.hpp b/vmime/word.hpp
---- a/vmime/word.hpp 2008-10-12 10:54:33.000000000 +0200
-+++ b/vmime/word.hpp 2010-02-09 14:34:54.000000000 +0100
+diff --git a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
+index 09c141d..17ca808 100644
+--- a/vmime/wordEncoder.hpp
++++ b/vmime/wordEncoder.hpp
@@ -1,10 +1,10 @@
//
// VMime library (http://www.vmime.org)
@@ -9328,7 +10341,409 @@ diff -urN a/vmime/word.hpp b/vmime/word.hpp
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
-@@ -60,6 +60,12 @@
+
+commit cc633d7aafc1736a866c34ffda272842fe6a154c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Sep 14 15:07:06 2009 +0000
+
+ Added workaround for Decider() for legacy versions of SCons.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@503 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 2e86832..89b58f6 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -439,7 +439,11 @@ EnsureSConsVersion(0, 94)
+
+ SetOption('implicit_cache', 1)
+
+-Decider('MD5-timestamp')
++try:
++ Decider('MD5-timestamp')
++except:
++ SourceSignatures('MD5')
++ TargetSignatures('build')
+
+
+ #############
+
+commit 1fade7261d02652f39ffc70fdf29cfad02244732
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Sep 15 19:36:03 2009 +0000
+
+ Fixed possible segfault (thanks to John van der Kamp, from Zarafa).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@504 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/messageBuilder.cpp b/src/messageBuilder.cpp
+index d619554..a70372f 100644
+--- a/src/messageBuilder.cpp
++++ b/src/messageBuilder.cpp
+@@ -142,6 +142,9 @@ ref <message> messageBuilder::construct() const
+ {
+ const bodyPart& part = *msg->getBody()->getPartAt(0);
+
++ // Make a full copy of the body, otherwise the copyFrom() will delete the body we're copying
++ ref <body> bodyCopy = part.getBody()->clone().dynamicCast <body>();
++
+ // First, copy (and replace) the header fields
+ const std::vector <ref <const headerField> > fields = part.getHeader()->getFieldList();
+
+@@ -153,7 +156,7 @@ ref <message> messageBuilder::construct() const
+
+ // Second, copy the body contents and sub-parts (this also remove
+ // the body part we are copying...)
+- msg->getBody()->copyFrom(*part.getBody());
++ msg->getBody()->copyFrom(*bodyCopy);
+ }
+
+ return (msg);
+
+commit df1b82b80f63d1e4c6f30f8be03dd4b3e859b341
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Nov 3 12:37:51 2009 +0000
+
+ Fixed possible segfault (thanks to László Vadócz).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@505 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
+index 03b2057..abae8f9 100644
+--- a/src/utility/stringUtils.cpp
++++ b/src/utility/stringUtils.cpp
+@@ -142,7 +142,7 @@ string::size_type stringUtils::countASCIIchars
+ {
+ if (parserHelpers::isAscii(*i))
+ {
+- if (*i != '=' || *(i + 1) != '?') // To avoid bad behaviour...
++ if (*i != '=' || ((i + 1) != end && *(i + 1) != '?')) // To avoid bad behaviour...
+ ++count;
+ }
+ }
+
+commit 8391dcfb8e65645d473a0a67e3f5c860d30817b7
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Nov 3 14:17:55 2009 +0000
+
+ Reset EOF flag when stream is reset.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@506 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index 4ec2ef3..7ee9f19 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -188,6 +188,8 @@ void posixFileReaderInputStream::reset()
+ {
+ if (::lseek(m_fd, 0, SEEK_SET) == off_t(-1))
+ posixFileSystemFactory::reportError(m_path, errno);
++
++ m_eof = false;
+ }
+
+
+@@ -199,7 +201,7 @@ vmime::utility::stream::size_type posixFileReaderInputStream::read
+ if ((c = ::read(m_fd, data, count)) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+
+- if (c == 0)
++ if (c == 0 && count != 0)
+ m_eof = true;
+
+ return static_cast <size_type>(c);
+
+commit 746d6ccc4c9a8c2387f3d4311d7b4c670d8f5e8b
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Nov 4 12:52:49 2009 +0000
+
+ Removed some unnecessary consts on integral types where overrides conflict. Added <cctype> to get the std::isspace that doesn't require a 2nd arg 'locale' (thanks to Ben Jackson).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@507 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
+index 5412a3b..82c5696 100644
+--- a/src/platforms/windows/windowsFile.cpp
++++ b/src/platforms/windows/windowsFile.cpp
+@@ -464,7 +464,7 @@ void windowsFileReaderInputStream::reset()
+ SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
+ }
+
+-const vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
++vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
+ {
+ DWORD dwBytesRead;
+ if (!ReadFile(m_hFile, (LPVOID)data, (DWORD)count, &dwBytesRead, NULL))
+@@ -472,7 +472,7 @@ const vmime::utility::stream::size_type windowsFileReaderInputStream::read(value
+ return dwBytesRead;
+ }
+
+-const vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
++vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
+ {
+ DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
+ DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)count, NULL, FILE_CURRENT);
+diff --git a/vmime/base.hpp b/vmime/base.hpp
+index ad00d3f..ce544e1 100644
+--- a/vmime/base.hpp
++++ b/vmime/base.hpp
+@@ -29,6 +29,7 @@
+ #include <vector>
+ #include <map>
+ #include <sstream>
++#include <cctype>
+ #include <locale>
+
+ #include "vmime/config.hpp"
+diff --git a/vmime/platforms/windows/windowsFile.hpp b/vmime/platforms/windows/windowsFile.hpp
+index a2a9e92..6e1c8fb 100644
+--- a/vmime/platforms/windows/windowsFile.hpp
++++ b/vmime/platforms/windows/windowsFile.hpp
+@@ -73,7 +73,7 @@ public:
+ bool canRead() const;
+ bool canWrite() const;
+
+- const length_type getLength();
++ length_type getLength();
+
+ const path& getFullPath() const;
+
+
+commit eba83b2cb02ef40da3fa519fac6255735cf980b5
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Nov 4 14:12:06 2009 +0000
+
+ Auto-detect filename. Renamed 'filename' argument to 'filepath' for disambiguity. Added constructor for input stream. Use 'word' instead of 'string' for filename.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@508 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp
+index e643491..da7c4b7 100644
+--- a/src/fileAttachment.cpp
++++ b/src/fileAttachment.cpp
+@@ -31,48 +31,93 @@
+
+ #include "vmime/contentDispositionField.hpp"
+
++#include "vmime/platform.hpp"
++#include "vmime/utility/file.hpp"
++
+
+ namespace vmime
+ {
+
+
+-fileAttachment::fileAttachment(const string& filename, const mediaType& type)
++fileAttachment::fileAttachment(const string& filepath, const mediaType& type)
+ {
+ m_type = type;
+
+- setData(filename);
++ setData(filepath);
+
+ m_encoding = encoding::decide(m_data);
+ }
+
+
+-fileAttachment::fileAttachment(const string& filename, const mediaType& type, const text& desc)
++fileAttachment::fileAttachment(const string& filepath, const mediaType& type, const text& desc)
+ {
+ m_type = type;
+ m_desc = desc;
+
+- setData(filename);
++ setData(filepath);
+
+ m_encoding = encoding::decide(m_data);
+ }
+
+
+-fileAttachment::fileAttachment(const string& filename, const mediaType& type,
++fileAttachment::fileAttachment(const string& filepath, const mediaType& type,
+ const text& desc, const encoding& enc)
+ {
+ m_type = type;
+ m_desc = desc;
+
+- setData(filename);
++ setData(filepath);
++
++ m_encoding = enc;
++}
++
++
++fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type)
++{
++ if (!filename.isEmpty())
++ m_fileInfo.setFilename(filename);
++
++ m_type = type;
++
++ setData(is);
++
++ m_encoding = encoding::decide(m_data);
++}
++
++
++fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename,
++ const mediaType& type, const text& desc)
++{
++ if (!filename.isEmpty())
++ m_fileInfo.setFilename(filename);
++
++ m_type = type;
++ m_desc = desc;
++
++ setData(is);
++
++ m_encoding = encoding::decide(m_data);
++}
++
++
++fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename,
++ const mediaType& type, const text& desc, const encoding& enc)
++{
++ if (!filename.isEmpty())
++ m_fileInfo.setFilename(filename);
+
++ m_type = type;
++ m_desc = desc;
+ m_encoding = enc;
++
++ setData(is);
+ }
+
+
+-void fileAttachment::setData(const string& filename)
++void fileAttachment::setData(const string& filepath)
+ {
+ std::ifstream* file = new std::ifstream();
+- file->open(filename.c_str(), std::ios::in | std::ios::binary);
++ file->open(filepath.c_str(), std::ios::in | std::ios::binary);
+
+ if (!*file)
+ {
+@@ -82,6 +127,15 @@ void fileAttachment::setData(const string& filename)
+
+ ref <utility::inputStream> is = vmime::create <utility::inputStreamPointerAdapter>(file, true);
+
++ setData(is);
++
++ utility::file::path path = platform::getHandler()->getFileSystemFactory()->stringToPath(filepath);
++ m_fileInfo.setFilename(path.getLastComponent());
++}
++
++
++void fileAttachment::setData(ref <utility::inputStream> is)
++{
+ m_data = vmime::create <streamContentHandler>(is, 0);
+ }
+
+@@ -94,7 +148,7 @@ void fileAttachment::generatePart(ref <bodyPart> part) const
+ dynamicCast <contentDispositionField>();
+
+ if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize()));
+- if (m_fileInfo.hasFilename()) cdf->setFilename(m_fileInfo.getFilename());
++ if (m_fileInfo.hasFilename() && !m_fileInfo.getFilename().isEmpty()) cdf->setFilename(m_fileInfo.getFilename());
+ if (m_fileInfo.hasCreationDate()) cdf->setCreationDate(m_fileInfo.getCreationDate());
+ if (m_fileInfo.hasModificationDate()) cdf->setModificationDate(m_fileInfo.getModificationDate());
+ if (m_fileInfo.hasReadDate()) cdf->setReadDate(m_fileInfo.getReadDate());
+@@ -134,8 +188,9 @@ fileAttachment::fileInfo::~fileInfo()
+ }
+
+ bool fileAttachment::fileInfo::hasFilename() const { return (m_filename != NULL); }
+-const string& fileAttachment::fileInfo::getFilename() const { return (*m_filename); }
+-void fileAttachment::fileInfo::setFilename(const string& name) { if (m_filename) { *m_filename = name; } else { m_filename = new string(name); } }
++const word& fileAttachment::fileInfo::getFilename() const { return (*m_filename); }
++void fileAttachment::fileInfo::setFilename(const string& name) { if (m_filename) { *m_filename = name; } else { m_filename = new word(name); } }
++void fileAttachment::fileInfo::setFilename(const word& name) { if (m_filename) { *m_filename = name; } else { m_filename = new word(name); } }
+
+ bool fileAttachment::fileInfo::hasCreationDate() const { return (m_creationDate != NULL); }
+ const datetime& fileAttachment::fileInfo::getCreationDate() const { return (*m_creationDate); }
+diff --git a/src/word.cpp b/src/word.cpp
+index 958c33e..ce5ddfc 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
+@@ -699,6 +699,12 @@ string& word::getBuffer()
+ }
+
+
++bool word::isEmpty() const
++{
++ return m_buffer.empty();
++}
++
++
+ void word::setBuffer(const string& buffer)
+ {
+ m_buffer = buffer;
+diff --git a/vmime/fileAttachment.hpp b/vmime/fileAttachment.hpp
+index 0662c8e..1516a9d 100644
+--- a/vmime/fileAttachment.hpp
++++ b/vmime/fileAttachment.hpp
+@@ -41,9 +41,13 @@ class fileAttachment : public defaultAttachment
+ {
+ public:
+
+- fileAttachment(const string& filename, const mediaType& type);
+- fileAttachment(const string& filename, const mediaType& type, const text& desc);
+- fileAttachment(const string& filename, const mediaType& type, const text& desc, const encoding& enc);
++ fileAttachment(const string& filepath, const mediaType& type);
++ fileAttachment(const string& filepath, const mediaType& type, const text& desc);
++ fileAttachment(const string& filepath, const mediaType& type, const text& desc, const encoding& enc);
++
++ fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type);
++ fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type, const text& desc);
++ fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type, const text& desc, const encoding& enc);
+
+ /** Stores information about a file attachment.
+ */
+@@ -65,7 +69,7 @@ public:
+ *
+ * @return file name
+ */
+- const string& getFilename() const;
++ const word& getFilename() const;
+
+ /** Set the value of the 'filename' property.
+ *
+@@ -73,6 +77,12 @@ public:
+ */
+ void setFilename(const string& name);
+
++ /** Set the value of the 'filename' property.
++ *
++ * @param name file name
++ */
++ void setFilename(const word& name);
++
+ /** Check whether the 'creation-date' property is present.
+ *
+ * @return true if the 'creation-date' property is set,
+@@ -151,7 +161,7 @@ public:
+
+ private:
+
+- string* m_filename;
++ word* m_filename;
+ unsigned int* m_size;
+ datetime* m_creationDate;
+ datetime* m_modifDate;
+@@ -163,7 +173,8 @@ public:
+
+ private:
+
+- void setData(const string& filename);
++ void setData(const string& filepath);
++ void setData(ref <utility::inputStream> is);
+
+ fileInfo m_fileInfo;
+
+diff --git a/vmime/word.hpp b/vmime/word.hpp
+index d787073..78a88e8 100644
+--- a/vmime/word.hpp
++++ b/vmime/word.hpp
+@@ -60,6 +60,12 @@ public:
*/
string& getBuffer();
@@ -9341,7 +10756,1879 @@ diff -urN a/vmime/word.hpp b/vmime/word.hpp
/** Set the raw data for this encoded word.
*
* @param buffer raw data buffer
-@@ -85,10 +91,6 @@
+
+commit ef738c99e183fe0452394f4f58441cbf0297a7d0
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Nov 12 15:40:56 2009 +0000
+
+ Quote mailbox name instead of encoding it whenever it's possible.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@509 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/mailbox.cpp b/src/mailbox.cpp
+index 2f62521..f6df516 100644
+--- a/src/mailbox.cpp
++++ b/src/mailbox.cpp
+@@ -415,7 +415,7 @@ void mailbox::generate(utility::outputStream& os, const string::size_type maxLin
+ bool newLine = true;
+
+ m_name.encodeAndFold(os, maxLineLength, pos, &pos,
+- forceEncode ? text::FORCE_ENCODING : 0);
++ text::QUOTE_IF_POSSIBLE | (forceEncode ? text::FORCE_ENCODING : 0));
+
+ if (pos + m_email.length() + 3 > maxLineLength)
+ {
+diff --git a/src/word.cpp b/src/word.cpp
+index ce5ddfc..ea8244a 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
+@@ -352,10 +352,22 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
+ noEncoding = false;
+ }
+
+- if (noEncoding)
++ // 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 contain quoting character (")
++ // - there is enough remaining space on the current line to hold the whole buffer
++ if ((flags & text::QUOTE_IF_POSSIBLE) &&
++ asciiCount == m_buffer.length() &&
++ m_buffer.find('"') == string::npos &&
++ (curLineLength + 2 /* 2 x " */ + m_buffer.length()) < maxLineLength)
++ {
++ os << '"' << m_buffer << '"';
++ curLineLength += 2 + m_buffer.length();
++ }
++ // We will fold lines without encoding them.
++ else if (noEncoding)
+ {
+- // We will fold lines without encoding them.
+-
+ string::const_iterator lastWSpos = m_buffer.end(); // last white-space position
+ string::const_iterator curLineStart = m_buffer.begin(); // current line start
+
+diff --git a/vmime/text.hpp b/vmime/text.hpp
+index dd4534d..9760c48 100644
+--- a/vmime/text.hpp
++++ b/vmime/text.hpp
+@@ -197,7 +197,8 @@ public:
+
+ FORCE_NO_ENCODING = (1 << 0), /**< Just fold lines, don't encode them. */
+ FORCE_ENCODING = (1 << 1), /**< Encode lines even if they are plain ASCII text. */
+- NO_NEW_LINE_SEQUENCE = (1 << 2) /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
++ NO_NEW_LINE_SEQUENCE = (1 << 2), /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
++ QUOTE_IF_POSSIBLE = (1 << 3) /**< Use quoting instead of encoding when possible (even if FORCE_ENCODING is specified). */
+ };
+
+ /** Encode and fold text in respect to RFC-2047.
+
+commit 71e41f1d41ff1f87654e03a5e1247e30311677c2
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Nov 30 13:04:15 2009 +0000
+
+ Added block size on sockets to allow different buffer size for SSL.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@510 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
+index c3ee574..6e5a265 100644
+--- a/src/net/imap/IMAPConnection.cpp
++++ b/src/net/imap/IMAPConnection.cpp
+@@ -718,6 +718,12 @@ ref <session> IMAPConnection::getSession()
+ }
+
+
++ref <const socket> IMAPConnection::getSocket() const
++{
++ return m_socket;
++}
++
++
+ } // imap
+ } // net
+ } // vmime
+diff --git a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
+index c06a8d4..0122d21 100644
+--- a/src/net/imap/IMAPFolder.cpp
++++ b/src/net/imap/IMAPFolder.cpp
+@@ -1284,7 +1284,11 @@ void IMAPFolder::addMessage(utility::inputStream& is, const int size, const int
+ if (progress)
+ progress->start(total);
+
+- char buffer[65536];
++ const socket::size_type blockSize = std::min(is.getBlockSize(),
++ static_cast <size_t>(m_connection->getSocket()->getBlockSize()));
++
++ std::vector <char> vbuffer(blockSize);
++ char* buffer = &vbuffer.front();
+
+ while (!is.eof())
+ {
+diff --git a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp
+index c2f91f6..dab0338 100644
+--- a/src/net/tls/TLSSocket.cpp
++++ b/src/net/tls/TLSSocket.cpp
+@@ -90,6 +90,12 @@ bool TLSSocket::isConnected() const
+ }
+
+
++TLSSocket::size_type TLSSocket::getBlockSize() const
++{
++ return 16384; // 16 KB
++}
++
++
+ void TLSSocket::receive(string& buffer)
+ {
+ const int size = receiveRaw(m_buffer, sizeof(m_buffer));
+@@ -103,7 +109,7 @@ void TLSSocket::send(const string& buffer)
+ }
+
+
+-int TLSSocket::receiveRaw(char* buffer, const int count)
++TLSSocket::size_type TLSSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ const ssize_t ret = gnutls_record_recv
+ (*m_session->m_gnutlsSession,
+@@ -124,7 +130,7 @@ int TLSSocket::receiveRaw(char* buffer, const int count)
+ }
+
+
+-void TLSSocket::sendRaw(const char* buffer, const int count)
++void TLSSocket::sendRaw(const char* buffer, const size_type count)
+ {
+ gnutls_record_send
+ (*m_session->m_gnutlsSession,
+diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
+index 6740995..807ec47 100644
+--- a/src/platforms/posix/posixSocket.cpp
++++ b/src/platforms/posix/posixSocket.cpp
+@@ -217,6 +217,12 @@ void posixSocket::disconnect()
+ }
+
+
++posixSocket::size_type posixSocket::getBlockSize() const
++{
++ return 16384; // 16 KB
++}
++
++
+ void posixSocket::receive(vmime::string& buffer)
+ {
+ const int size = receiveRaw(m_buffer, sizeof(m_buffer));
+@@ -224,7 +230,7 @@ void posixSocket::receive(vmime::string& buffer)
+ }
+
+
+-int posixSocket::receiveRaw(char* buffer, const int count)
++posixSocket::size_type posixSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ const int ret = ::recv(m_desc, buffer, count, 0);
+
+@@ -252,9 +258,9 @@ void posixSocket::send(const vmime::string& buffer)
+ }
+
+
+-void posixSocket::sendRaw(const char* buffer, const int count)
++void posixSocket::sendRaw(const char* buffer, const size_type count)
+ {
+- int size = count;
++ size_type size = count;
+
+ while (size > 0)
+ {
+diff --git a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
+index 8a42583..3ff9ad5 100644
+--- a/src/platforms/windows/windowsSocket.cpp
++++ b/src/platforms/windows/windowsSocket.cpp
+@@ -121,6 +121,12 @@ void windowsSocket::disconnect()
+ }
+
+
++windowsSocket::size_type windowsSocket::getBlockSize() const
++{
++ return 16384; // 16 KB
++}
++
++
+ void windowsSocket::receive(vmime::string& buffer)
+ {
+ int ret = ::recv(m_desc, m_buffer, sizeof(m_buffer), 0);
+@@ -137,7 +143,7 @@ void windowsSocket::receive(vmime::string& buffer)
+ }
+
+
+-int windowsSocket::receiveRaw(char* buffer, const int count)
++windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ int ret = ::recv(m_desc, buffer, count, 0);
+
+@@ -159,7 +165,7 @@ void windowsSocket::send(const vmime::string& buffer)
+ }
+
+
+-void windowsSocket::sendRaw(const char* buffer, const int count)
++void windowsSocket::sendRaw(const char* buffer, const size_type count)
+ {
+ ::send(m_desc, buffer, count, 0);
+ }
+diff --git a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
+index 118429a..d88153e 100644
+--- a/src/security/sasl/SASLSocket.cpp
++++ b/src/security/sasl/SASLSocket.cpp
+@@ -69,6 +69,12 @@ bool SASLSocket::isConnected() const
+ }
+
+
++SASLSocket::size_type SASLSocket::getBlockSize() const
++{
++ return m_wrapped->getBlockSize();
++}
++
++
+ void SASLSocket::receive(string& buffer)
+ {
+ const int n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer));
+@@ -77,7 +83,7 @@ void SASLSocket::receive(string& buffer)
+ }
+
+
+-int SASLSocket::receiveRaw(char* buffer, const int count)
++SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ if (m_pendingLen != 0)
+ {
+@@ -141,7 +147,7 @@ void SASLSocket::send(const string& buffer)
+ }
+
+
+-void SASLSocket::sendRaw(const char* buffer, const int count)
++void SASLSocket::sendRaw(const char* buffer, const size_type count)
+ {
+ byte_t* output = 0;
+ int outputLen = 0;
+diff --git a/src/utility/stream.cpp b/src/utility/stream.cpp
+index 483784c..ec30b7d 100644
+--- a/src/utility/stream.cpp
++++ b/src/utility/stream.cpp
+@@ -470,7 +470,7 @@ void outputStreamSocketAdapter::flush()
+
+ stream::size_type outputStreamSocketAdapter::getBlockSize()
+ {
+- return 16384; // 16 KB
++ return m_socket.getBlockSize();
+ }
+
+
+@@ -513,7 +513,7 @@ stream::size_type inputStreamSocketAdapter::skip
+
+ stream::size_type inputStreamSocketAdapter::getBlockSize()
+ {
+- return 16384; // 16 KB
++ return m_socket.getBlockSize();
+ }
+
+
+diff --git a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp
+index 147c4df..820987b 100644
+--- a/vmime/net/imap/IMAPConnection.hpp
++++ b/vmime/net/imap/IMAPConnection.hpp
+@@ -96,6 +96,8 @@ public:
+ bool isSecuredConnection() const;
+ ref <connectionInfos> getConnectionInfos() const;
+
++ ref <const socket> getSocket() const;
++
+ private:
+
+ void authenticate();
+diff --git a/vmime/net/socket.hpp b/vmime/net/socket.hpp
+index 9b0319c..ec6a9d3 100644
+--- a/vmime/net/socket.hpp
++++ b/vmime/net/socket.hpp
+@@ -41,6 +41,11 @@ public:
+
+ virtual ~socket() { }
+
++ /** Type used for lengths in streams.
++ */
++ typedef int size_type;
++
++
+ /** Connect to the specified address and port.
+ *
+ * @param address server address (this can be a full qualified domain name
+@@ -71,7 +76,7 @@ public:
+ * @param count maximum number of bytes to receive (size of buffer)
+ * @return number of bytes received/written into output buffer
+ */
+- virtual int receiveRaw(char* buffer, const int count) = 0;
++ virtual int receiveRaw(char* buffer, const size_type count) = 0;
+
+ /** Send (text) data to the socket.
+ *
+@@ -84,7 +89,14 @@ public:
+ * @param buffer data to send
+ * @param count number of bytes to send (size of buffer)
+ */
+- virtual void sendRaw(const char* buffer, const int count) = 0;
++ virtual void sendRaw(const char* buffer, const size_type count) = 0;
++
++ /** Return the preferred maximum block size when reading
++ * from or writing to this stream.
++ *
++ * @return block size, in bytes
++ */
++ virtual size_type getBlockSize() const = 0;
+
+ protected:
+
+diff --git a/vmime/net/tls/TLSSocket.hpp b/vmime/net/tls/TLSSocket.hpp
+index 5112550..7c38970 100644
+--- a/vmime/net/tls/TLSSocket.hpp
++++ b/vmime/net/tls/TLSSocket.hpp
+@@ -84,10 +84,12 @@ public:
+ bool isConnected() const;
+
+ void receive(string& buffer);
+- int receiveRaw(char* buffer, const int count);
++ size_type receiveRaw(char* buffer, const size_type count);
+
+ void send(const string& buffer);
+- void sendRaw(const char* buffer, const int count);
++ void sendRaw(const char* buffer, const size_type count);
++
++ size_type getBlockSize() const;
+
+ private:
+
+diff --git a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixSocket.hpp
+index 0d0dae6..9cd49d4 100644
+--- a/vmime/platforms/posix/posixSocket.hpp
++++ b/vmime/platforms/posix/posixSocket.hpp
+@@ -48,10 +48,12 @@ public:
+ void disconnect();
+
+ void receive(vmime::string& buffer);
+- int receiveRaw(char* buffer, const int count);
++ size_type receiveRaw(char* buffer, const size_type count);
+
+ void send(const vmime::string& buffer);
+- void sendRaw(const char* buffer, const int count);
++ void sendRaw(const char* buffer, const size_type count);
++
++ size_type getBlockSize() const;
+
+ protected:
+
+diff --git a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/windowsSocket.hpp
+index 61475c3..2940157 100644
+--- a/vmime/platforms/windows/windowsSocket.hpp
++++ b/vmime/platforms/windows/windowsSocket.hpp
+@@ -50,10 +50,12 @@ public:
+ void disconnect();
+
+ void receive(vmime::string& buffer);
+- int receiveRaw(char* buffer, const int count);
++ size_type receiveRaw(char* buffer, const size_type count);
+
+ void send(const vmime::string& buffer);
+- void sendRaw(const char* buffer, const int count);
++ void sendRaw(const char* buffer, const size_type count);
++
++ size_type getBlockSize() const;
+
+ private:
+
+diff --git a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.hpp
+index 3ff27e3..0348331 100644
+--- a/vmime/security/sasl/SASLSocket.hpp
++++ b/vmime/security/sasl/SASLSocket.hpp
+@@ -53,10 +53,12 @@ public:
+ bool isConnected() const;
+
+ void receive(string& buffer);
+- int receiveRaw(char* buffer, const int count);
++ size_type receiveRaw(char* buffer, const size_type count);
+
+ void send(const string& buffer);
+- void sendRaw(const char* buffer, const int count);
++ void sendRaw(const char* buffer, const size_type count);
++
++ size_type getBlockSize() const;
+
+ private:
+
+
+commit 4e36e8816b57fc2f8b34be327f4b67a0366b6664
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 1 13:23:26 2009 +0000
+
+ Fixed missing function.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@511 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp
+index 456b8ad..ee17c92 100644
+--- a/tests/testUtils.cpp
++++ b/tests/testUtils.cpp
+@@ -51,6 +51,12 @@ bool testSocket::isConnected() const
+ }
+
+
++testSocket::size_type testSocket::getBlockSize() const
++{
++ return 16384;
++}
++
++
+ void testSocket::receive(vmime::string& buffer)
+ {
+ buffer = m_inBuffer;
+diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp
+index 96daba8..227d1b3 100644
+--- a/tests/testUtils.hpp
++++ b/tests/testUtils.hpp
+@@ -216,6 +216,8 @@ public:
+ int receiveRaw(char* buffer, const int count);
+ void sendRaw(const char* buffer, const int count);
+
++ size_type getBlockSize() const;
++
+ /** Send data to client.
+ *
+ * @buffer data to send
+
+commit fdc04f8dfd184c980b0a34d0297c41b5831edab0
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 1 13:24:38 2009 +0000
+
+ Added and moved tests for RFC-2231.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@512 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
+index fb7a429..6d24438 100644
+--- a/tests/parser/parameterTest.cpp
++++ b/tests/parser/parameterTest.cpp
+@@ -32,7 +32,9 @@ VMIME_TEST_SUITE_BEGIN
+
+ VMIME_TEST_LIST_BEGIN
+ VMIME_TEST(testParse)
++ VMIME_TEST(testParseRFC2231)
+ VMIME_TEST(testGenerate)
++ VMIME_TEST(testGenerateRFC2231)
+ VMIME_TEST(testNonStandardEncodedParam)
+ VMIME_TEST_LIST_END
+
+@@ -134,57 +136,60 @@ VMIME_TEST_SUITE_BEGIN
+ VASSERT_EQ("7.1", 1, p7.getParameterCount());
+ VASSERT_EQ("7.2", "param1", PARAM_NAME(p7, 0));
+ VASSERT_EQ("7.3", "this is a slash: \"\\\"", PARAM_VALUE(p7, 0));
++ }
+
++ void testParseRFC2231()
++ {
+ // Extended parameter with charset specified in more than one
+ // section (this is forbidden by RFC, but is should not fail)
+- parameterizedHeaderField p8;
+- p8.parse("X; param1*0*=charset1'language1'value1;\r\n"
+- " param1*1*=charset2'language2'value2;");
++ parameterizedHeaderField p1;
++ p1.parse("X; param1*0*=charset1'language1'value1;\r\n"
++ " param1*1*=charset2'language2'value2;");
+
+- VASSERT_EQ("8.1", 1, p8.getParameterCount());
+- VASSERT_EQ("8.2", "param1", PARAM_NAME(p8, 0));
+- VASSERT_EQ("8.3", "charset1", PARAM_CHARSET(p8, 0));
+- VASSERT_EQ("8.4", "value1charset2'language2'value2", PARAM_BUFFER(p8, 0));
++ VASSERT_EQ("1.1", 1, p1.getParameterCount());
++ VASSERT_EQ("1.2", "param1", PARAM_NAME(p1, 0));
++ VASSERT_EQ("1.3", "charset1", PARAM_CHARSET(p1, 0));
++ VASSERT_EQ("1.4", "value1charset2'language2'value2", PARAM_BUFFER(p1, 0));
+
+ // Charset not specified in the first section (that is not encoded),
+ // but specified in the second one (legal)
+- parameterizedHeaderField p9;
+- p9.parse("X; param1*0=value1;\r\n"
+- " param1*1*=charset'language'value2;");
++ parameterizedHeaderField p2;
++ p2.parse("X; param1*0=value1;\r\n"
++ " param1*1*=charset'language'value2;");
+
+- VASSERT_EQ("9.1", 1, p9.getParameterCount());
+- VASSERT_EQ("9.2", "param1", PARAM_NAME(p9, 0));
+- VASSERT_EQ("9.3", "charset", PARAM_CHARSET(p9, 0));
+- VASSERT_EQ("9.4", "value1value2", PARAM_BUFFER(p9, 0));
++ VASSERT_EQ("2.1", 1, p2.getParameterCount());
++ VASSERT_EQ("2.2", "param1", PARAM_NAME(p2, 0));
++ VASSERT_EQ("2.3", "charset", PARAM_CHARSET(p2, 0));
++ VASSERT_EQ("2.4", "value1value2", PARAM_BUFFER(p2, 0));
+
+ // Characters prefixed with '%' in a simple (not extended) section
+ // should not be decoded
+- parameterizedHeaderField p10;
+- p10.parse("X; param1=val%20ue1");
++ parameterizedHeaderField p3;
++ p3.parse("X; param1=val%20ue1");
+
+- VASSERT_EQ("10.1", 1, p10.getParameterCount());
+- VASSERT_EQ("10.2", "param1", PARAM_NAME(p10, 0));
+- VASSERT_EQ("10.3", "val%20ue1", PARAM_VALUE(p10, 0));
++ VASSERT_EQ("3.1", 1, p3.getParameterCount());
++ VASSERT_EQ("3.2", "param1", PARAM_NAME(p3, 0));
++ VASSERT_EQ("3.3", "val%20ue1", PARAM_VALUE(p3, 0));
+
+ // Multiple sections + charset specified and encoding
+- parameterizedHeaderField p11;
+- p11.parse("X; param1*0*=charset'language'value1a%20;"
+- " param1*1*=value1b%20;"
+- " param1*2=value1c");
++ parameterizedHeaderField p4;
++ p4.parse("X; param1*0*=charset'language'value1a%20;"
++ " param1*1*=value1b%20;"
++ " param1*2=value1c");
+
+- VASSERT_EQ("11.1", 1, p11.getParameterCount());
+- VASSERT_EQ("11.2", "param1", PARAM_NAME(p11, 0));
+- VASSERT_EQ("11.3", "charset", PARAM_CHARSET(p11, 0));
+- VASSERT_EQ("11.4", "value1a value1b value1c", PARAM_BUFFER(p11, 0));
++ VASSERT_EQ("4.1", 1, p4.getParameterCount());
++ VASSERT_EQ("4.2", "param1", PARAM_NAME(p4, 0));
++ VASSERT_EQ("4.3", "charset", PARAM_CHARSET(p4, 0));
++ VASSERT_EQ("4.4", "value1a value1b value1c", PARAM_BUFFER(p4, 0));
+
+ // No charset specified: defaults to US-ASCII
+- parameterizedHeaderField p12;
+- p12.parse("X; param1*='language'value1");
++ parameterizedHeaderField p5;
++ p5.parse("X; param1*='language'value1");
+
+- VASSERT_EQ("12.1", 1, p12.getParameterCount());
+- VASSERT_EQ("12.2", "param1", PARAM_NAME(p12, 0));
+- VASSERT_EQ("12.3", "us-ascii", PARAM_CHARSET(p12, 0));
+- VASSERT_EQ("12.4", "value1", PARAM_BUFFER(p12, 0));
++ VASSERT_EQ("5.1", 1, p5.getParameterCount());
++ VASSERT_EQ("5.2", "param1", PARAM_NAME(p5, 0));
++ VASSERT_EQ("5.3", "us-ascii", PARAM_CHARSET(p5, 0));
++ VASSERT_EQ("5.4", "value1", PARAM_BUFFER(p5, 0));
+ }
+
+ void testGenerate()
+@@ -206,21 +211,24 @@ VMIME_TEST_SUITE_BEGIN
+ p2b.appendParameter(vmime::create <vmime::parameter>("param1", "va\\lue\"1"));
+
+ VASSERT_EQ("2b", "F: X; param1=\"va\\\\lue\\\"1\"", p2b.generate());
++ }
+
++ void testGenerateRFC2231()
++ {
+ // Extended parameter with charset specifier
+- parameterizedHeaderField p3;
+- p3.appendParameter(vmime::create <vmime::parameter>("param1",
++ parameterizedHeaderField p1;
++ p1.appendParameter(vmime::create <vmime::parameter>("param1",
+ vmime::word("value 1\xe9", vmime::charset("charset"))));
+
+- VASSERT_EQ("3", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p3.generate());
++ VASSERT_EQ("1", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p1.generate());
+
+ // Value that spans on multiple lines
+- parameterizedHeaderField p4;
+- p4.appendParameter(vmime::create <vmime::parameter>("param1",
++ parameterizedHeaderField p2;
++ p2.appendParameter(vmime::create <vmime::parameter>("param1",
+ vmime::word("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ vmime::charset("charset"))));
+
+- VASSERT_EQ("4", "F: X; \r\n "
++ VASSERT_EQ("2", "F: X; \r\n "
+ "param1=abcdefghijklm;\r\n "
+ "param1*0*=charset''abc;\r\n "
+ "param1*1*=defghijkl;\r\n "
+@@ -228,7 +236,23 @@ VMIME_TEST_SUITE_BEGIN
+ "param1*3*=vwxyzABCD;\r\n "
+ "param1*4*=EFGHIJKLM;\r\n "
+ "param1*5*=NOPQRSTUV;\r\n "
+- "param1*6*=WXYZ", p4.generate(25)); // max line length = 25
++ "param1*6*=WXYZ", p2.generate(25)); // max line length = 25
++
++ // Non-ASCII parameter value
++ parameterizedHeaderField p3;
++ p3.appendParameter(vmime::create <vmime::parameter>("param1",
++ vmime::word("δσσσσσσσσσσσσσσσσσσσσδσδα δσαδσδσαδσαδασδασ δσαδασδσα δσαδασδσα δασδασδασ δασαχφδδσα 2008.doc",
++ vmime::charset("utf-8"))));
++
++ VASSERT_EQ("3", "F: X; \r\n "
++ "param1=\" 2008.doc\";param1*0*=utf-8''%CE%B4%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
++ "param1*1*=%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
++ "param1*2*=%CE%B4%CF%83%CE%B4%CE%B1%20%CE%B4%CF%83%CE%B1%CE%B4%CF%83%CE%B4%CF;\r\n "
++ "param1*3*=%83%CE%B1%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20;\r\n "
++ "param1*4*=%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CF;\r\n "
++ "param1*5*=%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CE%B1%CF%83;\r\n "
++ "param1*6*=%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20%CE%B4%CE%B1%CF%83%CE%B1%CF;\r\n "
++ "param1*7*=%87%CF%86%CE%B4%CE%B4%CF%83%CE%B1%202008.doc", p3.generate(80));
+ }
+
+ void testNonStandardEncodedParam()
+
+commit 6687ee18d8364bb3c5da17199abf55213d2fc665
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 1 13:44:34 2009 +0000
+
+ Added option to return ISO week-numbering instead of default calendar-numbering.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@513 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/datetimeUtils.cpp b/src/utility/datetimeUtils.cpp
+index cf05a93..6ea5be6 100644
+--- a/src/utility/datetimeUtils.cpp
++++ b/src/utility/datetimeUtils.cpp
+@@ -256,7 +256,7 @@ int datetimeUtils::getDayOfWeek(const int year, const int month, const int day)
+ }
+
+
+-int datetimeUtils::getWeekOfYear(const int year, const int month, const int day)
++int datetimeUtils::getWeekOfYear(const int year, const int month, const int day, const bool iso)
+ {
+ // Algorithm from http://personal.ecu.edu/mccartyr/ISOwdALG.txt
+
+@@ -322,7 +322,7 @@ int datetimeUtils::getWeekOfYear(const int year, const int month, const int day)
+ WeekNumber -= 1;
+ }
+
+- if (WeekNumber == 1 && month == 12)
++ if (!iso && (WeekNumber == 1 && month == 12))
+ WeekNumber = 53;
+
+ return WeekNumber;
+diff --git a/tests/utility/datetimeUtilsTest.cpp b/tests/utility/datetimeUtilsTest.cpp
+index 4fd3e43..4671e75 100644
+--- a/tests/utility/datetimeUtilsTest.cpp
++++ b/tests/utility/datetimeUtilsTest.cpp
+@@ -143,10 +143,11 @@ VMIME_TEST_SUITE_BEGIN
+ {
+ VASSERT_EQ("1.1", 52, datetimeUtils::getWeekOfYear(2003, 12, 27));
+ VASSERT_EQ("1.2", 52, datetimeUtils::getWeekOfYear(2003, 12, 28));
+- VASSERT_EQ("1.3", 1, datetimeUtils::getWeekOfYear(2003, 12, 29));
+- VASSERT_EQ("1.4", 1, datetimeUtils::getWeekOfYear(2004, 1, 4));
+- VASSERT_EQ("1.5", 2, datetimeUtils::getWeekOfYear(2004, 1, 5));
+- VASSERT_EQ("1.6", 2, datetimeUtils::getWeekOfYear(2004, 1, 11));
++ VASSERT_EQ("1.3", 1, datetimeUtils::getWeekOfYear(2003, 12, 29, true));
++ VASSERT_EQ("1.4", 53, datetimeUtils::getWeekOfYear(2003, 12, 29, false));
++ VASSERT_EQ("1.5", 1, datetimeUtils::getWeekOfYear(2004, 1, 4));
++ VASSERT_EQ("1.6", 2, datetimeUtils::getWeekOfYear(2004, 1, 5));
++ VASSERT_EQ("1.7", 2, datetimeUtils::getWeekOfYear(2004, 1, 11));
+
+ VASSERT_EQ("2.1", 52, datetimeUtils::getWeekOfYear(2004, 12, 26));
+ VASSERT_EQ("2.2", 53, datetimeUtils::getWeekOfYear(2004, 12, 27));
+diff --git a/vmime/utility/datetimeUtils.hpp b/vmime/utility/datetimeUtils.hpp
+index b56533c..d5f89be 100644
+--- a/vmime/utility/datetimeUtils.hpp
++++ b/vmime/utility/datetimeUtils.hpp
+@@ -84,9 +84,11 @@ public:
+ * @param year year in 4-digit format
+ * @param month month (1-12), January is 1, December is 12 (see datetime::Months enum)
+ * @param day month day (1-31)
++ * @param iso if TRUE, use ISO week-numbering year (default is to use calendar year).
++ * For more information, read here: http://en.wikipedia.org/wiki/ISO_8601#Week_dates
+ * @return the week number (1 is the first week of the year)
+ */
+- static int getWeekOfYear(const int year, const int month, const int day);
++ static int getWeekOfYear(const int year, const int month, const int day, const bool iso = false);
+ };
+
+
+
+commit 3b5ccb4334651cc9ba9b99259d44dc9e47d8e22a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 1 14:24:55 2009 +0000
+
+ Fixed directory renaming.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@514 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index 7ee9f19..b814b75 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -396,7 +396,11 @@ void posixFile::rename(const path& newName)
+ const vmime::string newNativePath = posixFileSystemFactory::pathToStringImpl(newName);
+
+ posixFile dest(newName);
+- dest.createFile();
++
++ if (isDirectory())
++ dest.createDirectory();
++ else
++ dest.createFile();
+
+ if (::rename(m_nativePath.c_str(), newNativePath.c_str()) == -1)
+ posixFileSystemFactory::reportError(m_path, errno);
+diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
+index 5aad90b..5f8c703 100644
+--- a/tests/net/maildir/maildirStoreTest.cpp
++++ b/tests/net/maildir/maildirStoreTest.cpp
+@@ -322,12 +322,28 @@ public:
+
+ void testRenameFolder_KMail()
+ {
+- testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
++ try
++ {
++ testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
++ }
++ catch (vmime::exception& e)
++ {
++ std::cerr << e;
++ throw e;
++ }
+ }
+
+ void testRenameFolder_Courier()
+ {
+- testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
++ try
++ {
++ testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
++ }
++ catch (vmime::exception& e)
++ {
++ std::cerr << e;
++ throw e;
++ }
+ }
+
+ void testRenameFolderImpl(const vmime::string* const dirs, const vmime::string* const files)
+diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp
+index ee17c92..36455cf 100644
+--- a/tests/testUtils.cpp
++++ b/tests/testUtils.cpp
+@@ -187,3 +187,61 @@ vmime::ref <vmime::net::timeoutHandler> testTimeoutHandlerFactory::create()
+ return vmime::create <testTimeoutHandler>();
+ }
+
++
++
++// Exception helper
++std::ostream& operator<<(std::ostream& os, const vmime::exception& e)
++{
++ os << "* vmime::exceptions::" << e.name() << std::endl;
++ os << " what = " << e.what() << std::endl;
++
++ // More information for special exceptions
++ if (dynamic_cast <const vmime::exceptions::command_error*>(&e))
++ {
++ const vmime::exceptions::command_error& cee =
++ dynamic_cast <const vmime::exceptions::command_error&>(e);
++
++ os << " command = " << cee.command() << std::endl;
++ os << " response = " << cee.response() << std::endl;
++ }
++
++ if (dynamic_cast <const vmime::exceptions::invalid_response*>(&e))
++ {
++ const vmime::exceptions::invalid_response& ir =
++ dynamic_cast <const vmime::exceptions::invalid_response&>(e);
++
++ os << " response = " << ir.response() << std::endl;
++ }
++
++ if (dynamic_cast <const vmime::exceptions::connection_greeting_error*>(&e))
++ {
++ const vmime::exceptions::connection_greeting_error& cgee =
++ dynamic_cast <const vmime::exceptions::connection_greeting_error&>(e);
++
++ os << " response = " << cgee.response() << std::endl;
++ }
++
++ if (dynamic_cast <const vmime::exceptions::authentication_error*>(&e))
++ {
++ const vmime::exceptions::authentication_error& aee =
++ dynamic_cast <const vmime::exceptions::authentication_error&>(e);
++
++ os << " response = " << aee.response() << std::endl;
++ }
++
++ if (dynamic_cast <const vmime::exceptions::filesystem_exception*>(&e))
++ {
++ const vmime::exceptions::filesystem_exception& fse =
++ dynamic_cast <const vmime::exceptions::filesystem_exception&>(e);
++
++ os << " path = " << vmime::platform::getHandler()->
++ getFileSystemFactory()->pathToString(fse.path()) << std::endl;
++ }
++
++ if (e.other() != NULL)
++ os << *e.other();
++
++ return os;
++}
++
++
+diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp
+index 227d1b3..9aee153 100644
+--- a/tests/testUtils.hpp
++++ b/tests/testUtils.hpp
+@@ -305,3 +305,7 @@ public:
+ vmime::ref <vmime::net::timeoutHandler> create();
+ };
+
++
++// Exception helper
++std::ostream& operator<<(std::ostream& os, const vmime::exception& e);
++
+
+commit 75b25e29e28fd00ae2e92c28baed98f62838e119
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Dec 2 11:49:00 2009 +0000
+
+ Fixed compilation issue with Intel Compiler (thanks to Eric Trinh for report).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@515 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/vmime/propertySet.hpp b/vmime/propertySet.hpp
+index e5cbf1f..e5e91dd 100644
+--- a/vmime/propertySet.hpp
++++ b/vmime/propertySet.hpp
+@@ -432,7 +432,7 @@ public:
+
+ #ifndef VMIME_INLINE_TEMPLATE_SPECIALIZATION
+
+-template <> void propertySet::property::setValue(const string& value);
++template <> void propertySet::property::setValue <string>(const string& value);
+ template <> void propertySet::property::setValue(const bool& value);
+
+ template <> string propertySet::property::getValue() const;
+
+commit e46c5fc23527db2409e872020f0e007f98e13c2d
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 8 09:31:06 2009 +0000
+
+ Initialize multi-threading for GNUTLS/GCrypt (thanks to Bartek Szurgot).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@516 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
+index 1146d1b..d4eab3e 100644
+--- a/src/net/tls/TLSSession.cpp
++++ b/src/net/tls/TLSSession.cpp
+@@ -24,6 +24,13 @@
+ #include <gnutls/gnutls.h>
+ #include <gnutls/extra.h>
+
++#include "vmime/config.hpp"
++
++#if VMIME_HAVE_PTHREAD
++# include <gcrypt.h>
++# include <errno.h>
++#endif // VMIME_HAVE_PTHREAD
++
+ #include "vmime/net/tls/TLSSession.hpp"
+
+ #include "vmime/exception.hpp"
+@@ -38,6 +45,14 @@
+ #endif // VMIME_DEBUG && GNUTLS_DEBUG
+
+
++#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
++extern "C"
++{
++ GCRY_THREAD_OPTION_PTHREAD_IMPL;
++}
++#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
++
++
+ namespace vmime {
+ namespace net {
+ namespace tls {
+@@ -50,6 +65,10 @@ struct TLSGlobal
+ {
+ TLSGlobal()
+ {
++#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
++ gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
++#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
++
+ gnutls_global_init();
+ //gnutls_global_init_extra();
+
+
+commit 9e4d59d30924211495daf8c96fa8bb94537a9447
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 8 10:03:34 2009 +0000
+
+ Fixed not exception-safe constructor, which could lead to possible memory leak (thanks to Bartek Szurgot). Get rid of const-ness on factories.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@517 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/AUTHORS b/AUTHORS
+index 8391c18..f0b5e2d 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -19,6 +19,7 @@ VMIME CONTRIBUTORS
+ - Georg Sauthoff <gsauthof@techfak.uni-bielefeld.de>
+ - Pierre Thierry <nowhere.man@levallois.eu.org> (patches for STL algorithms)
+ - Zarafa <http://developer.zarafa.com/VmimePatches>
++ - Bartek Szurgot <vempirelord@wp.pl, http://baszerr.org>
+
+ Please apologize if I have forgotten someone here. ;)
+ See SVN Changelog for full list.
+diff --git a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp
+index 6dbda80..721517e 100644
+--- a/src/net/maildir/format/courierMaildirFormat.cpp
++++ b/src/net/maildir/format/courierMaildirFormat.cpp
+@@ -49,7 +49,7 @@ const string courierMaildirFormat::getName() const
+
+ void courierMaildirFormat::createFolder(const folder::path& path)
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY)))
+ throw exceptions::invalid_folder_name();
+@@ -80,7 +80,7 @@ void courierMaildirFormat::createFolder(const folder::path& path)
+
+ void courierMaildirFormat::destroyFolder(const folder::path& path)
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ // Recursively delete directories of subfolders
+ const std::vector <folder::path> folders = listFolders(path, true);
+@@ -119,7 +119,7 @@ void courierMaildirFormat::renameFolder
+ void courierMaildirFormat::renameFolderImpl
+ (const folder::path& oldPath, const folder::path& newPath)
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ const utility::file::path oldFSPath =
+ folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY);
+@@ -134,7 +134,7 @@ void courierMaildirFormat::renameFolderImpl
+
+ bool courierMaildirFormat::folderExists(const folder::path& path) const
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create
+ (folderPathToFileSystemPath(path, ROOT_DIRECTORY));
+@@ -254,7 +254,7 @@ const std::vector <folder::path> courierMaildirFormat::listFolders
+ bool courierMaildirFormat::listDirectories(const folder::path& root,
+ std::vector <string>& dirs, const bool onlyTestForExistence) const
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create
+ (getContext()->getStore()->getFileSystemPath());
+@@ -496,7 +496,7 @@ const folder::path::component courierMaildirFormat::fromModifiedUTF7(const strin
+
+ bool courierMaildirFormat::supports() const
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create
+ (getContext()->getStore()->getFileSystemPath());
+diff --git a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp
+index 5fb75fe..a21d106 100644
+--- a/src/net/maildir/format/kmailMaildirFormat.cpp
++++ b/src/net/maildir/format/kmailMaildirFormat.cpp
+@@ -49,7 +49,7 @@ const string kmailMaildirFormat::getName() const
+
+ void kmailMaildirFormat::createFolder(const folder::path& path)
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY)))
+ throw exceptions::invalid_folder_name();
+@@ -75,7 +75,7 @@ void kmailMaildirFormat::createFolder(const folder::path& path)
+ void kmailMaildirFormat::destroyFolder(const folder::path& path)
+ {
+ // Delete 'folder' and '.folder.directory' directories
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ maildirUtils::recursiveFSDelete(fsf->create
+ (folderPathToFileSystemPath(path, ROOT_DIRECTORY))); // root
+@@ -87,7 +87,7 @@ void kmailMaildirFormat::destroyFolder(const folder::path& path)
+
+ bool kmailMaildirFormat::folderExists(const folder::path& path) const
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create
+ (folderPathToFileSystemPath(path, ROOT_DIRECTORY));
+@@ -177,7 +177,7 @@ const std::vector <folder::path> kmailMaildirFormat::listFolders
+ void kmailMaildirFormat::listFoldersImpl
+ (std::vector <folder::path>& list, const folder::path& root, const bool recursive) const
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create(folderPathToFileSystemPath(root,
+ root.isEmpty() ? ROOT_DIRECTORY : CONTAINER_DIRECTORY));
+@@ -226,7 +226,7 @@ bool kmailMaildirFormat::isSubfolderDirectory(const utility::file& file)
+
+ void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder::path& newPath)
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create
+ (folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY));
+@@ -277,7 +277,7 @@ void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder:
+
+ bool kmailMaildirFormat::folderHasSubfolders(const folder::path& path) const
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> rootDir = fsf->create
+ (folderPathToFileSystemPath(path, CONTAINER_DIRECTORY));
+diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
+index 3e361ae..dd680c9 100644
+--- a/src/net/maildir/maildirFolder.cpp
++++ b/src/net/maildir/maildirFolder.cpp
+@@ -264,7 +264,7 @@ void maildirFolder::scanFolder()
+ m_messageCount = 0;
+ m_unreadMessageCount = 0;
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ utility::file::path newDirPath = store->getFormat()->folderPathToFileSystemPath
+ (m_path, maildirFormat::NEW_DIRECTORY);
+@@ -760,7 +760,7 @@ void maildirFolder::setMessageFlagsImpl
+ {
+ ref <maildirStore> store = m_store.acquire();
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ utility::file::path curDirPath = store->getFormat()->
+ folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
+@@ -832,7 +832,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size,
+ else if (m_mode == MODE_READ_ONLY)
+ throw exceptions::illegal_state("Folder is read-only");
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ utility::file::path tmpDirPath = store->getFormat()->
+ folderPathToFileSystemPath(m_path,maildirFormat::TMP_DIRECTORY);
+@@ -918,7 +918,7 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
+ utility::inputStream& is, const utility::stream::size_type size,
+ utility::progressListener* progress)
+ {
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ ref <utility::file> file = fsf->create(tmpDirPath / filename);
+
+@@ -1058,7 +1058,7 @@ void maildirFolder::copyMessagesImpl(const folder::path& dest, const std::vector
+ {
+ ref <maildirStore> store = m_store.acquire();
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ utility::file::path curDirPath = store->getFormat()->folderPathToFileSystemPath
+ (m_path, maildirFormat::CUR_DIRECTORY);
+@@ -1200,7 +1200,7 @@ void maildirFolder::expunge()
+ else if (m_mode == MODE_READ_ONLY)
+ throw exceptions::illegal_state("Folder is read-only");
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ utility::file::path curDirPath = store->getFormat()->
+ folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
+diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
+index ed87cdb..8999d84 100644
+--- a/src/net/maildir/maildirMessage.cpp
++++ b/src/net/maildir/maildirMessage.cpp
+@@ -346,7 +346,7 @@ void maildirMessage::extractImpl(utility::outputStream& os, utility::progressLis
+ {
+ ref <const maildirFolder> folder = m_folder.acquire();
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ const utility::file::path path = folder->getMessageFSPath(m_num);
+ ref <utility::file> file = fsf->create(path);
+@@ -393,7 +393,7 @@ void maildirMessage::fetchPartHeader(ref <part> p)
+
+ ref <maildirPart> mp = p.dynamicCast <maildirPart>();
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ const utility::file::path path = folder->getMessageFSPath(m_num);
+ ref <utility::file> file = fsf->create(path);
+@@ -430,7 +430,7 @@ void maildirMessage::fetch(ref <maildirFolder> msgFolder, const int options)
+ if (folder != msgFolder)
+ throw exceptions::folder_not_found();
+
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ const utility::file::path path = folder->getMessageFSPath(m_num);
+ ref <utility::file> file = fsf->create(path);
+diff --git a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp
+index 3b77024..26f4593 100644
+--- a/src/net/maildir/maildirStore.cpp
++++ b/src/net/maildir/maildirStore.cpp
+@@ -132,7 +132,7 @@ void maildirStore::connect()
+ throw exceptions::already_connected();
+
+ // Get root directory
+- utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++ ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+
+ m_fsPath = fsf->stringToPath(GET_PROPERTY(string, PROPERTY_SERVER_ROOTPATH));
+
+diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
+index f43972e..104bc40 100644
+--- a/src/platforms/posix/posixHandler.cpp
++++ b/src/platforms/posix/posixHandler.cpp
+@@ -55,18 +55,14 @@ posixHandler::posixHandler()
+ m_socketFactory = vmime::create <posixSocketFactory>();
+ #endif
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+- m_fileSysFactory = new posixFileSystemFactory();
+- m_childProcFactory = new posixChildProcessFactory();
++ m_fileSysFactory = vmime::create <posixFileSystemFactory>();
++ m_childProcFactory = vmime::create <posixChildProcessFactory>();
+ #endif
+ }
+
+
+ posixHandler::~posixHandler()
+ {
+-#if VMIME_HAVE_FILESYSTEM_FEATURES
+- delete (m_fileSysFactory);
+- delete (m_childProcFactory);
+-#endif
+ }
+
+
+@@ -173,9 +169,9 @@ unsigned int posixHandler::getProcessId() const
+
+ #if VMIME_HAVE_MESSAGING_FEATURES
+
+-ref <vmime::net::socketFactory> posixHandler::getSocketFactory() const
++ref <vmime::net::socketFactory> posixHandler::getSocketFactory()
+ {
+- return m_socketFactory.dynamicCast <vmime::net::socketFactory>();
++ return m_socketFactory;
+ }
+
+ #endif
+@@ -183,15 +179,15 @@ ref <vmime::net::socketFactory> posixHandler::getSocketFactory() const
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+
+-vmime::utility::fileSystemFactory* posixHandler::getFileSystemFactory() const
++ref <vmime::utility::fileSystemFactory> posixHandler::getFileSystemFactory()
+ {
+- return (m_fileSysFactory);
++ return m_fileSysFactory;
+ }
+
+
+-vmime::utility::childProcessFactory* posixHandler::getChildProcessFactory() const
++ref <vmime::utility::childProcessFactory> posixHandler::getChildProcessFactory()
+ {
+- return (m_childProcFactory);
++ return m_childProcFactory;
+ }
+
+ #endif
+diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
+index 404d3cb..1a37c83 100644
+--- a/src/platforms/windows/windowsHandler.cpp
++++ b/src/platforms/windows/windowsHandler.cpp
+@@ -49,17 +49,13 @@ windowsHandler::windowsHandler()
+ m_socketFactory = vmime::create <windowsSocketFactory>();
+ #endif
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+- m_fileSysFactory = new windowsFileSystemFactory();
++ m_fileSysFactory = vmime::create <windowsFileSystemFactory>();
+ #endif
+ }
+
+
+ windowsHandler::~windowsHandler()
+ {
+-#if VMIME_HAVE_FILESYSTEM_FEATURES
+- delete (m_fileSysFactory);
+-#endif
+-
+ WSACleanup();
+ }
+
+@@ -240,9 +236,9 @@ unsigned int windowsHandler::getProcessId() const
+
+ #if VMIME_HAVE_MESSAGING_FEATURES
+
+-ref <vmime::net::socketFactory> windowsHandler::getSocketFactory() const
++ref <vmime::net::socketFactory> windowsHandler::getSocketFactory()
+ {
+- return m_socketFactory.dynamicCast <vmime::net::socketFactory>();
++ return m_socketFactory;
+ }
+
+ #endif
+@@ -250,13 +246,13 @@ ref <vmime::net::socketFactory> windowsHandler::getSocketFactory() const
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+
+-vmime::utility::fileSystemFactory* windowsHandler::getFileSystemFactory() const
++ref <vmime::utility::fileSystemFactory> windowsHandler::getFileSystemFactory()
+ {
+- return (m_fileSysFactory);
++ return m_fileSysFactory;
+ }
+
+
+-vmime::utility::childProcessFactory* windowsHandler::getChildProcessFactory() const
++ref <vmime::utility::childProcessFactory> windowsHandler::getChildProcessFactory()
+ {
+ // TODO: Not implemented
+ return (NULL);
+diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
+index 5f8c703..3b1980e 100644
+--- a/tests/net/maildir/maildirStoreTest.cpp
++++ b/tests/net/maildir/maildirStoreTest.cpp
+@@ -501,7 +501,7 @@ private:
+
+ const vmime::utility::url getStoreURL()
+ {
+- vmime::utility::fileSystemFactory* fsf =
++ vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::platform::getHandler()->getFileSystemFactory();
+
+ vmime::utility::url url(std::string("maildir://localhost")
+@@ -512,7 +512,7 @@ private:
+
+ void createMaildir(const vmime::string* const dirs, const vmime::string* const files)
+ {
+- vmime::utility::fileSystemFactory* fsf =
++ vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::platform::getHandler()->getFileSystemFactory();
+
+ vmime::ref <vmime::utility::file> rootDir = fsf->create(m_tempPath);
+@@ -544,7 +544,7 @@ private:
+
+ void destroyMaildir()
+ {
+- vmime::utility::fileSystemFactory* fsf =
++ vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::platform::getHandler()->getFileSystemFactory();
+
+ recursiveDelete(fsf->create(m_tempPath));
+diff --git a/vmime/platform.hpp b/vmime/platform.hpp
+index d390571..0281554 100644
+--- a/vmime/platform.hpp
++++ b/vmime/platform.hpp
+@@ -108,7 +108,7 @@ public:
+ *
+ * @return socket factory
+ */
+- virtual ref <net::socketFactory> getSocketFactory() const = 0;
++ virtual ref <net::socketFactory> getSocketFactory() = 0;
+ #endif
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+@@ -116,14 +116,14 @@ public:
+ *
+ * @return file-system factory
+ */
+- virtual utility::fileSystemFactory* getFileSystemFactory() const = 0;
++ virtual ref <utility::fileSystemFactory> getFileSystemFactory() = 0;
+
+ /** Return a pointer to a factory that creates child process objects,
+ * which are used to spawn processes (run executable files).
+ *
+ * @return child process factory
+ */
+- virtual utility::childProcessFactory* getChildProcessFactory() const = 0;
++ virtual ref <utility::childProcessFactory> getChildProcessFactory() = 0;
+ #endif
+
+ };
+@@ -135,7 +135,7 @@ public:
+ sm_handler = vmime::create <TYPE>();
+ }
+
+- static ref <const handler> getHandler()
++ static ref <handler> getHandler()
+ {
+ if (!sm_handler)
+ throw exceptions::no_platform_handler();
+diff --git a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp
+index 397a5dd..8e572a2 100644
+--- a/vmime/platforms/posix/posixHandler.hpp
++++ b/vmime/platforms/posix/posixHandler.hpp
+@@ -61,13 +61,13 @@ public:
+ unsigned int getProcessId() const;
+
+ #if VMIME_HAVE_MESSAGING_FEATURES
+- ref <vmime::net::socketFactory> getSocketFactory() const;
++ ref <vmime::net::socketFactory> getSocketFactory();
+ #endif
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+- vmime::utility::fileSystemFactory* getFileSystemFactory() const;
++ ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
+
+- vmime::utility::childProcessFactory* getChildProcessFactory() const;
++ ref <vmime::utility::childProcessFactory> getChildProcessFactory();
+ #endif
+
+ void wait() const;
+@@ -79,8 +79,8 @@ private:
+ #endif
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+- posixFileSystemFactory* m_fileSysFactory;
+- posixChildProcessFactory* m_childProcFactory;
++ ref <posixFileSystemFactory> m_fileSysFactory;
++ ref <posixChildProcessFactory> m_childProcFactory;
+ #endif
+ };
+
+diff --git a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp
+index 701edf0..53df363 100644
+--- a/vmime/platforms/windows/windowsHandler.hpp
++++ b/vmime/platforms/windows/windowsHandler.hpp
+@@ -60,13 +60,13 @@ public:
+ unsigned int getProcessId() const;
+
+ #if VMIME_HAVE_MESSAGING_FEATURES
+- ref <vmime::net::socketFactory> getSocketFactory() const;
++ ref <vmime::net::socketFactory> getSocketFactory();
+ #endif
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+- vmime::utility::fileSystemFactory* getFileSystemFactory() const;
++ ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
+
+- vmime::utility::childProcessFactory* getChildProcessFactory() const;
++ ref <vmime::utility::childProcessFactory> getChildProcessFactory();
+ #endif
+
+ void wait() const;
+@@ -78,7 +78,7 @@ private:
+ #endif
+
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+- windowsFileSystemFactory* m_fileSysFactory;
++ ref <windowsFileSystemFactory> m_fileSysFactory;
+ #endif
+ };
+
+diff --git a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp
+index 33cb633..b5405f7 100644
+--- a/vmime/utility/childProcess.hpp
++++ b/vmime/utility/childProcess.hpp
+@@ -85,7 +85,7 @@ public:
+ /** Create 'childProcess' objects.
+ */
+
+-class childProcessFactory
++class childProcessFactory : public object
+ {
+ public:
+
+diff --git a/vmime/utility/file.hpp b/vmime/utility/file.hpp
+index 61ede80..f1d877e 100644
+--- a/vmime/utility/file.hpp
++++ b/vmime/utility/file.hpp
+@@ -214,7 +214,7 @@ private:
+ /** Constructs 'file' objects.
+ */
+
+-class fileSystemFactory
++class fileSystemFactory : public object
+ {
+ public:
+
+
+commit e2f7eb2eef7de7fd926e1d80e2a108869a839ec4
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Dec 8 10:21:33 2009 +0000
+
+ Fixed non thread-safe getLocalCharset() function (thanks to Bartek Szurgot).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@518 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
+index 104bc40..2c11307 100644
+--- a/src/platforms/posix/posixHandler.cpp
++++ b/src/platforms/posix/posixHandler.cpp
+@@ -36,6 +36,11 @@
+ #include <netdb.h>
+
+ #include <string.h>
++#include <cassert>
++
++#if VMIME_HAVE_PTHREAD
++# include <pthread.h>
++#endif // VMIME_HAVE_PTHREAD
+
+ /*
+ #ifdef _POSIX_PRIORITY_SCHEDULING
+@@ -44,6 +49,43 @@
+ */
+
+
++#if VMIME_HAVE_PTHREAD
++
++namespace
++{
++ // This construction ensures mutex will be initialized in compile-time
++ // and will be available any time in the runtime.
++ pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
++
++ // Helper lock, to be exception safe all the time.
++ class PLockHelper
++ {
++ public:
++
++ PLockHelper()
++ {
++ if (pthread_mutex_lock(&g_mutex) != 0)
++ assert(!"unable to lock mutex - thread safety's void");
++ }
++
++ ~PLockHelper()
++ {
++ if (pthread_mutex_unlock(&g_mutex) != 0)
++ assert(!"unable to unlock mutex - application's dead...");
++ }
++
++ private:
++
++ // Object cannot be copied
++ PLockHelper(const PLockHelper&);
++ const PLockHelper& operator=(const PLockHelper&);
++ };
++
++} // unnamed namespace
++
++#endif // VMIME_HAVE_PTHREAD
++
++
+ namespace vmime {
+ namespace platforms {
+ namespace posix {
+@@ -109,6 +151,8 @@ const vmime::datetime posixHandler::getCurrentLocalTime() const
+
+ const vmime::charset posixHandler::getLocaleCharset() const
+ {
++ const PLockHelper lock;
++
+ const char* prevLocale = ::setlocale(LC_ALL, "");
+ vmime::charset ch(::nl_langinfo(CODESET));
+ ::setlocale(LC_ALL, prevLocale);
+
+commit d2f72cddc908788a539810ff428dbcc123be1dd3
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun Dec 13 12:50:36 2009 +0000
+
+ Makes 'To' optional, like 'Cc' and 'Bcc'. An exception is still thrown if there are no recipients at all (see bug #2912670).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@519 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/messageBuilder.cpp b/src/messageBuilder.cpp
+index a70372f..870d59e 100644
+--- a/src/messageBuilder.cpp
++++ b/src/messageBuilder.cpp
+@@ -54,11 +54,17 @@ ref <message> messageBuilder::construct() const
+ if (m_from.isEmpty())
+ throw exceptions::no_expeditor();
+
+- if (m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty())
++ if ((m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty()) &&
++ (m_cc.isEmpty() || m_cc.getAddressAt(0)->isEmpty()) &&
++ (m_bcc.isEmpty() || m_bcc.getAddressAt(0)->isEmpty()))
++ {
+ throw exceptions::no_recipient();
++ }
+
+ msg->getHeader()->From()->setValue(m_from);
+- msg->getHeader()->To()->setValue(m_to);
++
++ if (!m_to.isEmpty())
++ msg->getHeader()->To()->setValue(m_to);
+
+ if (!m_cc.isEmpty())
+ msg->getHeader()->Cc()->setValue(m_cc);
+
+commit eefa93eba21736bf9689317c35b0fd9ea6c30e69
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Jan 20 08:42:47 2010 +0000
+
+ Fixed bug #2933667: CRLF filter broken.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@520 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
+index 619f9da..c1b01ef 100644
+--- a/src/utility/filteredStream.cpp
++++ b/src/utility/filteredStream.cpp
+@@ -231,8 +231,8 @@ void CRLFToLFFilteredOutputStream::write
+
+ if (previousChar == '\r')
+ {
+- if (pos != data)
+- m_stream.write(start, pos - 1 - data); // do not write \r
++ if (pos != start)
++ m_stream.write(start, pos - 1 - start); // do not write \r
+
+ m_stream.write("\n", 1);
+
+diff --git a/tests/utility/filteredStreamTest.cpp b/tests/utility/filteredStreamTest.cpp
+index ad26e6c..a2e6f3e 100644
+--- a/tests/utility/filteredStreamTest.cpp
++++ b/tests/utility/filteredStreamTest.cpp
+@@ -175,6 +175,7 @@ VMIME_TEST_SUITE_BEGIN
+ testFilteredOutputStreamHelper<FILTER>("4", "foo\nbar", "foo", "\r\nbar");
+ testFilteredOutputStreamHelper<FILTER>("5", "foo\nbar", "foo", "\r", "\nbar");
+ testFilteredOutputStreamHelper<FILTER>("6", "foo\nbar", "foo", "\r", "\n", "bar");
++ testFilteredOutputStreamHelper<FILTER>("7", "foo\nba\nr", "foo\r", "\nba\r\nr");
+ }
+
+ // stopSequenceFilteredInputStream
+
+commit 85ad52fef45592a0c3335afc3564b3485db07657
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Feb 1 13:06:06 2010 +0000
+
+ Fixed bug #2927077: account for multi-byte charsets in invalid sequence output.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@521 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/charsetConverter.cpp b/src/charsetConverter.cpp
+index ec74ae5..798adf0 100644
+--- a/src/charsetConverter.cpp
++++ b/src/charsetConverter.cpp
+@@ -121,7 +121,18 @@ void charsetConverter::convert(utility::inputStream& in, utility::outputStream&
+
+ // Output a special character to indicate we don't known how to
+ // convert the sequence at this position
+- out.write("?", 1);
++ const char* invalidCharIn = "?";
++ size_t invalidCharInLen = 1;
++
++ char invalidCharOutBuffer[16];
++ char* invalidCharOutPtr = invalidCharOutBuffer;
++ size_t invalidCharOutLen = 16;
++
++ if (iconv(cd, ICONV_HACK(&invalidCharIn), &invalidCharInLen,
++ &invalidCharOutPtr, &invalidCharOutLen) != static_cast <size_t>(-1))
++ {
++ out.write(invalidCharOutBuffer, 16 - invalidCharOutLen);
++ }
+
+ // Skip a byte and leave unconverted bytes in the input buffer
+ std::copy(const_cast <char*>(inPtr + 1), inBuffer + sizeof(inBuffer), inBuffer);
+
+commit 99869c3d4c41304034667400ac6a5c3edc07146d
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Feb 1 13:26:12 2010 +0000
+
+ Fixed bug #2927077: account for multi-byte charsets in invalid sequence output.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@522 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/charsetConverter.cpp b/src/charsetConverter.cpp
+index 798adf0..38b9e5e 100644
+--- a/src/charsetConverter.cpp
++++ b/src/charsetConverter.cpp
+@@ -53,6 +53,27 @@ extern "C"
+ }
+
+
++
++// Output replacement char when an invalid sequence is encountered
++template <typename OUTPUT_CLASS, typename ICONV_DESC>
++void outputInvalidChar(OUTPUT_CLASS& out, ICONV_DESC cd)
++{
++ const char* invalidCharIn = "?";
++ size_t invalidCharInLen = 1;
++
++ char invalidCharOutBuffer[16];
++ char* invalidCharOutPtr = invalidCharOutBuffer;
++ size_t invalidCharOutLen = 16;
++
++ if (iconv(cd, ICONV_HACK(&invalidCharIn), &invalidCharInLen,
++ &invalidCharOutPtr, &invalidCharOutLen) != static_cast <size_t>(-1))
++ {
++ out.write(invalidCharOutBuffer, 16 - invalidCharOutLen);
++ }
++}
++
++
++
+ namespace vmime
+ {
+
+@@ -121,18 +142,7 @@ void charsetConverter::convert(utility::inputStream& in, utility::outputStream&
+
+ // Output a special character to indicate we don't known how to
+ // convert the sequence at this position
+- const char* invalidCharIn = "?";
+- size_t invalidCharInLen = 1;
+-
+- char invalidCharOutBuffer[16];
+- char* invalidCharOutPtr = invalidCharOutBuffer;
+- size_t invalidCharOutLen = 16;
+-
+- if (iconv(cd, ICONV_HACK(&invalidCharIn), &invalidCharInLen,
+- &invalidCharOutPtr, &invalidCharOutLen) != static_cast <size_t>(-1))
+- {
+- out.write(invalidCharOutBuffer, 16 - invalidCharOutLen);
+- }
++ outputInvalidChar(out, cd);
+
+ // Skip a byte and leave unconverted bytes in the input buffer
+ std::copy(const_cast <char*>(inPtr + 1), inBuffer + sizeof(inBuffer), inBuffer);
+@@ -246,7 +256,7 @@ void charsetFilteredOutputStream::write
+ // character and skip one byte in the invalid sequence.
+ if (m_unconvCount >= sizeof(m_unconvBuffer))
+ {
+- m_stream.write("?", 1);
++ outputInvalidChar(m_stream, cd);
+
+ std::copy(m_unconvBuffer + 1,
+ m_unconvBuffer + m_unconvCount, m_unconvBuffer);
+@@ -369,7 +379,7 @@ void charsetFilteredOutputStream::flush()
+ // Skip a "blocking" character
+ if (inputConverted == 0)
+ {
+- m_stream.write("?", 1);
++ outputInvalidChar(m_stream, cd);
+
+ offset++;
+ m_unconvCount--;
+
+commit fb9a3f5572922a285284af7b88bea90e69897345
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Feb 1 16:33:31 2010 +0000
+
+ Fixed memory leak.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@523 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/maildir/maildirFormat.cpp b/src/net/maildir/maildirFormat.cpp
+index 607ed61..7844542 100644
+--- a/src/net/maildir/maildirFormat.cpp
++++ b/src/net/maildir/maildirFormat.cpp
+@@ -52,7 +52,7 @@ maildirFormat::context::context(ref <maildirStore> store)
+
+ ref <maildirStore> maildirFormat::context::getStore() const
+ {
+- return m_store;
++ return m_store.acquire().constCast <maildirStore>();
+ }
+
+
+diff --git a/vmime/net/maildir/maildirFormat.hpp b/vmime/net/maildir/maildirFormat.hpp
+index a47c854..0940696 100644
+--- a/vmime/net/maildir/maildirFormat.hpp
++++ b/vmime/net/maildir/maildirFormat.hpp
+@@ -55,7 +55,7 @@ public:
+
+ private:
+
+- ref <maildirStore> m_store;
++ weak_ref <maildirStore> m_store;
+ };
+
+
+
+commit 66bd70eb441da32d95ec103ebc26c9b53d90d28e
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 3 10:45:17 2010 +0000
+
+ Removed wide-char support.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@524 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 89b58f6..33bc2a3 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -530,14 +530,6 @@ opts.AddOptions(
+ defaultSendmailPath
+ ),
+ EnumOption(
+- 'with_wide_char_support',
+- 'Support for wide characters (rarely used, should be set to "no")',
+- 'no',
+- allowed_values = ('yes', 'no'),
+- map = { },
+- ignorecase = 1
+- ),
+- EnumOption(
+ 'byte_order',
+ 'Byte order (Big Endian or Little Endian)',
+ sys.byteorder,
+@@ -802,12 +794,6 @@ config_hpp.write('\n')
+
+ config_hpp.write('// Options\n')
+
+-config_hpp.write('// -- Wide characters support\n')
+-if env['with_wide_char_support'] == 'yes':
+- config_hpp.write('#define VMIME_WIDE_CHAR_SUPPORT 1\n')
+-else:
+- config_hpp.write('#define VMIME_WIDE_CHAR_SUPPORT 0\n')
+-
+ config_hpp.write('// -- File-system support\n')
+ if env['with_filesystem'] == 'yes':
+ config_hpp.write('#define VMIME_HAVE_FILESYSTEM_FEATURES 1\n')
+@@ -1916,8 +1902,6 @@ typedef signed ${VMIME_TYPE_INT32} vmime_int32;
+ typedef unsigned ${VMIME_TYPE_INT32} vmime_uint32;
+
+ // Options
+-// -- Wide characters support
+-#define VMIME_WIDE_CHAR_SUPPORT 0
+ // -- File-system support
+ #define VMIME_HAVE_FILESYSTEM_FEATURES 1
+ // -- SASL support
+@@ -2261,8 +2245,6 @@ typedef unsigned int vmime_uint32;
+
+
+ // Options
+-// -- Wide characters support
+-#define VMIME_WIDE_CHAR_SUPPORT 0
+ // -- File-system support
+ #define VMIME_HAVE_FILESYSTEM_FEATURES 1
+ // -- SASL support
+diff --git a/src/base.cpp b/src/base.cpp
+index 2e47ca3..b895985 100644
+--- a/src/base.cpp
++++ b/src/base.cpp
+@@ -55,12 +55,6 @@ namespace vmime
+ */
+ const string NULL_STRING;
+
+-#if VMIME_WIDE_CHAR_SUPPORT
+- /** "Null" (empty) wide-char string.
+- */
+- const wstring NULL_WSTRING;
+-#endif
+-
+ /** "Null" (empty) text.
+ */
+ const text NULL_TEXT;
+diff --git a/src/text.cpp b/src/text.cpp
+index f9ded7c..89a541a 100644
+--- a/src/text.cpp
++++ b/src/text.cpp
+@@ -91,21 +91,6 @@ void text::generate(utility::outputStream& os, const string::size_type maxLineLe
+ }
+
+
+-#if VMIME_WIDE_CHAR_SUPPORT
+-
+-const wstring text::getDecodedText() const
+-{
+- wstring out;
+-
+- for (std::vector <ref <word> >::const_iterator i = m_words.begin() ; i != m_words.end() ; ++i)
+- out += (*i)->getDecodedText();
+-
+- return (out);
+-}
+-
+-#endif
+-
+-
+ void text::copyFrom(const component& other)
+ {
+ const text& t = dynamic_cast <const text&>(other);
+diff --git a/src/word.cpp b/src/word.cpp
+index ea8244a..4f91108 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
+@@ -621,20 +621,6 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
+ }
+
+
+-#if VMIME_WIDE_CHAR_SUPPORT
+-
+-const wstring word::getDecodedText() const
+-{
+- wstring out;
+-
+- charset::decode(m_buffer, out, m_charset);
+-
+- return (out);
+-}
+-
+-#endif
+-
+-
+ word& word::operator=(const word& w)
+ {
+ m_buffer = w.m_buffer;
+diff --git a/vmime/base.hpp b/vmime/base.hpp
+index ce544e1..60e637d 100644
+--- a/vmime/base.hpp
++++ b/vmime/base.hpp
+@@ -48,9 +48,6 @@ namespace vmime
+
+ // "Null" strings
+ extern const string NULL_STRING;
+-#if VMIME_WIDE_CHAR_SUPPORT
+- extern const wstring NULL_WSTRING;
+-#endif
+
+ extern const text NULL_TEXT;
+ extern const word NULL_WORD;
+diff --git a/vmime/text.hpp b/vmime/text.hpp
+index 9760c48..15e11ae 100644
+--- a/vmime/text.hpp
++++ b/vmime/text.hpp
+@@ -129,10 +129,6 @@ public:
+ */
+ const std::vector <ref <word> > getWordList();
+
+- // Decoding
+-#if VMIME_WIDE_CHAR_SUPPORT
+- const wstring getDecodedText() const;
+-#endif
+
+ /** Return the text converted into the specified charset.
+ * The encoded-words are decoded and then converted in the
+diff --git a/vmime/types.hpp b/vmime/types.hpp
+index bdf627e..d1137e1 100644
+--- a/vmime/types.hpp
++++ b/vmime/types.hpp
+@@ -36,9 +36,6 @@
+ namespace vmime
+ {
+ typedef std::string string;
+-#if VMIME_WIDE_CHAR_SUPPORT
+- typedef std::wstring wstring;
+-#endif
+
+ typedef unsigned short port_t;
+
+diff --git a/vmime/word.hpp b/vmime/word.hpp
+index 78a88e8..ad848ec 100644
+--- a/vmime/word.hpp
++++ b/vmime/word.hpp
+@@ -91,10 +91,6 @@ public:
bool operator==(const word& w) const;
bool operator!=(const word& w) const;
@@ -9352,22 +12639,4594 @@ diff -urN a/vmime/word.hpp b/vmime/word.hpp
/** Return the contained text converted to the specified charset.
*
* @param dest output charset
-diff -urN a/vmime.vcproj b/vmime.vcproj
---- a/vmime.vcproj 2008-10-19 14:36:21.000000000 +0200
-+++ b/vmime.vcproj 2010-02-10 11:06:52.000000000 +0100
-@@ -287,6 +287,7 @@
- </Filter>
- </Filter>
- <File RelativePath=".\vmime\parameterizedHeaderField.hpp"/>
-+<File RelativePath=".\vmime\word.hpp"/>
- <Filter Name="misc">
- <File RelativePath=".\vmime\misc\importanceHelper.hpp"/>
- </Filter>
-@@ -463,7 +464,6 @@
- <File RelativePath=".\vmime\parameter.hpp"/>
- <File RelativePath=".\vmime\constants.hpp"/>
- <File RelativePath=".\vmime\component.hpp"/>
--<File RelativePath=".\vmime\word.hpp"/>
- <Filter Name="mdn">
- <File RelativePath=".\vmime\mdn\sendableMDNInfos.hpp"/>
- <File RelativePath=".\vmime\mdn\receivedMDNInfos.hpp"/>
+
+commit 221ae58cc1587a78a221988398f9377417b17e25
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 3 10:56:12 2010 +0000
+
+ Use homemade isSpace() instead of std::ispace() for portability.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@525 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/word.cpp b/src/word.cpp
+index 4f91108..f24d631 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
+@@ -475,7 +475,7 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
+
+ os << string(curLineStart, lastWSpos);
+
+- if (lastWSpos > curLineStart && std::isspace(*(lastWSpos - 1)))
++ if (lastWSpos > curLineStart && parserHelpers::isSpace(*(lastWSpos - 1)))
+ state->lastCharIsSpace = true;
+ else
+ state->lastCharIsSpace = false;
+
+commit af61f3bcc07eabd7cad06e9619882ce239cb419f
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 3 11:01:40 2010 +0000
+
+ Fixed compilation issue on Windows.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@526 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
+index 82c5696..624612a 100644
+--- a/src/platforms/windows/windowsFile.cpp
++++ b/src/platforms/windows/windowsFile.cpp
+@@ -268,7 +268,7 @@ bool windowsFile::canWrite() const
+ return true;
+ }
+
+-const windowsFile::length_type windowsFile::getLength()
++windowsFile::length_type windowsFile::getLength()
+ {
+ HANDLE hFile = CreateFile(
+ m_nativePath.c_str(),
+
+commit bc1016c7e1f18c1088809a2104b295563a2d253a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 10 09:12:25 2010 +0000
+
+ Allow spaces to appear in mailbox display name without encoding or quoting. Encode or quote if CR or LF is present.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@527 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/mailbox.cpp b/src/mailbox.cpp
+index f6df516..036f003 100644
+--- a/src/mailbox.cpp
++++ b/src/mailbox.cpp
+@@ -369,7 +369,7 @@ void mailbox::generate(utility::outputStream& os, const string::size_type maxLin
+ // We have to encode the name:
+ // - if it contains characters in a charset different from "US-ASCII",
+ // - and/or if it contains one or more of these special chars:
+- // SPACE TAB " ; , < > ( ) @ / ? . = :
++ // CR LF TAB " ; , < > ( ) @ / ? . = :
+
+ // Check whether there are words that are not "US-ASCII"
+ // and/or contain the special chars.
+@@ -386,7 +386,8 @@ void mailbox::generate(utility::outputStream& os, const string::size_type maxLin
+ {
+ switch (*c)
+ {
+- case ' ':
++ case '\r':
++ case '\n':
+ case '\t':
+ case ';':
+ case ',':
+
+commit 65d0cd058e4806b1a783656e3239403edd628f5b
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 10 09:41:36 2010 +0000
+
+ Don't quote if no encoding is needed.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@528 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/word.cpp b/src/word.cpp
+index f24d631..667f1fb 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
+@@ -357,7 +357,8 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
+ // - the whole buffer is ASCII-only
+ // - the buffer does not contain quoting character (")
+ // - there is enough remaining space on the current line to hold the whole buffer
+- if ((flags & text::QUOTE_IF_POSSIBLE) &&
++ if (!noEncoding &&
++ (flags & text::QUOTE_IF_POSSIBLE) &&
+ asciiCount == m_buffer.length() &&
+ m_buffer.find('"') == string::npos &&
+ (curLineLength + 2 /* 2 x " */ + m_buffer.length()) < maxLineLength)
+
+commit 5b770cf6cb94b90e72360314e31ea05ca8dfe396
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 10 10:39:10 2010 +0000
+
+ Fixed missing M4 file in dist tarball.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@529 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 33bc2a3..f6dc257 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -376,6 +376,7 @@ libvmimetest_sources = [
+ ]
+
+ libvmime_autotools = [
++ 'm4/acx_pthread.m4',
+ 'm4/iconv.m4',
+ 'm4/lib-ld.m4',
+ 'm4/lib-link.m4',
+
+commit ce3c3fffbdf366e9c6afc4216485f0f9e0ce13a2
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri Feb 12 22:00:49 2010 +0000
+
+ Replaced 'Options' with 'Variables' to solve warnings about the former being deprecated.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@530 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index f6dc257..d45aec0 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -459,15 +459,15 @@ if defaultSendmailPath == None:
+
+
+ # 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 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'with_messaging',
+ 'Messaging support (connection to mail store/transport servers)',
+ 'yes',
+@@ -483,7 +483,7 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'with_filesystem',
+ 'Enable file-system support (this is needed for "maildir" messaging support)',
+ 'yes',
+@@ -509,7 +509,7 @@ opts.AddOptions(
+ + 'Currently available platform handlers: posix.',
+ '"posix"'
+ ),
+- EnumOption(
++ EnumVariable(
+ 'with_sasl',
+ 'Enable SASL support (requires GNU SASL library)',
+ 'yes',
+@@ -517,7 +517,7 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'with_tls',
+ 'Enable TLS support (requires GNU TLS library)',
+ 'yes',
+@@ -530,7 +530,7 @@ opts.AddOptions(
+ 'Specifies the path to sendmail.',
+ defaultSendmailPath
+ ),
+- EnumOption(
++ EnumVariable(
+ 'byte_order',
+ 'Byte order (Big Endian or Little Endian)',
+ sys.byteorder,
+@@ -538,7 +538,7 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'pf_8bit_type',
+ 'The C-language 8-bit type for your platform',
+ 'char',
+@@ -546,7 +546,7 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'pf_16bit_type',
+ 'The C-language 16-bit type for your platform',
+ 'short',
+@@ -554,7 +554,7 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'pf_32bit_type',
+ 'The C-language 32-bit type for your platform',
+ 'int',
+@@ -562,7 +562,7 @@ opts.AddOptions(
+ map = { },
+ ignorecase = 1
+ ),
+- EnumOption(
++ EnumVariable(
+ 'build_tests',
+ 'Build unit tests (run with "scons run-tests")',
+ 'no',
+
+commit 6dcc7213c7881e312fcbc68742f33c38a425fe7e
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri Feb 12 22:11:03 2010 +0000
+
+ Solved 'underquoted' warnings from m4 macros.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@531 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/m4/ost_posix.m4 b/m4/ost_posix.m4
+index 6572b1e..ab05e25 100644
+--- a/m4/ost_posix.m4
++++ b/m4/ost_posix.m4
+@@ -19,7 +19,7 @@ dnl distribute this file as part of a program that contains a configuration
+ dnl script generated by Autoconf, you may include it under the same
+ dnl distribution terms that you use for the rest of that program.
+
+-AC_DEFUN(OST_SYS_POSIX,[
++AC_DEFUN([OST_SYS_POSIX],[
+ AC_REQUIRE([OST_PROG_CC_POSIX])
+ AC_CACHE_CHECK(whether system meets Posix.1,
+ ost_cv_sys_posix1,
+@@ -65,7 +65,7 @@ AC_DEFUN(OST_SYS_POSIX,[
+ ])
+ ])
+
+-AC_DEFUN(OST_CC_FCNTL,[
++AC_DEFUN([OST_CC_FCNTL],[
+ AC_REQUIRE([OST_SYS_POSIX])
+ AC_CHECK_HEADERS(fcntl.h sys/fcntl.h)
+ AH_BOTTOM([
+diff --git a/m4/ost_prog.m4 b/m4/ost_prog.m4
+index c9e66f5..aaa82f3 100644
+--- a/m4/ost_prog.m4
++++ b/m4/ost_prog.m4
+@@ -19,18 +19,18 @@ dnl distribute this file as part of a program that contains a configuration
+ dnl script generated by Autoconf, you may include it under the same
+ dnl distribution terms that you use for the rest of that program.
+
+-AC_DEFUN(OST_PROG_CC_POSIX,[
++AC_DEFUN([OST_PROG_CC_POSIX],[
+ AC_PROG_CC
+ AC_PROG_CPP
+ AC_ISC_POSIX]
+ )
+
+-AC_DEFUN(OST_PROG_COMMON,[
++AC_DEFUN([OST_PROG_COMMON],[
+ AC_REQUIRE([AC_PROG_INSTALL])
+ AC_REQUIRE([AC_PROG_MAKE_SET])
+ ])
+
+-AC_DEFUN(OST_PROJ_LIBRARY,[
++AC_DEFUN([OST_PROJ_LIBRARY],[
+ AC_REQUIRE([AM_PROG_LIBTOOL])
+ AC_REQUIRE([AC_PROG_RANLIB])
+ if test ! -z "[$2]" ; then
+@@ -43,14 +43,14 @@ AC_DEFUN(OST_PROJ_LIBRARY,[
+ fi
+ ])
+
+-AC_DEFUN(OST_PROG_LIBVER,[
++AC_DEFUN([OST_PROG_LIBVER],[
+ LT_MAJOR="`echo $LT_VERSION | sed s/:.*$//`"
+ AC_SUBST(LT_RELEASE)
+ AC_SUBST(LT_MAJOR)
+ ])
+
+
+-AC_DEFUN(OST_PROG_LIBRARY,[
++AC_DEFUN([OST_PROG_LIBRARY],[
+ AC_REQUIRE([AM_PROG_LIBTOOL])
+ AC_REQUIRE([AC_PROG_RANLIB])
+ if test ! -z "[$2]" ; then
+diff --git a/m4/ost_systime.m4 b/m4/ost_systime.m4
+index f48f207..145611e 100644
+--- a/m4/ost_systime.m4
++++ b/m4/ost_systime.m4
+@@ -19,7 +19,7 @@ dnl distribute this file as part of a program that contains a configuration
+ dnl script generated by Autoconf, you may include it under the same
+ dnl distribution terms that you use for the rest of that program.
+
+-AC_DEFUN(OST_CC_SYSTIME,[
++AC_DEFUN([OST_CC_SYSTIME],[
+ AC_HEADER_TIME
+ AC_CHECK_HEADERS(sys/time.h)
+ AH_TOP([
+
+commit 0af45816e99b3d8e7a9902a35330095408c487ae
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri Feb 12 22:28:37 2010 +0000
+
+ Updated gettext m4 macros to 0.17.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@532 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
+index ea0b0c4..e3d26fc 100644
+--- a/m4/lib-link.m4
++++ b/m4/lib-link.m4
+@@ -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_DEFUN([AC_LIB_LINKFLAGS],
+ 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 sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+ 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 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+ 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 @@ AC_DEFUN([AC_LIB_RPATH],
+ 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 @@ AC_DEFUN([AC_LIB_RPATH],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ ])
+ else
+ additional_includedir="$withval/include"
+- additional_libdir="$withval/lib"
++ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+ ])
+@@ -157,6 +177,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
++ LIB[]NAME[]_PREFIX=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+@@ -196,22 +217,55 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+ 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 @@ AC_DEFUN([AC_LIB_APPENDTOVAR],
+ 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 --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
+index 0d895ca..a8684e1 100644
+--- a/m4/lib-prefix.m4
++++ b/m4/lib-prefix.m4
+@@ -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_DEFUN([AC_LIB_PREFIX],
+ 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 @@ AC_DEFUN([AC_LIB_PREFIX],
+ ])
+ else
+ additional_includedir="$withval/include"
+- additional_libdir="$withval/lib"
++ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+ ])
+@@ -87,7 +88,7 @@ AC_DEFUN([AC_LIB_PREFIX],
+ 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 @@ AC_DEFUN([AC_LIB_PREFIX],
+ 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 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+ 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
++])
+
+commit 508bfaf7f46e7c324e503794812bfee6fd422594
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Feb 15 09:05:49 2010 +0000
+
+ Fixed test for global constructor failing when cross building.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@533 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index d45aec0..2452745 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1364,7 +1364,7 @@ sh libtool --mode=link $CXX -o libtest.la -rpath / -version-info 0 mylib.lo >&5
+ $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)
+
+commit 4ebf3f0343a54af998ac0f039820f790b4c5f255
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Feb 17 22:27:53 2010 +0000
+
+ Fixed shebang for systems that don't have /bin/bash.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@534 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/bootstrap b/bootstrap
+index 457eaa8..01309ce 100755
+--- a/bootstrap
++++ b/bootstrap
+@@ -1,4 +1,5 @@
+ #! /bin/bash
++#! /usr/bin/env bash
+ #
+ # Bootstrap file for 'autotools' build
+ #
+
+commit 253a55ef8991269e0b66bf6b54e1aed0b385cb6b
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sat Mar 6 12:48:39 2010 +0000
+
+ Use 'glibtoolize' instead of 'libtoolize' on MacOSX.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@535 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/bootstrap b/bootstrap
+index 01309ce..1540429 100755
+--- a/bootstrap
++++ b/bootstrap
+@@ -13,6 +13,13 @@ rm -Rf autom4te.cache
+ (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 @@ if test $DIE = 0 ; then
+ 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
+
+commit 5ccf29bc69f34dada3dca2f0bf7aac7b6714dffb
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Mar 10 13:29:33 2010 +0000
+
+ Fixed bug #2966885: memory leak caused by strong ref (thanks to tuxx from SF).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@536 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/defaultSASLAuthenticator.cpp
+index 06ffc49..32192f7 100644
+--- a/src/security/sasl/defaultSASLAuthenticator.cpp
++++ b/src/security/sasl/defaultSASLAuthenticator.cpp
+@@ -96,7 +96,7 @@ const string defaultSASLAuthenticator::getAnonymousToken() const
+
+ const string defaultSASLAuthenticator::getServiceName() const
+ {
+- return m_saslSession->getServiceName();
++ return m_saslSession.acquire()->getServiceName();
+ }
+
+
+@@ -121,7 +121,7 @@ void defaultSASLAuthenticator::setSASLSession(ref <SASLSession> sess)
+
+ ref <SASLSession> defaultSASLAuthenticator::getSASLSession() const
+ {
+- return m_saslSession;
++ return m_saslSession.acquire();
+ }
+
+
+diff --git a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sasl/defaultSASLAuthenticator.hpp
+index a896b65..7595de7 100644
+--- a/vmime/security/sasl/defaultSASLAuthenticator.hpp
++++ b/vmime/security/sasl/defaultSASLAuthenticator.hpp
+@@ -67,10 +67,8 @@ private:
+
+ defaultAuthenticator m_default;
+
+-
+ weak_ref <net::service> m_service;
+-
+- ref <SASLSession> m_saslSession;
++ weak_ref <SASLSession> m_saslSession;
+ ref <SASLMechanism> m_saslMech;
+ };
+
+
+commit af7be2b3da767f2723879fd78dbbcf991f069715
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Mar 10 15:54:23 2010 +0000
+
+ Fixed compilation issue with 'const'.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@537 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/defaultSASLAuthenticator.cpp
+index 32192f7..4eae4e3 100644
+--- a/src/security/sasl/defaultSASLAuthenticator.cpp
++++ b/src/security/sasl/defaultSASLAuthenticator.cpp
+@@ -121,7 +121,7 @@ void defaultSASLAuthenticator::setSASLSession(ref <SASLSession> sess)
+
+ ref <SASLSession> defaultSASLAuthenticator::getSASLSession() const
+ {
+- return m_saslSession.acquire();
++ return m_saslSession.acquire().constCast <SASLSession>();
+ }
+
+
+
+commit 2a62318173c8285202bbddbba3fb1e77a1dc9d3a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Mar 16 08:39:45 2010 +0000
+
+ Return false instead of throwing an exception if file does not exist in isDirectory(), isFile(), canRead() and canWrite().
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@538 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+index b814b75..ec529eb 100644
+--- a/src/platforms/posix/posixFile.cpp
++++ b/src/platforms/posix/posixFile.cpp
+@@ -306,6 +306,9 @@ bool posixFile::isFile() const
+
+ if (::stat(m_nativePath.c_str(), &buf) == -1)
+ {
++ if (errno == ENOENT)
++ return false;
++
+ posixFileSystemFactory::reportError(m_path, errno);
+ return false;
+ }
+@@ -320,6 +323,9 @@ bool posixFile::isDirectory() const
+
+ if (::stat(m_nativePath.c_str(), &buf) == -1)
+ {
++ if (errno == ENOENT)
++ return false;
++
+ posixFileSystemFactory::reportError(m_path, errno);
+ return false;
+ }
+@@ -334,6 +340,9 @@ bool posixFile::canRead() const
+
+ if (::stat(m_nativePath.c_str(), &buf) == -1)
+ {
++ if (errno == ENOENT)
++ return false;
++
+ posixFileSystemFactory::reportError(m_path, errno);
+ return false;
+ }
+@@ -349,6 +358,9 @@ bool posixFile::canWrite() const
+
+ if (::stat(m_nativePath.c_str(), &buf) == -1)
+ {
++ if (errno == ENOENT)
++ return false;
++
+ posixFileSystemFactory::reportError(m_path, errno);
+ return false;
+ }
+
+commit 298f8712f6e2bb6e0f1b321906eb691793554f05
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Mar 16 11:54:11 2010 +0000
+
+ Fixed calls to 'empty' instead of 'clear' (thanks to John van der Kamp, from Zarafa).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@539 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/mailbox.cpp b/src/mailbox.cpp
+index 036f003..5cb0139 100644
+--- a/src/mailbox.cpp
++++ b/src/mailbox.cpp
+@@ -311,7 +311,7 @@ void mailbox::parse(const string& buffer, const string::size_type position,
+ // (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 @@ void mailbox::parse(const string& buffer, const string::size_type position,
+ 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)
+
+commit ec603c6c52734c44467f17dfded90a38e3516d3a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Mar 16 15:55:47 2010 +0000
+
+ Migrated config script for newer versions of SCons.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@540 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 2452745..384c90f 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -436,7 +436,7 @@ libvmime_dist_files += libvmime_autotools
+ # Set options #
+ #################
+
+-EnsureSConsVersion(0, 94)
++EnsureSConsVersion(0, 98, 1)
+
+ SetOption('implicit_cache', 1)
+
+@@ -578,7 +578,10 @@ opts.AddVariables(
+ # 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 @@ Default(libVmime)
+ # 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(
+
+commit 586397b44f047e1c3be7936cf5538f32769c6e47
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Apr 8 18:28:22 2010 +0000
+
+ Fixed parsing of non-significant whitespaces in field values.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@541 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
+index 090d5b4..464990e 100644
+--- a/src/parameterizedHeaderField.cpp
++++ b/src/parameterizedHeaderField.cpp
+@@ -85,12 +85,32 @@ void parameterizedHeaderField::parse(const string& buffer, const string::size_ty
+ 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;
++ }
++
++ // 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;
+
+- getValue()->parse(buffer, start, position + (p - pstart));
++ // Parse value
++ getValue()->parse(buffer, valueStart, valueStart + valueLength);
+
++ // Reset parameters
+ removeAllParameters();
+
+ // If there is one or more parameters following...
+diff --git a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
+index 6d24438..803bb59 100644
+--- a/tests/parser/parameterTest.cpp
++++ b/tests/parser/parameterTest.cpp
+@@ -36,6 +36,7 @@ VMIME_TEST_SUITE_BEGIN
+ VMIME_TEST(testGenerate)
+ VMIME_TEST(testGenerateRFC2231)
+ VMIME_TEST(testNonStandardEncodedParam)
++ VMIME_TEST(testParseNonSignificantWS)
+ VMIME_TEST_LIST_END
+
+
+@@ -53,6 +54,7 @@ VMIME_TEST_SUITE_BEGIN
+ };
+
+
++#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 @@ VMIME_TEST_SUITE_BEGIN
+ 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
+
+
+commit 29a45062173bede8d485af035c92e00b894172f7
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sat Apr 10 06:43:40 2010 +0000
+
+ Fixed duplicate shebang.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@542 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/bootstrap b/bootstrap
+index 1540429..9c9c3d3 100755
+--- a/bootstrap
++++ b/bootstrap
+@@ -1,4 +1,3 @@
+-#! /bin/bash
+ #! /usr/bin/env bash
+ #
+ # Bootstrap file for 'autotools' build
+
+commit a198fe0e65788519507e527e6b0a52d25bd970a1
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Apr 13 09:51:30 2010 +0000
+
+ Register non-standard encoding names.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@543 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoderFactory.cpp
+index 428788d..2237178 100644
+--- a/src/utility/encoder/encoderFactory.cpp
++++ b/src/utility/encoder/encoderFactory.cpp
+@@ -46,6 +46,10 @@ encoderFactory::encoderFactory()
+ registerName <sevenBitEncoder>("7bit");
+ registerName <eightBitEncoder>("8bit");
+ registerName <binaryEncoder>("binary");
++
++ // Also register some non-standard encoding names
++ registerName <sevenBitEncoder>("7-bit");
++ registerName <eightBitEncoder>("8-bit");
+ }
+
+
+
+commit 596b8882088f0c12f7c4ae1848b24cd521112131
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue May 4 10:07:56 2010 +0000
+
+ Fixed typo.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@544 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 384c90f..d05f8bc 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1071,7 +1071,7 @@ def generateAutotools(target, source, env):
+ # 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 @@ def generateAutotools(target, source, env):
+ 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 @@ docdir = $(datadir)/doc/$(GENERIC_LIBRARY_NAME)
+ 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 @@ docdir = $(datadir)/doc/$(GENERIC_LIBRARY_NAME)
+ 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 @@ noinst_HEADERS = $(INTERNALS)
+ # configure.in
+
+ # File automatically generated by SConstruct ('scons autotools')
+-# DOT NOT EDIT!
++# DO NOT EDIT!
+
+ # Init
+ """)
+
+commit 926e5c458c5e1c2950c29043e1f7464d26d20c6b
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue May 4 10:49:10 2010 +0000
+
+ Use STARTTLS for additional connections (thanks to Andrei).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@545 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
+index 6e5a265..825a002 100644
+--- a/src/net/imap/IMAPConnection.cpp
++++ b/src/net/imap/IMAPConnection.cpp
+@@ -156,7 +156,7 @@ void IMAPConnection::connect()
+ 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
+ {
+
+commit 9577cf0e03906b13210de550ee806f92fc45a373
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri May 14 16:56:20 2010 +0000
+
+ Fixed parsing of header field value with no data on the first line (folding).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@546 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/headerField.cpp b/src/headerField.cpp
+index 52fe7e8..cdde8ec 100644
+--- a/src/headerField.cpp
++++ b/src/headerField.cpp
+@@ -146,6 +146,12 @@ ref <headerField> headerField::parseNext(const string& buffer, const string::siz
+ {
+ 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')
+ {
+
+commit 25cb2c1432f4912106ab70dc1cea00fee21b91c0
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue May 18 13:52:27 2010 +0000
+
+ Added helper function to construct parsed message from net message. Splitted IMAP source files.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@547 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/ChangeLog b/ChangeLog
+index 4031746..b824b4c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -2,6 +2,11 @@
+ VERSION 0.9.1svn
+ ================
+
++2010-05-18 Vincent Richard <vincent@vincent-richard.net>
++
++ * net/*: added helper function vmime::net::message::getParsedMessage()
++ to construct a RFC-822 parsed message from a net message.
++
+ 2009-09-06 Vincent Richard <vincent@vincent-richard.net>
+
+ * Relicensed VMime under the GNU GPL license version 3. Dual licensing
+diff --git a/SConstruct b/SConstruct
+index d05f8bc..99b2190 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -261,6 +261,9 @@ libvmime_messaging_proto_sources = [
+ 'net/imap/IMAPMessage.cpp', 'net/imap/IMAPMessage.hpp',
+ 'net/imap/IMAPTag.cpp', 'net/imap/IMAPTag.hpp',
+ 'net/imap/IMAPUtils.cpp', 'net/imap/IMAPUtils.hpp',
++ 'net/imap/IMAPMessagePartContentHandler.cpp', 'net/imap/IMAPMessagePartContentHandler.hpp',
++ 'net/imap/IMAPStructure.cpp', 'net/imap/IMAPStructure.hpp',
++ 'net/imap/IMAPPart.cpp', 'net/imap/IMAPPart.hpp',
+ 'net/imap/IMAPParser.hpp',
+ ]
+ ],
+diff --git a/src/bodyPart.cpp b/src/bodyPart.cpp
+index 20bb102..7d60461 100644
+--- a/src/bodyPart.cpp
++++ b/src/bodyPart.cpp
+@@ -37,6 +37,15 @@ bodyPart::bodyPart()
+ }
+
+
++bodyPart::bodyPart(weak_ref <vmime::bodyPart> parentPart)
++ : m_header(vmime::create <header>()),
++ m_body(vmime::create <body>()),
++ m_parent(parentPart)
++{
++ m_body->setParentPart(thisRef().dynamicCast <bodyPart>());
++}
++
++
+ void bodyPart::parse(const string& buffer, const string::size_type position,
+ const string::size_type end, string::size_type* newPosition)
+ {
+diff --git a/src/headerField.cpp b/src/headerField.cpp
+index cdde8ec..d1d4236 100644
+--- a/src/headerField.cpp
++++ b/src/headerField.cpp
+@@ -300,7 +300,8 @@ const std::vector <ref <const component> > headerField::getChildComponents() con
+ {
+ std::vector <ref <const component> > list;
+
+- list.push_back(m_value);
++ if (m_value)
++ list.push_back(m_value);
+
+ return (list);
+ }
+diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
+index 29c2aea..adfef01 100644
+--- a/src/net/imap/IMAPMessage.cpp
++++ b/src/net/imap/IMAPMessage.cpp
+@@ -27,6 +27,9 @@
+ #include "vmime/net/imap/IMAPStore.hpp"
+ #include "vmime/net/imap/IMAPConnection.hpp"
+ #include "vmime/net/imap/IMAPUtils.hpp"
++#include "vmime/net/imap/IMAPStructure.hpp"
++#include "vmime/net/imap/IMAPPart.hpp"
++#include "vmime/net/imap/IMAPMessagePartContentHandler.hpp"
+
+ #include <sstream>
+ #include <iterator>
+@@ -38,198 +41,6 @@ namespace net {
+ namespace imap {
+
+
+-//
+-// IMAPpart
+-//
+-
+-class IMAPstructure;
+-
+-class IMAPpart : public part
+-{
+-private:
+-
+- friend class vmime::creator;
+-
+- IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
+- IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part);
+-
+-public:
+-
+- ref <const structure> getStructure() const;
+- ref <structure> getStructure();
+-
+- ref <const IMAPpart> getParent() const { return m_parent.acquire(); }
+-
+- const mediaType& getType() const { return (m_mediaType); }
+- int getSize() const { return (m_size); }
+- int getNumber() const { return (m_number); }
+-
+- ref <const header> getHeader() const
+- {
+- if (m_header == NULL)
+- throw exceptions::unfetched_object();
+- else
+- return m_header;
+- }
+-
+-
+- static ref <IMAPpart> create
+- (ref <IMAPpart> parent, const int number, const IMAPParser::body* body)
+- {
+- if (body->body_type_mpart())
+- {
+- ref <IMAPpart> part = vmime::create <IMAPpart>(parent, number, body->body_type_mpart());
+- part->m_structure = vmime::create <IMAPstructure>(part, body->body_type_mpart()->list());
+-
+- return part;
+- }
+- else
+- {
+- return vmime::create <IMAPpart>(parent, number, body->body_type_1part());
+- }
+- }
+-
+-
+- header& getOrCreateHeader()
+- {
+- if (m_header != NULL)
+- return (*m_header);
+- else
+- return (*(m_header = vmime::create <header>()));
+- }
+-
+-private:
+-
+- ref <IMAPstructure> m_structure;
+- weak_ref <IMAPpart> m_parent;
+- ref <header> m_header;
+-
+- int m_number;
+- int m_size;
+- mediaType m_mediaType;
+-};
+-
+-
+-
+-//
+-// IMAPstructure
+-//
+-
+-class IMAPstructure : public structure
+-{
+-public:
+-
+- IMAPstructure()
+- {
+- }
+-
+- IMAPstructure(const IMAPParser::body* body)
+- {
+- m_parts.push_back(IMAPpart::create(NULL, 0, body));
+- }
+-
+- IMAPstructure(ref <IMAPpart> parent, const std::vector <IMAPParser::body*>& list)
+- {
+- int number = 0;
+-
+- for (std::vector <IMAPParser::body*>::const_iterator
+- it = list.begin() ; it != list.end() ; ++it, ++number)
+- {
+- m_parts.push_back(IMAPpart::create(parent, number, *it));
+- }
+- }
+-
+-
+- ref <const part> getPartAt(const int x) const
+- {
+- return m_parts[x];
+- }
+-
+- ref <part> getPartAt(const int x)
+- {
+- return m_parts[x];
+- }
+-
+- int getPartCount() const
+- {
+- return m_parts.size();
+- }
+-
+-
+- static ref <IMAPstructure> emptyStructure()
+- {
+- return (m_emptyStructure);
+- }
+-
+-private:
+-
+- static ref <IMAPstructure> m_emptyStructure;
+-
+- std::vector <ref <IMAPpart> > m_parts;
+-};
+-
+-
+-ref <IMAPstructure> IMAPstructure::m_emptyStructure = vmime::create <IMAPstructure>();
+-
+-
+-
+-IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_mpart* mpart)
+- : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
+-{
+- m_mediaType = vmime::mediaType
+- ("multipart", mpart->media_subtype()->value());
+-}
+-
+-
+-IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::body_type_1part* part)
+- : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
+-{
+- if (part->body_type_text())
+- {
+- m_mediaType = vmime::mediaType
+- ("text", part->body_type_text()->
+- media_text()->media_subtype()->value());
+-
+- m_size = part->body_type_text()->body_fields()->body_fld_octets()->value();
+- }
+- else if (part->body_type_msg())
+- {
+- m_mediaType = vmime::mediaType
+- ("message", part->body_type_msg()->
+- media_message()->media_subtype()->value());
+- }
+- else
+- {
+- m_mediaType = vmime::mediaType
+- (part->body_type_basic()->media_basic()->media_type()->value(),
+- part->body_type_basic()->media_basic()->media_subtype()->value());
+-
+- m_size = part->body_type_basic()->body_fields()->body_fld_octets()->value();
+- }
+-
+- m_structure = NULL;
+-}
+-
+-
+-ref <const structure> IMAPpart::getStructure() const
+-{
+- if (m_structure != NULL)
+- return (m_structure);
+- else
+- return (IMAPstructure::emptyStructure());
+-}
+-
+-
+-ref <structure> IMAPpart::getStructure()
+-{
+- if (m_structure != NULL)
+- return (m_structure);
+- else
+- return (IMAPstructure::emptyStructure());
+-}
+-
+-
+-
+ #ifndef VMIME_BUILDING_DOC
+
+ //
+@@ -400,7 +211,22 @@ void IMAPMessage::fetchPartHeader(ref <part> p)
+
+ extract(p, ossAdapter, NULL, 0, -1, true, true);
+
+- p.dynamicCast <IMAPpart>()->getOrCreateHeader().parse(oss.str());
++ p.dynamicCast <IMAPPart>()->getOrCreateHeader().parse(oss.str());
++}
++
++
++void IMAPMessage::fetchPartHeaderForStructure(ref <structure> str)
++{
++ for (int i = 0, n = str->getPartCount() ; i < n ; ++i)
++ {
++ ref <class part> part = str->getPartAt(i);
++
++ // Fetch header of current part
++ fetchPartHeader(part);
++
++ // Fetch header of sub-parts
++ fetchPartHeaderForStructure(part->getStructure());
++ }
+ }
+
+
+@@ -418,7 +244,7 @@ void IMAPMessage::extract(ref <const part> p, utility::outputStream& os,
+
+ if (p != NULL)
+ {
+- ref <const IMAPpart> currentPart = p.dynamicCast <const IMAPpart>();
++ ref <const IMAPPart> currentPart = p.dynamicCast <const IMAPPart>();
+ std::vector <int> numbers;
+
+ numbers.push_back(currentPart->getNumber());
+@@ -446,8 +272,17 @@ void IMAPMessage::extract(ref <const part> p, utility::outputStream& os,
+ command << "FETCH " << m_num << " BODY";
+ if (peek) command << ".PEEK";
+ command << "[";
+- command << section.str();
+- if (headerOnly) command << ".MIME"; // "MIME" not "HEADER" for parts
++
++ if (section.str().empty() && headerOnly)
++ {
++ command << "HEADER";
++ }
++ else
++ {
++ command << section.str();
++ if (headerOnly) command << ".MIME"; // "MIME" not "HEADER" for parts
++ }
++
+ command << "]";
+
+ if (start != 0 || length != -1)
+@@ -621,7 +456,7 @@ void IMAPMessage::processFetchResponse
+ }
+ case IMAPParser::msg_att_item::BODY_STRUCTURE:
+ {
+- m_structure = vmime::create <IMAPstructure>((*it)->body());
++ m_structure = vmime::create <IMAPStructure>((*it)->body());
+ break;
+ }
+ case IMAPParser::msg_att_item::RFC822_HEADER:
+@@ -796,6 +631,80 @@ void IMAPMessage::setFlags(const int flags, const int mode)
+ }
+
+
++void IMAPMessage::constructParsedMessage(ref <bodyPart> parentPart, ref <structure> str, int level)
++{
++ if (level == 0)
++ {
++ ref <class part> part = str->getPartAt(0);
++
++ // Copy header
++ ref <const header> hdr = part->getHeader();
++ parentPart->getHeader()->copyFrom(*hdr);
++
++ // Initialize body
++ parentPart->getBody()->setContents
++ (vmime::create <IMAPMessagePartContentHandler>
++ (thisRef().dynamicCast <IMAPMessage>(),
++ part, parentPart->getBody()->getEncoding()));
++
++ constructParsedMessage(parentPart, part->getStructure(), 1);
++ }
++ else
++ {
++ for (int i = 0, n = str->getPartCount() ; i < n ; ++i)
++ {
++ ref <class part> part = str->getPartAt(i);
++
++ ref <bodyPart> childPart = vmime::create <bodyPart>();
++
++ // Copy header
++ ref <const header> hdr = part->getHeader();
++ childPart->getHeader()->copyFrom(*hdr);
++
++ // Initialize body
++ childPart->getBody()->setContents
++ (vmime::create <IMAPMessagePartContentHandler>
++ (thisRef().dynamicCast <IMAPMessage>(),
++ part, childPart->getBody()->getEncoding()));
++
++ // Add child part
++ parentPart->getBody()->appendPart(childPart);
++
++ // Construct sub parts
++ constructParsedMessage(childPart, part->getStructure(), ++level);
++ }
++ }
++}
++
++
++ref <vmime::message> IMAPMessage::getParsedMessage()
++{
++ // Fetch structure
++ ref <structure> structure = NULL;
++
++ try
++ {
++ structure = getStructure();
++ }
++ catch (exceptions::unfetched_object&)
++ {
++ fetch(m_folder.acquire(), IMAPFolder::FETCH_STRUCTURE);
++ structure = getStructure();
++ }
++
++ // Fetch header for each part
++ fetchPartHeaderForStructure(structure);
++
++ // Construct message from structure
++ ref <vmime::message> msg = vmime::create <vmime::message>();
++
++ constructParsedMessage(msg, structure);
++
++ return msg;
++}
++
++
+ } // imap
+ } // net
+ } // vmime
++
+diff --git a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp
+new file mode 100644
+index 0000000..12d387c
+--- /dev/null
++++ b/src/net/imap/IMAPMessagePartContentHandler.cpp
+@@ -0,0 +1,179 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 3 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++#include "vmime/net/imap/imapmessagepartcontenthandler.hpp"
++
++
++namespace vmime {
++namespace net {
++namespace imap {
++
++
++IMAPMessagePartContentHandler::IMAPMessagePartContentHandler
++ (ref <IMAPMessage> msg, ref <class part> part, const vmime::encoding& encoding)
++ : m_message(msg), m_part(part), m_encoding(encoding)
++{
++}
++
++
++ref <contentHandler> IMAPMessagePartContentHandler::clone() const
++{
++ return create <IMAPMessagePartContentHandler>
++ (m_message.acquire().constCast <IMAPMessage>(),
++ m_part.acquire().constCast <part>(),
++ m_encoding);
++}
++
++
++void IMAPMessagePartContentHandler::generate
++ (utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength) const
++{
++ ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>();
++ ref <part> part = m_part.acquire().constCast <class part>();
++
++ // Data is already encoded
++ if (isEncoded())
++ {
++ // The data is already encoded but the encoding specified for
++ // the generation is different from the current one. We need
++ // to re-encode data: decode from input buffer to temporary
++ // buffer, and then re-encode to output stream...
++ if (m_encoding != enc)
++ {
++ // Extract part contents to temporary buffer
++ std::ostringstream oss;
++ utility::outputStreamAdapter tmp(oss);
++
++ msg->extractPart(part, tmp, NULL);
++
++ // Decode to another temporary buffer
++ utility::inputStreamStringProxyAdapter in(oss.str());
++
++ std::ostringstream oss2;
++ utility::outputStreamAdapter tmp2(oss2);
++
++ ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder();
++ theDecoder->decode(in, tmp2);
++
++ // Reencode to output stream
++ string str = oss2.str();
++ utility::inputStreamStringAdapter tempIn(str);
++
++ ref <utility::encoder::encoder> theEncoder = enc.getEncoder();
++ theEncoder->getProperties()["maxlinelength"] = maxLineLength;
++ theEncoder->encode(tempIn, os);
++ }
++ // No encoding to perform
++ else
++ {
++ msg->extractPart(part, os);
++ }
++ }
++ // Need to encode data before
++ else
++ {
++ // Extract part contents to temporary buffer
++ std::ostringstream oss;
++ utility::outputStreamAdapter tmp(oss);
++
++ msg->extractPart(part, tmp, NULL);
++
++ // Encode temporary buffer to output stream
++ ref <utility::encoder::encoder> theEncoder = enc.getEncoder();
++ theEncoder->getProperties()["maxlinelength"] = maxLineLength;
++
++ utility::inputStreamStringAdapter is(oss.str());
++
++ theEncoder->encode(is, os);
++ }
++}
++
++
++void IMAPMessagePartContentHandler::extract
++ (utility::outputStream& os, utility::progressListener* progress) const
++{
++ ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>();
++ ref <part> part = m_part.acquire().constCast <class part>();
++
++ // No decoding to perform
++ if (!isEncoded())
++ {
++ msg->extractPart(part, os, progress);
++ }
++ // Need to decode data
++ else
++ {
++ // Extract part contents to temporary buffer
++ std::ostringstream oss;
++ utility::outputStreamAdapter tmp(oss);
++
++ msg->extractPart(part, tmp, NULL);
++
++ // Encode temporary buffer to output stream
++ utility::inputStreamStringAdapter is(oss.str());
++ utility::progressListenerSizeAdapter plsa(progress, getLength());
++
++ ref <utility::encoder::encoder> theDecoder = m_encoding.getEncoder();
++ theDecoder->decode(is, os, &plsa);
++ }
++}
++
++
++void IMAPMessagePartContentHandler::extractRaw
++ (utility::outputStream& os, utility::progressListener* progress) const
++{
++ ref <IMAPMessage> msg = m_message.acquire().constCast <IMAPMessage>();
++ ref <part> part = m_part.acquire().constCast <class part>();
++
++ msg->extractPart(part, os, progress);
++}
++
++
++string::size_type IMAPMessagePartContentHandler::getLength() const
++{
++ return m_part.acquire()->getSize();
++}
++
++
++bool IMAPMessagePartContentHandler::isEncoded() const
++{
++ return m_encoding != NO_ENCODING;
++}
++
++
++const vmime::encoding& IMAPMessagePartContentHandler::getEncoding() const
++{
++ return m_encoding;
++}
++
++
++bool IMAPMessagePartContentHandler::isEmpty() const
++{
++ return getLength() == 0;
++}
++
++
++} // imap
++} // net
++} // vmime
++
+diff --git a/src/net/imap/IMAPPart.cpp b/src/net/imap/IMAPPart.cpp
+new file mode 100644
+index 0000000..32021e8
+--- /dev/null
++++ b/src/net/imap/IMAPPart.cpp
+@@ -0,0 +1,152 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 3 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++#include "vmime/net/imap/IMAPPart.hpp"
++#include "vmime/net/imap/IMAPStructure.hpp"
++
++
++namespace vmime {
++namespace net {
++namespace imap {
++
++
++IMAPPart::IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_mpart* mpart)
++ : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
++{
++ m_mediaType = vmime::mediaType
++ ("multipart", mpart->media_subtype()->value());
++}
++
++
++IMAPPart::IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_1part* part)
++ : m_parent(parent), m_header(NULL), m_number(number), m_size(0)
++{
++ if (part->body_type_text())
++ {
++ m_mediaType = vmime::mediaType
++ ("text", part->body_type_text()->
++ media_text()->media_subtype()->value());
++
++ m_size = part->body_type_text()->body_fields()->body_fld_octets()->value();
++ }
++ else if (part->body_type_msg())
++ {
++ m_mediaType = vmime::mediaType
++ ("message", part->body_type_msg()->
++ media_message()->media_subtype()->value());
++ }
++ else
++ {
++ m_mediaType = vmime::mediaType
++ (part->body_type_basic()->media_basic()->media_type()->value(),
++ part->body_type_basic()->media_basic()->media_subtype()->value());
++
++ m_size = part->body_type_basic()->body_fields()->body_fld_octets()->value();
++ }
++
++ m_structure = NULL;
++}
++
++
++ref <const structure> IMAPPart::getStructure() const
++{
++ if (m_structure != NULL)
++ return m_structure;
++ else
++ return IMAPStructure::emptyStructure();
++}
++
++
++ref <structure> IMAPPart::getStructure()
++{
++ if (m_structure != NULL)
++ return m_structure;
++ else
++ return IMAPStructure::emptyStructure();
++}
++
++
++ref <const IMAPPart> IMAPPart::getParent() const
++{
++ return m_parent.acquire();
++}
++
++
++const mediaType& IMAPPart::getType() const
++{
++ return m_mediaType;
++}
++
++
++int IMAPPart::getSize() const
++{
++ return m_size;
++}
++
++
++int IMAPPart::getNumber() const
++{
++ return m_number;
++}
++
++
++ref <const header> IMAPPart::getHeader() const
++{
++ if (m_header == NULL)
++ throw exceptions::unfetched_object();
++ else
++ return m_header;
++}
++
++
++// static
++ref <IMAPPart> IMAPPart::create
++ (ref <IMAPPart> parent, const int number, const IMAPParser::body* body)
++{
++ if (body->body_type_mpart())
++ {
++ ref <IMAPPart> part = vmime::create <IMAPPart>(parent, number, body->body_type_mpart());
++ part->m_structure = vmime::create <IMAPStructure>(part, body->body_type_mpart()->list());
++
++ return part;
++ }
++ else
++ {
++ return vmime::create <IMAPPart>(parent, number, body->body_type_1part());
++ }
++}
++
++
++header& IMAPPart::getOrCreateHeader()
++{
++ if (m_header != NULL)
++ return *m_header;
++ else
++ return *(m_header = vmime::create <header>());
++}
++
++
++} // imap
++} // net
++} // vmime
++
+diff --git a/src/net/imap/IMAPStructure.cpp b/src/net/imap/IMAPStructure.cpp
+new file mode 100644
+index 0000000..357febe
+--- /dev/null
++++ b/src/net/imap/IMAPStructure.cpp
+@@ -0,0 +1,85 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 3 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++#include "vmime/net/imap/IMAPStructure.hpp"
++#include "vmime/net/imap/IMAPPart.hpp"
++
++
++namespace vmime {
++namespace net {
++namespace imap {
++
++
++IMAPStructure::IMAPStructure()
++{
++}
++
++
++IMAPStructure::IMAPStructure(const IMAPParser::body* body)
++{
++ m_parts.push_back(IMAPPart::create(NULL, 0, body));
++}
++
++
++IMAPStructure::IMAPStructure(ref <IMAPPart> parent, const std::vector <IMAPParser::body*>& list)
++{
++ int number = 0;
++
++ for (std::vector <IMAPParser::body*>::const_iterator
++ it = list.begin() ; it != list.end() ; ++it, ++number)
++ {
++ m_parts.push_back(IMAPPart::create(parent, number, *it));
++ }
++}
++
++
++ref <const part> IMAPStructure::getPartAt(const int x) const
++{
++ return m_parts[x];
++}
++
++
++ref <part> IMAPStructure::getPartAt(const int x)
++{
++ return m_parts[x];
++}
++
++
++int IMAPStructure::getPartCount() const
++{
++ return m_parts.size();
++}
++
++
++// static
++ref <IMAPStructure> IMAPStructure::emptyStructure()
++{
++ static ref <IMAPStructure> emptyStructure = vmime::create <IMAPStructure>();
++ return emptyStructure;
++}
++
++
++} // imap
++} // net
++} // vmime
++
+diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
+index 8999d84..51cd1ba 100644
+--- a/src/net/maildir/maildirMessage.cpp
++++ b/src/net/maildir/maildirMessage.cpp
+@@ -524,6 +524,20 @@ ref <header> maildirMessage::getOrCreateHeader()
+ }
+
+
++ref <vmime::message> maildirMessage::getParsedMessage()
++{
++ std::ostringstream oss;
++ utility::outputStreamAdapter os(oss);
++
++ extract(os);
++
++ vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
++ msg->parse(oss.str());
++
++ return msg;
++}
++
++
+ } // maildir
+ } // net
+ } // vmime
+diff --git a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
+index b38951b..50f4f87 100644
+--- a/src/net/pop3/POP3Message.cpp
++++ b/src/net/pop3/POP3Message.cpp
+@@ -218,6 +218,20 @@ void POP3Message::setFlags(const int /* flags */, const int /* mode */)
+ }
+
+
++ref <vmime::message> POP3Message::getParsedMessage()
++{
++ std::ostringstream oss;
++ utility::outputStreamAdapter os(oss);
++
++ extract(os);
++
++ vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
++ msg->parse(oss.str());
++
++ return msg;
++}
++
++
+ } // pop3
+ } // net
+ } // vmime
+diff --git a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
+index 47c11cb..aa0f040 100644
+--- a/vmime/bodyPart.hpp
++++ b/vmime/bodyPart.hpp
+@@ -46,6 +46,7 @@ class bodyPart : public component
+ public:
+
+ bodyPart();
++ bodyPart(weak_ref <vmime::bodyPart> parentPart);
+
+ /** Return the header section of this part.
+ *
+diff --git a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
+index aa485f5..38e4e24 100644
+--- a/vmime/contentHandler.hpp
++++ b/vmime/contentHandler.hpp
+@@ -87,7 +87,8 @@ public:
+ virtual void extractRaw(utility::outputStream& os, utility::progressListener* progress = NULL) const = 0;
+
+ /** Returns the actual length of data. WARNING: this can return 0 if no
+- * length was specified when setting data of this object.
++ * length was specified when setting data of this object, or if the
++ * length is not known).
+ *
+ * @return length of data
+ */
+diff --git a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
+index 690e5e2..edbf69f 100644
+--- a/vmime/net/imap/IMAPMessage.hpp
++++ b/vmime/net/imap/IMAPMessage.hpp
+@@ -28,6 +28,8 @@
+ #include "vmime/net/message.hpp"
+ #include "vmime/net/folder.hpp"
+
++#include "vmime/net/imap/IMAPParser.hpp"
++
+
+ namespace vmime {
+ namespace net {
+@@ -75,12 +77,29 @@ public:
+
+ void fetchPartHeader(ref <part> p);
+
++ ref <vmime::message> getParsedMessage();
++
+ private:
+
+ void fetch(ref <IMAPFolder> folder, const int options);
+
+ void processFetchResponse(const int options, const IMAPParser::msg_att* msgAtt);
+
++ /** Recursively fetch part header for all parts in the structure.
++ *
++ * @param str structure for which to fetch parts headers
++ */
++ void fetchPartHeaderForStructure(ref <structure> str);
++
++ /** Recursively contruct parsed message from structure.
++ * Called by getParsedMessage().
++ *
++ * @param parentPart root body part (the message)
++ * @param str structure for which to construct part
++ * @param level current nesting level (0 is root)
++ */
++ void constructParsedMessage(ref <bodyPart> parentPart, ref <structure> str, int level = 0);
++
+ void extract(ref <const part> p, utility::outputStream& os, utility::progressListener* progress, const int start, const int length, const bool headerOnly, const bool peek) const;
+
+
+diff --git a/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
+new file mode 100644
+index 0000000..0c4641e
+--- /dev/null
++++ b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
+@@ -0,0 +1,73 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 3 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++#ifndef VMIME_NET_IMAP_IMAPMESSAGEPARTCONTENTHANDLER_HPP_INCLUDED
++#define VMIME_NET_IMAP_IMAPMESSAGEPARTCONTENTHANDLER_HPP_INCLUDED
++
++
++#include "vmime/contentHandler.hpp"
++#include "vmime/net/imap/IMAPMessage.hpp"
++
++
++namespace vmime {
++namespace net {
++namespace imap {
++
++
++class IMAPMessagePartContentHandler : public contentHandler
++{
++public:
++
++ IMAPMessagePartContentHandler(ref <IMAPMessage> msg, ref <class part> part, const vmime::encoding& encoding);
++
++ ref <contentHandler> clone() const;
++
++ void generate(utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength = lineLengthLimits::infinite) const;
++
++ void extract(utility::outputStream& os, utility::progressListener* progress = NULL) const;
++ void extractRaw(utility::outputStream& os, utility::progressListener* progress = NULL) const;
++
++ string::size_type getLength() const;
++
++ bool isEncoded() const;
++
++ const vmime::encoding& getEncoding() const;
++
++ bool isEmpty() const;
++
++private:
++
++ weak_ref <IMAPMessage> m_message;
++ weak_ref <part> m_part;
++
++ vmime::encoding m_encoding;
++};
++
++
++} // imap
++} // net
++} // vmime
++
++
++#endif // VMIME_NET_IMAP_IMAPMESSAGEPARTCONTENTHANDLER_HPP_INCLUDED
++
+diff --git a/vmime/net/imap/IMAPPart.hpp b/vmime/net/imap/IMAPPart.hpp
+new file mode 100644
+index 0000000..d84db1b
+--- /dev/null
++++ b/vmime/net/imap/IMAPPart.hpp
+@@ -0,0 +1,88 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 3 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++#ifndef VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED
++#define VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED
++
++
++#include "vmime/net/message.hpp"
++
++#include "vmime/net/imap/IMAPParser.hpp"
++
++
++namespace vmime {
++namespace net {
++namespace imap {
++
++
++class IMAPStructure;
++
++
++class IMAPPart : public part
++{
++private:
++
++ friend class vmime::creator;
++
++ IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
++ IMAPPart(ref <IMAPPart> parent, const int number, const IMAPParser::body_type_1part* part);
++
++public:
++
++ ref <const structure> getStructure() const;
++ ref <structure> getStructure();
++
++ ref <const IMAPPart> getParent() const;
++
++ const mediaType& getType() const;
++ int getSize() const;
++ int getNumber() const;
++
++ ref <const header> getHeader() const;
++
++
++ static ref <IMAPPart> create
++ (ref <IMAPPart> parent, const int number, const IMAPParser::body* body);
++
++
++ header& getOrCreateHeader();
++
++private:
++
++ ref <IMAPStructure> m_structure;
++ weak_ref <IMAPPart> m_parent;
++ ref <header> m_header;
++
++ int m_number;
++ int m_size;
++ mediaType m_mediaType;
++};
++
++
++} // imap
++} // net
++} // vmime
++
++
++#endif // VMIME_NET_IMAP_IMAPPART_HPP_INCLUDED
++
+diff --git a/vmime/net/imap/IMAPStructure.hpp b/vmime/net/imap/IMAPStructure.hpp
+new file mode 100644
+index 0000000..e43676c
+--- /dev/null
++++ b/vmime/net/imap/IMAPStructure.hpp
+@@ -0,0 +1,67 @@
++//
++// VMime library (http://www.vmime.org)
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
++//
++// This program is free software; you can redistribute it and/or
++// modify it under the terms of the GNU General Public License as
++// published by the Free Software Foundation; either version 3 of
++// the License, or (at your option) any later version.
++//
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++// General Public License for more details.
++//
++// You should have received a copy of the GNU General Public License along
++// with this program; if not, write to the Free Software Foundation, Inc.,
++// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++// Linking this library statically or dynamically with other modules is making
++// a combined work based on this library. Thus, the terms and conditions of
++// the GNU General Public License cover the whole combination.
++//
++
++#ifndef VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED
++#define VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED
++
++
++#include "vmime/net/message.hpp"
++
++#include "vmime/net/imap/IMAPParser.hpp"
++
++
++namespace vmime {
++namespace net {
++namespace imap {
++
++
++class IMAPPart;
++
++
++class IMAPStructure : public structure
++{
++public:
++
++ IMAPStructure();
++ IMAPStructure(const IMAPParser::body* body);
++ IMAPStructure(ref <IMAPPart> parent, const std::vector <IMAPParser::body*>& list);
++
++ ref <const part> getPartAt(const int x) const;
++ ref <part> getPartAt(const int x);
++ int getPartCount() const;
++
++ static ref <IMAPStructure> emptyStructure();
++
++private:
++
++ std::vector <ref <IMAPPart> > m_parts;
++};
++
++
++} // imap
++} // net
++} // vmime
++
++
++#endif // VMIME_NET_IMAP_IMAPSTRUCTURE_HPP_INCLUDED
++
+diff --git a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp
+index ba3c88e..cd66d43 100644
+--- a/vmime/net/maildir/maildirMessage.hpp
++++ b/vmime/net/maildir/maildirMessage.hpp
+@@ -75,6 +75,8 @@ public:
+
+ void fetchPartHeader(ref <part> p);
+
++ ref <vmime::message> getParsedMessage();
++
+ private:
+
+ void fetch(ref <maildirFolder> folder, const int options);
+diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp
+index a0cc1da..b6ebef8 100644
+--- a/vmime/net/message.hpp
++++ b/vmime/net/message.hpp
+@@ -31,6 +31,8 @@
+ #include "vmime/utility/progressListener.hpp"
+ #include "vmime/utility/stream.hpp"
+
++#include "vmime/message.hpp"
++
+
+ namespace vmime {
+ namespace net {
+@@ -286,6 +288,16 @@ public:
+ * @param p the part for which to fetch the header
+ */
+ virtual void fetchPartHeader(ref <part> p) = 0;
++
++ /** Get the RFC-822 message for this abstract message.
++ * Warning: This may require getting some data (ie: structure and headers) from
++ * the server, which is done automatically. Actual message contents (ie: body)
++ * will not be fetched if possible (IMAP allows it, whereas POP3 will require
++ * to fetch the whole message).
++ *
++ * @return a RFC-822-parsed message
++ */
++ virtual ref <vmime::message> getParsedMessage() = 0;
+ };
+
+
+diff --git a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
+index 5dbea3f..337cc5d 100644
+--- a/vmime/net/pop3/POP3Message.hpp
++++ b/vmime/net/pop3/POP3Message.hpp
+@@ -77,6 +77,8 @@ public:
+
+ void fetchPartHeader(ref <part> p);
+
++ ref <vmime::message> getParsedMessage();
++
+ private:
+
+ void fetch(ref <POP3Folder> folder, const int options);
+
+commit 6a967daa852e3ef6f277e8bbcf50e07770d04661
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu May 20 09:57:51 2010 +0000
+
+ Fixed type size.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@548 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
+index 6d99e3f..e4bcea4 100644
+--- a/src/security/digest/sha1/sha1MessageDigest.cpp
++++ b/src/security/digest/sha1/sha1MessageDigest.cpp
+@@ -135,7 +135,7 @@ void sha1MessageDigest::update(const byte_t* buffer, const unsigned long len)
+
+ void sha1MessageDigest::finalize()
+ {
+- unsigned long i, j;
++ unsigned int i, j;
+ unsigned char finalcount[8];
+
+ for (i = 0 ; i < 8 ; i++)
+@@ -162,8 +162,8 @@ void sha1MessageDigest::finalize()
+ i = j = 0;
+
+ std::memset(m_buffer, 0, 64);
+- std::memset(m_state, 0, 5 * sizeof(unsigned long));
+- std::memset(m_count, 0, 2 * sizeof(unsigned long));
++ std::memset(m_state, 0, 5 * sizeof(unsigned int));
++ std::memset(m_count, 0, 2 * sizeof(unsigned int));
+ std::memset(&finalcount, 0, 8);
+ }
+
+@@ -192,17 +192,17 @@ void sha1MessageDigest::finalize(const byte_t* buffer,
+ * This is the core of the algorithm.
+ */
+ void sha1MessageDigest::transform
+- (unsigned long state[5], const unsigned char buffer[64])
++ (unsigned int state[5], const unsigned char buffer[64])
+ {
+- unsigned long a, b, c, d, e;
++ unsigned int a, b, c, d, e;
+
+ typedef union
+ {
+ unsigned char c[64];
+- unsigned long l[16];
++ unsigned int l[16];
+ } CHAR64LONG16;
+
+- assert(sizeof(unsigned long) == 4);
++ assert(sizeof(unsigned int) == 4);
+
+ CHAR64LONG16* block;
+ static unsigned char workspace[64];
+diff --git a/vmime/security/digest/sha1/sha1MessageDigest.hpp b/vmime/security/digest/sha1/sha1MessageDigest.hpp
+index 906009a..c8da349 100644
+--- a/vmime/security/digest/sha1/sha1MessageDigest.hpp
++++ b/vmime/security/digest/sha1/sha1MessageDigest.hpp
+@@ -59,10 +59,10 @@ protected:
+
+ void init();
+
+- static void transform(unsigned long state[5], const byte_t buffer[64]);
++ static void transform(unsigned int state[5], const byte_t buffer[64]);
+
+- unsigned long m_state[5];
+- unsigned long m_count[2];
++ unsigned int m_state[5];
++ unsigned int m_count[2];
+ byte_t m_buffer[64];
+
+ byte_t m_digest[20];
+
+commit 90f9e6fb020975996377f09e0569a17b8feaaf71
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu May 20 10:00:19 2010 +0000
+
+ Fixed unit tests build on OSX.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@549 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/SConstruct b/SConstruct
+index 99b2190..fb01edf 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -962,6 +962,10 @@ if env['build_tests'] == 'yes':
+ env = env.Clone()
+ env.Append(LIBS = ['cppunit', 'dl', packageVersionedGenericName + '-debug', 'pthread'])
+ env.Append(LIBPATH=['.'])
++
++ if sys.platform == "mac" or sys.platform == "darwin":
++ env.Append(LIBS = ['iconv', 'gcrypt'])
++
+ Default(
+ env.Program(
+ target = 'run-tests',
+
+commit 8bdccea503ad998f029a13e3963877c416a6bc0c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu May 20 15:28:51 2010 +0000
+
+ Fixed case-sensitive include.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@550 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp
+index 12d387c..a226b68 100644
+--- a/src/net/imap/IMAPMessagePartContentHandler.cpp
++++ b/src/net/imap/IMAPMessagePartContentHandler.cpp
+@@ -21,7 +21,7 @@
+ // the GNU General Public License cover the whole combination.
+ //
+
+-#include "vmime/net/imap/imapmessagepartcontenthandler.hpp"
++#include "vmime/net/imap/IMAPMessagePartContentHandler.hpp"
+
+
+ namespace vmime {
+
+commit ab5050b777359913f1e73b396dcc44da71870b29
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri May 21 06:01:33 2010 +0000
+
+ Fixed missing #include.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@551 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
+index d4eab3e..cb5351a 100644
+--- a/src/net/tls/TLSSession.cpp
++++ b/src/net/tls/TLSSession.cpp
+@@ -27,6 +27,7 @@
+ #include "vmime/config.hpp"
+
+ #if VMIME_HAVE_PTHREAD
++# include <pthread.h>
+ # include <gcrypt.h>
+ # include <errno.h>
+ #endif // VMIME_HAVE_PTHREAD
+
+commit bb65b540ddce6793cfb1d16bb3c07730ccd7a791
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri May 21 07:41:15 2010 +0000
+
+ Always encode special charsets.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@552 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
+index abae8f9..7f61a7d 100644
+--- a/src/utility/stringUtils.cpp
++++ b/src/utility/stringUtils.cpp
+@@ -151,6 +151,24 @@ string::size_type stringUtils::countASCIIchars
+ }
+
+
++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 --git a/src/word.cpp b/src/word.cpp
+index 667f1fb..9d0177f 100644
+--- a/src/word.cpp
++++ b/src/word.cpp
+@@ -336,30 +336,22 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
+ 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 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
+ 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 --git a/src/wordEncoder.cpp b/src/wordEncoder.cpp
+index 154b4ef..cc8292f 100644
+--- a/src/wordEncoder.cpp
++++ b/src/wordEncoder.cpp
+@@ -260,17 +260,75 @@ wordEncoder::Encoding wordEncoder::getEncoding() const
+ }
+
+
++// 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 --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
+index 5c9b521..4a7e394 100644
+--- a/tests/parser/textTest.cpp
++++ b/tests/parser/textTest.cpp
+@@ -44,6 +44,8 @@ VMIME_TEST_SUITE_BEGIN
+ VMIME_TEST(testWordGenerateSpace)
+ VMIME_TEST(testWordGenerateSpace2)
+ VMIME_TEST(testWordGenerateMultiBytes)
++ VMIME_TEST(testWordGenerateQuote)
++ VMIME_TEST(testWordGenerateSpecialCharsets)
+ VMIME_TEST_LIST_END
+
+
+@@ -335,9 +337,38 @@ VMIME_TEST_SUITE_BEGIN
+ 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 --git a/vmime/utility/stringUtils.hpp b/vmime/utility/stringUtils.hpp
+index b6589db..a8270d3 100644
+--- a/vmime/utility/stringUtils.hpp
++++ b/vmime/utility/stringUtils.hpp
+@@ -104,6 +104,14 @@ public:
+ */
+ 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 --git a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
+index 17ca808..1a492ea 100644
+--- a/vmime/wordEncoder.hpp
++++ b/vmime/wordEncoder.hpp
+@@ -73,12 +73,23 @@ public:
+ */
+ 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;
+
+commit 2c3a4bcc74a56df6362657cb8fad4ab21bde287c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Fri May 21 09:32:42 2010 +0000
+
+ Rewritten doc.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@553 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/vmime/component.hpp b/vmime/component.hpp
+index f30a76c..b38127f 100644
+--- a/vmime/component.hpp
++++ b/vmime/component.hpp
+@@ -32,8 +32,8 @@ namespace vmime
+ {
+
+
+-/** 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
+
+commit 36aed261bed5604ce6ed4b39c3938db8712b2004
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun May 23 16:14:41 2010 +0000
+
+ FileSystemFactory is now a ref.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@554 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/examples/example3.cpp b/examples/example3.cpp
+index cb3e6ae..4fa482d 100644
+--- a/examples/example3.cpp
++++ b/examples/example3.cpp
+@@ -73,7 +73,7 @@ int main()
+
+ // -- 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 =
+
+commit e959b4b3c3ff5228b33dc74c6f6305eeadc1f068
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sun May 23 16:18:00 2010 +0000
+
+ Improved automatic encoding selection. Added helper functions on body for setting contents, type, charset and encoding.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@555 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/body.cpp b/src/body.cpp
+index 3f5ff0f..13dff6b 100644
+--- a/src/body.cpp
++++ b/src/body.cpp
+@@ -213,8 +213,26 @@ void body::parse(const string& buffer, const string::size_type position,
+ // 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 @@ bool body::isValidBoundary(const string& boundary)
+ // 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 @@ const mediaType body::getContentType() const
+ }
+
+
++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 @@ const charset body::getCharset() const
+ }
+
+
++void body::setEncoding(const encoding& enc)
++{
++ m_header.acquire()->ContentTransferEncoding()->setValue(enc);
++}
++
++
+ const encoding body::getEncoding() const
+ {
+ try
+@@ -456,8 +515,15 @@ const encoding body::getEncoding() const
+ }
+ 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)
+ }
+
+
++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 --git a/src/charset.cpp b/src/charset.cpp
+index e3c11da..e043186 100644
+--- a/src/charset.cpp
++++ b/src/charset.cpp
+@@ -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 @@ const std::vector <ref <const component> > charset::getChildComponents() const
+ }
+
+
++
++// 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 --git a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
+index 5245341..48dc351 100644
+--- a/src/emptyContentHandler.cpp
++++ b/src/emptyContentHandler.cpp
+@@ -96,4 +96,10 @@ const vmime::encoding& emptyContentHandler::getEncoding() const
+ }
+
+
++bool emptyContentHandler::isBuffered() const
++{
++ return true;
++}
++
++
+ } // vmime
+diff --git a/src/encoding.cpp b/src/encoding.cpp
+index 58ce71d..0919d44 100644
+--- a/src/encoding.cpp
++++ b/src/encoding.cpp
+@@ -110,7 +110,7 @@ bool encoding::operator!=(const encoding& value) const
+ }
+
+
+-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
+ }
+
+
+-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 --git a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
+index 7713034..c845b57 100644
+--- a/src/htmlTextPart.cpp
++++ b/src/htmlTextPart.cpp
+@@ -69,27 +69,20 @@ void htmlTextPart::generateIn(ref <bodyPart> /* message */, ref <bodyPart> paren
+ 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 --git a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp
+index a226b68..4e6ba97 100644
+--- a/src/net/imap/IMAPMessagePartContentHandler.cpp
++++ b/src/net/imap/IMAPMessagePartContentHandler.cpp
+@@ -173,6 +173,12 @@ bool IMAPMessagePartContentHandler::isEmpty() const
+ }
+
+
++bool IMAPMessagePartContentHandler::isBuffered() const
++{
++ return true;
++}
++
++
+ } // imap
+ } // net
+ } // vmime
+diff --git a/src/plainTextPart.cpp b/src/plainTextPart.cpp
+index 7a674e7..15bcb5e 100644
+--- a/src/plainTextPart.cpp
++++ b/src/plainTextPart.cpp
+@@ -63,13 +63,10 @@ void plainTextPart::generateIn(ref <bodyPart> /* message */, ref <bodyPart> pare
+ 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 --git a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
+index 9edf4aa..2ebd073 100644
+--- a/src/streamContentHandler.cpp
++++ b/src/streamContentHandler.cpp
+@@ -201,4 +201,11 @@ const vmime::encoding& streamContentHandler::getEncoding() const
+ }
+
+
++bool streamContentHandler::isBuffered() const
++{
++ // FIXME: some streams can be resetted
++ return false;
++}
++
++
+ } // vmime
+diff --git a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
+index 248fca4..4e85a6c 100644
+--- a/src/stringContentHandler.cpp
++++ b/src/stringContentHandler.cpp
+@@ -202,4 +202,10 @@ const vmime::encoding& stringContentHandler::getEncoding() const
+ }
+
+
++bool stringContentHandler::isBuffered() const
++{
++ return true;
++}
++
++
+ } // vmime
+diff --git a/src/wordEncoder.cpp b/src/wordEncoder.cpp
+index cc8292f..22994ed 100644
+--- a/src/wordEncoder.cpp
++++ b/src/wordEncoder.cpp
+@@ -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 @@ wordEncoder::Encoding wordEncoder::getEncoding() const
+ }
+
+
+-// 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 @@ bool wordEncoder::isEncodingNeeded(const string& buffer, const charset& charset)
+ 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 --git a/vmime/body.hpp b/vmime/body.hpp
+index 80c1bb5..9e83d6b 100644
+--- a/vmime/body.hpp
++++ b/vmime/body.hpp
+@@ -184,6 +184,45 @@ public:
+ */
+ 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 @@ public:
+ */
+ 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 @@ public:
+ */
+ 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 --git a/vmime/charset.hpp b/vmime/charset.hpp
+index 1d25b74..b2e241c 100644
+--- a/vmime/charset.hpp
++++ b/vmime/charset.hpp
+@@ -33,6 +33,9 @@ namespace vmime
+ {
+
+
++class encoding; // forward reference
++
++
+ /** Charset description (basic type).
+ */
+
+@@ -59,6 +62,16 @@ public:
+
+ 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 --git a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
+index 38e4e24..0374cbe 100644
+--- a/vmime/contentHandler.hpp
++++ b/vmime/contentHandler.hpp
+@@ -111,6 +111,13 @@ public:
+ * @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 --git a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
+index 727c065..7b1e7eb 100644
+--- a/vmime/emptyContentHandler.hpp
++++ b/vmime/emptyContentHandler.hpp
+@@ -52,6 +52,8 @@ public:
+ const vmime::encoding& getEncoding() const;
+
+ bool isEmpty() const;
++
++ bool isBuffered() const;
+ };
+
+
+diff --git a/vmime/encoding.hpp b/vmime/encoding.hpp
+index fa72dfb..ba78081 100644
+--- a/vmime/encoding.hpp
++++ b/vmime/encoding.hpp
+@@ -45,6 +45,13 @@ class encoding : public headerFieldValue
+ {
+ 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 @@ public:
+
+ /** 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 @@ private:
+
+ 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 --git a/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
+index 0c4641e..75a03af 100644
+--- a/vmime/net/imap/IMAPMessagePartContentHandler.hpp
++++ b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
+@@ -55,6 +55,8 @@ public:
+
+ bool isEmpty() const;
+
++ bool isBuffered() const;
++
+ private:
+
+ weak_ref <IMAPMessage> m_message;
+diff --git a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
+index aa62b2f..703fb72 100644
+--- a/vmime/streamContentHandler.hpp
++++ b/vmime/streamContentHandler.hpp
+@@ -62,6 +62,8 @@ public:
+
+ bool isEmpty() const;
+
++ bool isBuffered() const;
++
+ private:
+
+ // Equals to NO_ENCODING if data is not encoded, otherwise this
+diff --git a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
+index 8d36889..a73ae67 100644
+--- a/vmime/stringContentHandler.hpp
++++ b/vmime/stringContentHandler.hpp
+@@ -80,6 +80,8 @@ public:
+
+ bool isEmpty() const;
+
++ bool isBuffered() const;
++
+ private:
+
+ // Equals to NO_ENCODING if data is not encoded, otherwise this
+
+commit 59511165232b856605940976978f977e439a476a
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Jun 23 20:42:25 2010 +0000
+
+ Do not generate 7-bit value for parameter if RFC-2231 extended value is generated (thanks to Eugene A. Shatokhin).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@556 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/parameter.cpp b/src/parameter.cpp
+index 6cd8d1f..53adaca 100644
+--- a/src/parameter.cpp
++++ b/src/parameter.cpp
+@@ -257,11 +257,23 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
+
+ // For compatibility with implementations that do not understand RFC-2231,
+ // also generate a normal "7bit/us-ascii" parameter
++
++ // [By Eugene A. Shatokhin]
++ // Note that if both the normal "7bit/us-ascii" value and the extended
++ // value are present, the latter can be ignored by mail processing systems.
++ // This may lead to annoying problems, for example, with strange names of
++ // attachments with all but 7-bit ascii characters removed, etc. To avoid
++ // this, I would suggest not to create "7bit/us-ascii" value if the extended
++ // value is to be generated.
++
++ // A stream for a temporary storage
++ std::ostringstream sevenBitBuffer;
++
+ string::size_type pos = curLinePos;
+
+ if (pos + name.length() + 10 + value.length() > maxLineLength)
+ {
+- os << NEW_LINE_SEQUENCE;
++ sevenBitBuffer << NEW_LINE_SEQUENCE;
+ pos = NEW_LINE_SEQUENCE_LENGTH;
+ }
+
+@@ -301,12 +313,12 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
+
+ if (needQuoting)
+ {
+- os << name << "=\"";
++ sevenBitBuffer << name << "=\"";
+ pos += name.length() + 2;
+ }
+ else
+ {
+- os << name << "=";
++ sevenBitBuffer << name << "=";
+ pos += name.length() + 1;
+ }
+
+@@ -318,12 +330,12 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
+
+ if (/* needQuoting && */ (c == '"' || c == '\\')) // 'needQuoting' is implicit
+ {
+- os << '\\' << value[i]; // escape 'x' with '\x'
++ sevenBitBuffer << '\\' << value[i]; // escape 'x' with '\x'
+ pos += 2;
+ }
+ else if (parserHelpers::isAscii(c))
+ {
+- os << value[i];
++ sevenBitBuffer << value[i];
+ ++pos;
+ }
+ else
+@@ -334,17 +346,31 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
+
+ if (needQuoting)
+ {
+- os << '"';
++ sevenBitBuffer << '"';
+ ++pos;
+ }
+
++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
++ os << sevenBitBuffer;
++#endif // !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
++
+ // Also generate an extended parameter if the value contains 8-bit characters
+ // or is too long for a single line
+ if (extended || cutValue)
+ {
++
++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
++
+ os << ';';
+ ++pos;
+
++#else // !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
++
++ // The data output to 'sevenBitBuffer' will be discarded in this case
++ pos = curLinePos;
++
++#endif // VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
++
+ /* RFC-2231
+ * ========
+ *
+@@ -477,6 +503,17 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
+ }
+ }
+ }
++#if !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
++ else
++ {
++ // The value does not contain 8-bit characters and
++ // is short enough for a single line.
++ // "7bit/us-ascii" will suffice in this case.
++
++ // Output what has been stored in temporary buffer so far
++ os << sevenBitBuffer.str();
++ }
++#endif // !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
+
+ if (newLinePos)
+ *newLinePos = pos;
+
+commit 3ce1428c7f6d9704ddc0346b664e6fa9dc0aa0ff
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Sat Jul 17 07:00:49 2010 +0000
+
+ Take account of charset recommended encoding (thanks to John van der Kamp, Zarafa).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@557 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/text.cpp b/src/text.cpp
+index 89a541a..a2fe060 100644
+--- a/src/text.cpp
++++ b/src/text.cpp
+@@ -24,6 +24,7 @@
+ #include "vmime/text.hpp"
+
+ #include "vmime/parserHelpers.hpp"
++#include "vmime/encoding.hpp"
+
+
+ namespace vmime
+@@ -248,26 +249,36 @@ ref <text> text::newFromString(const string& in, const charset& ch)
+
+ void text::createFromString(const string& in, const charset& ch)
+ {
+- bool is8bit = false; // is the current word 8-bit?
+- bool prevIs8bit = false; // is previous word 8-bit?
+- unsigned int count = 0; // total number of words
++ string::size_type asciiCount = 0;
++ string::size_type asciiPercent = 0;
+
+ removeAllWords();
+
+- const string::size_type asciiCount =
+- utility::stringUtils::countASCIIchars(in.begin(), in.end());
++ // Check whether there is a recommended encoding for this charset.
++ // If so, the whole buffer will be encoded. Else, the number of
++ // 7-bit (ASCII) bytes in the input will be used to determine if
++ // we need to encode the whole buffer.
++ encoding recommendedEnc;
++ const bool alwaysEncode = ch.getRecommendedEncoding(recommendedEnc);
+
+- const string::size_type asciiPercent =
+- (in.length() == 0 ? 100 : (100 * asciiCount) / in.length());
++ if (!alwaysEncode)
++ {
++ asciiCount = utility::stringUtils::countASCIIchars(in.begin(), in.end());
++ asciiPercent = (in.length() == 0 ? 100 : (100 * asciiCount) / in.length());
++ }
+
+ // If there are "too much" non-ASCII chars, encode everything
+- if (asciiPercent < 60) // less than 60% ASCII chars
++ if (alwaysEncode || asciiPercent < 60) // less than 60% ASCII chars
+ {
+ appendWord(vmime::create <word>(in, ch));
+ }
+ // Else, only encode words which need it
+ else
+ {
++ bool is8bit = false; // is the current word 8-bit?
++ bool prevIs8bit = false; // is previous word 8-bit?
++ unsigned int count = 0; // total number of words
++
+ for (string::size_type end = in.size(), pos = 0, start = 0 ; ; )
+ {
+ if (pos == end || parserHelpers::isSpace(in[pos]))
+
+commit fa4f3f1ce3a8e5105c205c039fe62ad0b2657fc5
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Wed Jul 21 12:21:07 2010 +0000
+
+ Added section about deleting messages from store.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@558 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/doc/book/net.tex b/doc/book/net.tex
+index 08b7df5..3056861 100644
+--- a/doc/book/net.tex
++++ b/doc/book/net.tex
+@@ -614,6 +614,27 @@ Suppose we have a message with the following structure:
+ The previous example will extract the header and body of the \emph{image/jpeg}
+ part.
+
++\subsection{Deleting messages} % ---------------------------------------------
++
++The following example will delete the second and the third message from the
++store.
++
++\begin{lstlisting}[caption={Deleting messages}]
++vmime::ref <vmime::net::folder> folder = store->getDefaultFolder();
++
++folder->deleteMessage(3);
++folder->deleteMessage(2);
++
++// This is equivalent
++std::vector <int> nums;
++nums.push_back(2);
++nums.push_back(3);
++folder->deleteMessages(nums);
++
++// This is also equivalent
++folder->deleteMessages(/* from */ 2, /* to */ 3);
++\end{lstlisting}
++
+ \subsection{Events} % --------------------------------------------------------
+
+ As a result of executing some operation (or from time to time, even if no
+
+commit d6feb9c5503726f99d7aecaa8dedd359950c6e1c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Aug 5 10:30:22 2010 +0000
+
+ Connection time out.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@559 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
+index 825a002..e2b60ed 100644
+--- a/src/net/imap/IMAPConnection.cpp
++++ b/src/net/imap/IMAPConnection.cpp
+@@ -99,7 +99,7 @@ void IMAPConnection::connect()
+ m_timeoutHandler = store->getTimeoutHandlerFactory()->create();
+
+ // Create and connect the socket
+- m_socket = store->getSocketFactory()->create();
++ m_socket = store->getSocketFactory()->create(m_timeoutHandler);
+
+ #if VMIME_HAVE_TLS_SUPPORT
+ if (store->isIMAPS()) // dedicated port/IMAPS
+diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp
+index e5e8ba7..9d554c6 100644
+--- a/src/net/pop3/POP3Store.cpp
++++ b/src/net/pop3/POP3Store.cpp
+@@ -138,7 +138,7 @@ void POP3Store::connect()
+ m_timeoutHandler = getTimeoutHandlerFactory()->create();
+
+ // Create and connect the socket
+- m_socket = getSocketFactory()->create();
++ m_socket = getSocketFactory()->create(m_timeoutHandler);
+
+ #if VMIME_HAVE_TLS_SUPPORT
+ if (m_isPOP3S) // dedicated port/POP3S
+diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
+index 917a56c..71f166b 100644
+--- a/src/net/smtp/SMTPTransport.cpp
++++ b/src/net/smtp/SMTPTransport.cpp
+@@ -100,7 +100,7 @@ void SMTPTransport::connect()
+ m_timeoutHandler = getTimeoutHandlerFactory()->create();
+
+ // Create and connect the socket
+- m_socket = getSocketFactory()->create();
++ m_socket = getSocketFactory()->create(m_timeoutHandler);
+
+ #if VMIME_HAVE_TLS_SUPPORT
+ if (m_isSMTPS) // dedicated port/SMTPS
+diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
+index 807ec47..b8bb8b1 100644
+--- a/src/platforms/posix/posixSocket.cpp
++++ b/src/platforms/posix/posixSocket.cpp
+@@ -49,8 +49,8 @@ namespace posix {
+ // posixSocket
+ //
+
+-posixSocket::posixSocket()
+- : m_desc(-1)
++posixSocket::posixSocket(ref <vmime::net::timeoutHandler> th)
++ : m_timeoutHandler(th), m_desc(-1)
+ {
+ }
+
+@@ -105,11 +105,115 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port
+ if (sock < 0)
+ continue; // try next
+
+- if (::connect(sock, res->ai_addr, res->ai_addrlen) < 0)
++ if (m_timeoutHandler != NULL)
+ {
+- ::close(sock);
+- sock = -1;
+- continue; // try next
++ ::fcntl(sock, F_SETFL, ::fcntl(sock, F_GETFL) | O_NONBLOCK);
++
++ if (::connect(sock, res->ai_addr, res->ai_addrlen) < 0)
++ {
++ switch (errno)
++ {
++ case 0:
++ case EINPROGRESS:
++ case EINTR:
++#if defined(EAGAIN)
++ case EAGAIN:
++#endif // EAGAIN
++#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
++ case EWOULDBLOCK:
++#endif // EWOULDBLOCK
++
++ // Connection in progress
++ break;
++
++ default:
++
++ ::close(sock);
++ sock = -1;
++ continue; // try next
++ }
++
++ // Wait for socket to be connected.
++ // We will check for time out every second.
++ fd_set fds;
++ FD_ZERO(&fds);
++ FD_SET(sock, &fds);
++
++ fd_set fdsError;
++ FD_ZERO(&fdsError);
++ FD_SET(sock, &fdsError);
++
++ struct timeval tm;
++ tm.tv_sec = 1;
++ tm.tv_usec = 0;
++
++ m_timeoutHandler->resetTimeOut();
++
++ bool connected = false;
++
++ do
++ {
++ const int ret = select(sock + 1, NULL, &fds, &fdsError, &tm);
++
++ // Success
++ if (ret > 0)
++ {
++ connected = true;
++ break;
++ }
++ // Error
++ else if (ret < -1)
++ {
++ if (errno != EINTR)
++ {
++ // Cancel connection
++ break;
++ }
++ }
++ // 1-second timeout
++ else if (ret == 0)
++ {
++ if (m_timeoutHandler->isTimeOut())
++ {
++ if (!m_timeoutHandler->handleTimeOut())
++ {
++ // Cancel connection
++ break;
++ }
++ else
++ {
++ // Reset timeout and keep waiting for connection
++ m_timeoutHandler->resetTimeOut();
++ }
++ }
++ else
++ {
++ // Keep waiting for connection
++ }
++ }
++
++ ::sched_yield();
++
++ } while (true);
++
++ if (!connected)
++ {
++ ::close(sock);
++ sock = -1;
++ continue; // try next
++ }
++
++ break;
++ }
++ }
++ else
++ {
++ if (::connect(sock, res->ai_addr, res->ai_addrlen) < 0)
++ {
++ ::close(sock);
++ sock = -1;
++ continue; // try next
++ }
+ }
+ }
+
+@@ -325,7 +429,14 @@ void posixSocket::throwSocketError(const int err)
+
+ ref <vmime::net::socket> posixSocketFactory::create()
+ {
+- return vmime::create <posixSocket>();
++ ref <vmime::net::timeoutHandler> th = NULL;
++ return vmime::create <posixSocket>(th);
++}
++
++
++ref <vmime::net::socket> posixSocketFactory::create(ref <vmime::net::timeoutHandler> th)
++{
++ return vmime::create <posixSocket>(th);
+ }
+
+
+diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp
+index 9aee153..aee50dc 100644
+--- a/tests/testUtils.hpp
++++ b/tests/testUtils.hpp
+@@ -260,6 +260,11 @@ public:
+ {
+ return vmime::create <T>();
+ }
++
++ vmime::ref <vmime::net::socket> create(vmime::ref <vmime::net::timeoutHandler> /* th */)
++ {
++ return vmime::create <T>();
++ }
+ };
+
+
+diff --git a/vmime/net/socket.hpp b/vmime/net/socket.hpp
+index ec6a9d3..b394649 100644
+--- a/vmime/net/socket.hpp
++++ b/vmime/net/socket.hpp
+@@ -27,6 +27,8 @@
+
+ #include "vmime/base.hpp"
+
++#include "vmime/net/timeoutHandler.hpp"
++
+
+ namespace vmime {
+ namespace net {
+@@ -117,7 +119,18 @@ public:
+
+ virtual ~socketFactory() { }
+
++ /** Creates a socket without timeout handler.
++ *
++ * @return a new socket
++ */
+ virtual ref <socket> create() = 0;
++
++ /** Creates a socket with the specified timeout handler.
++ *
++ * @param th timeout handler
++ * @return a new socket
++ */
++ virtual ref <socket> create(ref <timeoutHandler> th) = 0;
+ };
+
+
+diff --git a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixSocket.hpp
+index 9cd49d4..7e0c2d3 100644
+--- a/vmime/platforms/posix/posixSocket.hpp
++++ b/vmime/platforms/posix/posixSocket.hpp
+@@ -40,7 +40,7 @@ class posixSocket : public vmime::net::socket
+ {
+ public:
+
+- posixSocket();
++ posixSocket(ref <vmime::net::timeoutHandler> th);
+ ~posixSocket();
+
+ void connect(const vmime::string& address, const vmime::port_t port);
+@@ -61,6 +61,8 @@ protected:
+
+ private:
+
++ ref <vmime::net::timeoutHandler> m_timeoutHandler;
++
+ char m_buffer[65536];
+ int m_desc;
+ };
+@@ -72,6 +74,7 @@ class posixSocketFactory : public vmime::net::socketFactory
+ public:
+
+ ref <vmime::net::socket> create();
++ ref <vmime::net::socket> create(ref <vmime::net::timeoutHandler> th);
+ };
+
+
+
+commit 5bd1361b6024c687f06318af32cab5c7502bbc55
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Mon Aug 16 10:21:03 2010 +0000
+
+ Added stubs for timeout handler (#3045770).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@560 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
+index 3ff9ad5..430c8ea 100644
+--- a/src/platforms/windows/windowsSocket.cpp
++++ b/src/platforms/windows/windowsSocket.cpp
+@@ -38,8 +38,8 @@ namespace windows {
+ // posixSocket
+ //
+
+-windowsSocket::windowsSocket()
+- : m_desc(-1)
++windowsSocket::windowsSocket(ref <vmime::net::timeoutHandler> th)
++ : m_timeoutHandler(th), m_desc(-1)
+ {
+ WSAData wsaData;
+ WSAStartup(MAKEWORD(1, 1), &wsaData);
+@@ -179,9 +179,14 @@ void windowsSocket::sendRaw(const char* buffer, const size_type count)
+
+ ref <vmime::net::socket> windowsSocketFactory::create()
+ {
+- return vmime::create <windowsSocket>();
++ ref <vmime::net::timeoutHandler> th = NULL;
++ return vmime::create <windowsSocket>(th);
+ }
+
++ref <vmime::net::socket> windowsSocketFactory::create(ref <vmime::net::timeoutHandler> th)
++{
++ return vmime::create <windowsSocket>(th);
++}
+
+ } // posix
+ } // platforms
+diff --git a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/windowsSocket.hpp
+index 2940157..1c89aeb 100644
+--- a/vmime/platforms/windows/windowsSocket.hpp
++++ b/vmime/platforms/windows/windowsSocket.hpp
+@@ -41,6 +41,7 @@ class windowsSocket : public vmime::net::socket
+ {
+ public:
+ windowsSocket();
++ windowsSocket(ref <vmime::net::timeoutHandler> th);
+ ~windowsSocket();
+
+ public:
+@@ -59,6 +60,8 @@ public:
+
+ private:
+
++ ref <vmime::net::timeoutHandler> m_timeoutHandler;
++
+ char m_buffer[65536];
+ SOCKET m_desc;
+ };
+@@ -70,6 +73,7 @@ class windowsSocketFactory : public vmime::net::socketFactory
+ public:
+
+ ref <vmime::net::socket> create();
++ ref <vmime::net::socket> create(ref <vmime::net::timeoutHandler> th);
+ };
+
+
+
+commit e2f160f70bdc0298609007ea451d2b19e8938a0c
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Tue Aug 17 21:47:25 2010 +0000
+
+ Encode TSpecials in RFC-2231 encoded chunks.
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@561 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/parameter.cpp b/src/parameter.cpp
+index 53adaca..d923e68 100644
+--- a/src/parameter.cpp
++++ b/src/parameter.cpp
+@@ -432,9 +432,21 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
+ case '\t':
+ case '\r':
+ case '\n':
++ case '%':
+ case '"':
+ case ';':
+ case ',':
++ case '(':
++ case ')':
++ case '<':
++ case '>':
++ case '@':
++ case ':':
++ case '/':
++ case '[':
++ case ']':
++ case '?':
++ case '=':
+
+ encode = true;
+ break;
+diff --git a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
+index 803bb59..72f9e9b 100644
+--- a/tests/parser/parameterTest.cpp
++++ b/tests/parser/parameterTest.cpp
+@@ -37,6 +37,8 @@ VMIME_TEST_SUITE_BEGIN
+ VMIME_TEST(testGenerateRFC2231)
+ VMIME_TEST(testNonStandardEncodedParam)
+ VMIME_TEST(testParseNonSignificantWS)
++ VMIME_TEST(testEncodeTSpecials)
++ VMIME_TEST(testEncodeTSpecialsInRFC2231)
+ VMIME_TEST_LIST_END
+
+
+@@ -222,7 +224,11 @@ VMIME_TEST_SUITE_BEGIN
+ p1.appendParameter(vmime::create <vmime::parameter>("param1",
+ vmime::word("value 1\xe9", vmime::charset("charset"))));
+
++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
+ VASSERT_EQ("1", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p1.generate());
++#else
++ VASSERT_EQ("1", "F: X; param1*=charset''value%201%E9", p1.generate());
++#endif
+
+ // Value that spans on multiple lines
+ parameterizedHeaderField p2;
+@@ -230,6 +236,7 @@ VMIME_TEST_SUITE_BEGIN
+ vmime::word("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ vmime::charset("charset"))));
+
++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
+ VASSERT_EQ("2", "F: X; \r\n "
+ "param1=abcdefghijklm;\r\n "
+ "param1*0*=charset''abc;\r\n "
+@@ -239,6 +246,16 @@ VMIME_TEST_SUITE_BEGIN
+ "param1*4*=EFGHIJKLM;\r\n "
+ "param1*5*=NOPQRSTUV;\r\n "
+ "param1*6*=WXYZ", p2.generate(25)); // max line length = 25
++#else
++ VASSERT_EQ("2", "F: X; \r\n "
++ "param1*0*=charset''abc;\r\n "
++ "param1*1*=defghijkl;\r\n "
++ "param1*2*=mnopqrstu;\r\n "
++ "param1*3*=vwxyzABCD;\r\n "
++ "param1*4*=EFGHIJKLM;\r\n "
++ "param1*5*=NOPQRSTUV;\r\n "
++ "param1*6*=WXYZ", p2.generate(25)); // max line length = 25
++#endif
+
+ // Non-ASCII parameter value
+ parameterizedHeaderField p3;
+@@ -246,6 +263,7 @@ VMIME_TEST_SUITE_BEGIN
+ vmime::word("δσσσσσσσσσσσσσσσσσσσσδσδα δσαδσδσαδσαδασδασ δσαδασδσα δσαδασδσα δασδασδασ δασαχφδδσα 2008.doc",
+ vmime::charset("utf-8"))));
+
++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
+ VASSERT_EQ("3", "F: X; \r\n "
+ "param1=\" 2008.doc\";param1*0*=utf-8''%CE%B4%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
+ "param1*1*=%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
+@@ -255,6 +273,16 @@ VMIME_TEST_SUITE_BEGIN
+ "param1*5*=%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CE%B1%CF%83;\r\n "
+ "param1*6*=%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20%CE%B4%CE%B1%CF%83%CE%B1%CF;\r\n "
+ "param1*7*=%87%CF%86%CE%B4%CE%B4%CF%83%CE%B1%202008.doc", p3.generate(80));
++#else
++ VASSERT_EQ("3", "F: X; param1*0*=utf-8''%CE%B4%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
++ "param1*1*=%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
++ "param1*2*=%CE%B4%CF%83%CE%B4%CE%B1%20%CE%B4%CF%83%CE%B1%CE%B4%CF%83%CE%B4%CF;\r\n "
++ "param1*3*=%83%CE%B1%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20;\r\n "
++ "param1*4*=%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CF;\r\n "
++ "param1*5*=%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CE%B1%CF%83;\r\n "
++ "param1*6*=%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20%CE%B4%CE%B1%CF%83%CE%B1%CF;\r\n "
++ "param1*7*=%87%CF%86%CE%B4%CE%B4%CF%83%CE%B1%202008.doc", p3.generate(80));
++#endif
+ }
+
+ void testNonStandardEncodedParam()
+@@ -297,5 +325,32 @@ VMIME_TEST_SUITE_BEGIN
+ VASSERT_EQ("2.4", "value1", PARAM_VALUE(p2, 0));
+ }
+
++ // Encode "tspecials"
++ void testEncodeTSpecials()
++ {
++ VASSERT_EQ(" 1", "p=\"val(ue\"", vmime::create <vmime::parameter>("p", "val(ue")->generate());
++ VASSERT_EQ(" 2", "p=\"val)ue\"", vmime::create <vmime::parameter>("p", "val)ue")->generate());
++ VASSERT_EQ(" 3", "p=\"val<ue\"", vmime::create <vmime::parameter>("p", "val<ue")->generate());
++ VASSERT_EQ(" 4", "p=\"val>ue\"", vmime::create <vmime::parameter>("p", "val>ue")->generate());
++ VASSERT_EQ(" 5", "p=\"val@ue\"", vmime::create <vmime::parameter>("p", "val@ue")->generate());
++ VASSERT_EQ(" 6", "p=\"val,ue\"", vmime::create <vmime::parameter>("p", "val,ue")->generate());
++ VASSERT_EQ(" 7", "p=\"val;ue\"", vmime::create <vmime::parameter>("p", "val;ue")->generate());
++ VASSERT_EQ(" 8", "p=\"val:ue\"", vmime::create <vmime::parameter>("p", "val:ue")->generate());
++ VASSERT_EQ(" 9", "p=\"val/ue\"", vmime::create <vmime::parameter>("p", "val/ue")->generate());
++ VASSERT_EQ("10", "p=\"val[ue\"", vmime::create <vmime::parameter>("p", "val[ue")->generate());
++ VASSERT_EQ("11", "p=\"val]ue\"", vmime::create <vmime::parameter>("p", "val]ue")->generate());
++ VASSERT_EQ("12", "p=\"val?ue\"", vmime::create <vmime::parameter>("p", "val?ue")->generate());
++ VASSERT_EQ("13", "p=\"val=ue\"", vmime::create <vmime::parameter>("p", "val=ue")->generate());
++ VASSERT_EQ("14", "p=\"val ue\"", vmime::create <vmime::parameter>("p", "val ue")->generate());
++ VASSERT_EQ("15", "p=\"val\tue\"", vmime::create <vmime::parameter>("p", "val\tue")->generate());
++ }
++
++ // http://sourceforge.net/projects/vmime/forums/forum/237356/topic/3812278
++ void testEncodeTSpecialsInRFC2231()
++ {
++ VASSERT_EQ("1", "filename*=UTF-8''my_file_name_%C3%B6%C3%A4%C3%BC_%281%29.txt",
++ vmime::create <vmime::parameter>("filename", "my_file_name_\xc3\xb6\xc3\xa4\xc3\xbc_(1).txt")->generate());
++ }
++
+ VMIME_TEST_SUITE_END
+
+
+commit 593591674556159fa2ff19b9c421254770a6e8ac
+Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
+Date: Thu Aug 19 07:50:15 2010 +0000
+
+ Fixed pointer-type argument for gnutls_credentials_set (thanks to Mike Smellie).
+
+ git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@562 5301114d-f842-0410-bbdd-996ee0417009
+
+diff --git a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
+index cb5351a..010c007 100644
+--- a/src/net/tls/TLSSession.cpp
++++ b/src/net/tls/TLSSession.cpp
+@@ -199,10 +199,10 @@ TLSSession::TLSSession(ref <security::cert::certificateVerifier> cv)
+
+ // Initialize credentials
+ gnutls_credentials_set(*m_gnutlsSession,
+- GNUTLS_CRD_ANON, &g_gnutlsGlobal.anonCred);
++ GNUTLS_CRD_ANON, g_gnutlsGlobal.anonCred);
+
+ gnutls_credentials_set(*m_gnutlsSession,
+- GNUTLS_CRD_CERTIFICATE, &g_gnutlsGlobal.certCred);
++ GNUTLS_CRD_CERTIFICATE, g_gnutlsGlobal.certCred);
+ }
+
+