aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Horn <niels.horn@gmail.com>2010-05-13 00:58:59 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-13 00:58:59 +0200
commiteac700bacbf832b6899d0adeb6ef1ee4acb79967 (patch)
treedc91fa4dcdd229de60979d5946770042beda5adf
parent0c91a2e1a8826be4f48cda754fb9a833cd012e66 (diff)
libraries/libvmime-zarafa: Added to 13.0 repository
-rw-r--r--libraries/libvmime-zarafa/README4
-rw-r--r--libraries/libvmime-zarafa/libvmime-zarafa.SlackBuild89
-rw-r--r--libraries/libvmime-zarafa/libvmime-zarafa.info10
-rw-r--r--libraries/libvmime-zarafa/patches/flags.patch13
-rw-r--r--libraries/libvmime-zarafa/patches/name.patch40
-rw-r--r--libraries/libvmime-zarafa/slack-desc19
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/PATCHES140
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/README3
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-allow-no-recips-and-senders.diff23
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-attachfnamelen.diff13
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-bmoted-printable.diff11
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-broken-locale-error.diff15
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-charset-catch.diff17
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-charset-output-buffer-full.diff15
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-contentid-without-at.diff32
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-default-transfer-encoding.diff12
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-double-empty-boundary.diff12
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.3-support.diff47
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.4-support.diff10
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-header-value-on-next-line.diff27
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-disposition.diff12
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-final-recipient.diff11
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-missing-boundary.diff31
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-oe-compatibility.diff163
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-out-of-bounds-copy.diff11
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-plain-bodycopy.diff21
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-qp-starts-on-second-line.diff11
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-encode-questionmark.diff11
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-specials.diff21
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-remove-bcc.diff17
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-socket-backport-and-timeout-fix.diff170
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-socket-tcp-nodelay.diff28
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-strip-header-endspaces.diff17
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-threading-remove-static_non-abi-change.diff40
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-timezone-name.diff21
-rw-r--r--libraries/libvmime-zarafa/zarafa-patches/vmime-unicode-1-1-utf-7-charset.diff23
36 files changed, 1160 insertions, 0 deletions
diff --git a/libraries/libvmime-zarafa/README b/libraries/libvmime-zarafa/README
new file mode 100644
index 0000000000000..c4720ffc966f9
--- /dev/null
+++ b/libraries/libvmime-zarafa/README
@@ -0,0 +1,4 @@
+VMime is a free mail library for C++, an open-source solution for working
+with MIME messages and Internet messaging services like IMAP, POP or SMTP.
+
+This script builds a specially patched version of libvmime-0.7.1 for zarafa.
diff --git a/libraries/libvmime-zarafa/libvmime-zarafa.SlackBuild b/libraries/libvmime-zarafa/libvmime-zarafa.SlackBuild
new file mode 100644
index 0000000000000..609f0bb01211f
--- /dev/null
+++ b/libraries/libvmime-zarafa/libvmime-zarafa.SlackBuild
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# Slackware build script for libvmime-zarada:
+# a library for working with MIME messages
+# (with patches from zarafa)
+
+# Written by Niels Horn - niels.horn@gmail.com
+# revision date 2009/12/17
+
+PRGNAM=libvmime-zarafa
+PRGSRC=libvmime
+VERSION=0.7.1
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+fi
+
+set -e
+
+rm -rf $TMP/$PRGSRC-$VERSION $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+tar xvf $CWD/$PRGSRC-$VERSION.tar.bz2
+cd $PRGSRC-$VERSION
+chown -R root:root .
+chmod -R u+w,go+r-w,a-s .
+
+# Apply zarafa patches in order of release-date
+for patch in $(ls -rt $CWD/zarafa-patches/vmime*.diff); do
+ patch -p1 < $patch
+done
+
+# Patch "configure" so that it respects CFLAGS / CXXFLAGS
+patch -p1 < $CWD/patches/flags.patch
+# Patch "configure" & src/Makefile.in to rename the library to "libvmime-zarafa"
+patch -p1 < $CWD/patches/name.patch
+
+CFLAGS=$SLKCFLAGS \
+CXXFLAGS=$SLKCFLAGS \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --build=$ARCH-slackware-linux
+
+make docdir=/usr/doc/$PRGNAM-$VERSION
+make install docdir=/usr/doc/$PRGNAM-$VERSION DESTDIR=$PKG
+
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+)
+
+# correct program name.
+# We're moving some files so that this special version of libvmime
+# can coexist with the standard version, if needed.
+mkdir -p $PKG/usr/include/vmime-zarafa
+mv $PKG/usr/include/vmime $PKG/usr/include/vmime-zarafa
+
+mv $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/vmime.pc \
+ $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/vmime-zarafa.pc
+sed -i "s/vmime/vmime-zarafa/g" \
+ $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/vmime-zarafa.pc
+
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/libraries/libvmime-zarafa/libvmime-zarafa.info b/libraries/libvmime-zarafa/libvmime-zarafa.info
new file mode 100644
index 0000000000000..e7de3cf585824
--- /dev/null
+++ b/libraries/libvmime-zarafa/libvmime-zarafa.info
@@ -0,0 +1,10 @@
+PRGNAM="libvmime-zarafa"
+VERSION="0.7.1"
+HOMEPAGE="http://www.vmime.org/"
+DOWNLOAD="http://sourceforge.net/projects/vmime/files/vmime/0.7/libvmime-0.7.1.tar.bz2/download"
+MD5SUM="81f06a771d2de01d5982635838eb5f6a"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Niels Horn"
+EMAIL="niels.horn@gmail.com"
+APPROVED="rworkman"
diff --git a/libraries/libvmime-zarafa/patches/flags.patch b/libraries/libvmime-zarafa/patches/flags.patch
new file mode 100644
index 0000000000000..a7032f3792ac9
--- /dev/null
+++ b/libraries/libvmime-zarafa/patches/flags.patch
@@ -0,0 +1,13 @@
+--- libvmime-0.9.0_orig/configure 2008-10-19 10:36:19.000000000 -0200
++++ libvmime-0.9.0/configure 2009-12-17 09:17:29.000000000 -0200
+@@ -32224,8 +32224,8 @@
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -D_REENTRANT=1 -D_THREAD_SAFE=1 $LIBGNUTLS_CFLAGS"
+ EXTRA_LIBS="$GSASL_LIBS $LIBGNUTLS_LIBS"
+
+-CFLAGS=""
+-CXXFLAGS=""
++#CFLAGS=""
++#CXXFLAGS=""
+
+ # -- Debug
+ if test x$VMIME_DEBUG = x1 ; then
diff --git a/libraries/libvmime-zarafa/patches/name.patch b/libraries/libvmime-zarafa/patches/name.patch
new file mode 100644
index 0000000000000..4abeb0cb4223a
--- /dev/null
+++ b/libraries/libvmime-zarafa/patches/name.patch
@@ -0,0 +1,40 @@
+--- libvmime-0.7.1_orig/configure 2005-06-21 19:11:26.000000000 -0300
++++ libvmime-0.7.1/configure 2009-12-26 15:30:12.000000000 -0200
+@@ -1557,7 +1557,7 @@
+ GENERIC_VERSIONED_LIBRARY_NAME="vmime"
+
+
+-LIBRARY_NAME="libvmime"
++LIBRARY_NAME="libvmime-zarafa"
+
+
+ # Library version
+@@ -25237,7 +25237,7 @@
+
+
+ // Name of package
+-#define VMIME_PACKAGE \"libvmime\"
++#define VMIME_PACKAGE \"libvmime-zarafa\"
+
+ // Version number of package
+ #define VMIME_VERSION \"0.7.1\"
+--- libvmime-0.7.1_orig/src/Makefile.in 2005-06-21 19:11:35.000000000 -0300
++++ libvmime-0.7.1/src/Makefile.in 2009-12-26 17:57:50.000000000 -0200
+@@ -357,7 +357,7 @@
+ AUTOMAKE_OPTIONS = no-dependencies foreign
+ INTERNALS =
+ INCLUDES = -I$(top_srcdir) -I$(srcdir) @PKGCONFIG_CFLAGS@ @EXTRA_CFLAGS@
+-lib_LTLIBRARIES = libvmime.la
++lib_LTLIBRARIES = libvmime-zarafa.la
+ libvmime_la_LDFLAGS = -export-dynamic -version-info @LIBRARY_VERSION@ @PKGCONFIG_LIBS@ @EXTRA_LIBS@
+ libvmime_la_SOURCES = address.cpp \
+ addressList.cpp \
+@@ -494,7 +494,7 @@
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+-libvmime.la: $(libvmime_la_OBJECTS) $(libvmime_la_DEPENDENCIES)
++libvmime-zarafa.la: $(libvmime_la_OBJECTS) $(libvmime_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(libdir) $(libvmime_la_LDFLAGS) $(libvmime_la_OBJECTS) $(libvmime_la_LIBADD) $(LIBS)
+
+ mostlyclean-compile:
diff --git a/libraries/libvmime-zarafa/slack-desc b/libraries/libvmime-zarafa/slack-desc
new file mode 100644
index 0000000000000..f44d4c67add1a
--- /dev/null
+++ b/libraries/libvmime-zarafa/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+libvmime-zarafa: libvmime-zarafa (library for working with MIME messages)
+libvmime-zarafa:
+libvmime-zarafa: VMime is a free mail library for C++, an open-source solution for
+libvmime-zarafa: working with MIME messages and Internet messaging services like IMAP,
+libvmime-zarafa: POP or SMTP.
+libvmime-zarafa:
+libvmime-zarafa: This is a specially patched version of the vmime library for
+libvmime-zarafa: zarafa.
+libvmime-zarafa:
+libvmime-zarafa: http://www.vmime.org/
+libvmime-zarafa:
diff --git a/libraries/libvmime-zarafa/zarafa-patches/PATCHES b/libraries/libvmime-zarafa/zarafa-patches/PATCHES
new file mode 100644
index 0000000000000..a316eda3628e5
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/PATCHES
@@ -0,0 +1,140 @@
+Patches
+
+The following patches are applied by Zarafa to the vmime library, in order of creation date.
+
+
+vmime-charset-catch.diff
+
+ Early catches an exception of vmime when iconv was unable to convert a word from or to the requested charsets. This makes broken mails with invalid characters for a valid charset still be able to deliver. We'd rather have an email with a ? sign than a FallbackDelivery for the user.
+
+
+vmime-missing-boundary.diff
+
+ Broken emails without a final boundary will still be able to deliver with all attachments. The final part without the boundary will be treated as an attachment.
+
+
+vmime-allow-no-recips-and-senders.diff
+
+ Makes the messageBuilder helper generate an mail without To or Cc headers. This way, an email with only Bcc entries will still be sent. This feature is mostly used by people to mask a mailing list or invitation that should be send to alot of people.
+
+
+vmime-bmoted-printable.diff
+
+ We've seen broken mails with an invalid encoding. Unsure what 'bmoted-printable' actually is, we make vmime treat it as normal quoted-printable.
+
+
+vmime-strip-header-endspaces.diff
+
+ This patch makes sure that vmime does not parse trailing spaces on an header. Otherwise vmime will throw an exception and a fallback delivery wil be started.
+
+
+vmime-attachfnamelen.diff
+
+ Fixes parsing of an attachment filename that is between 66 and 76 characters long.
+
+
+vmime-remove-bcc.diff
+
+ Bcc headers should not be send to the SMTP server. Some SMTP server automatically strip this header (Postfix, qmail), and others have an option for this (Exim).
+
+
+vmime-mdn-disposition.diff
+
+ Fixes a small but crusial typo in a header of an MDN (read receipt) mail.
+
+
+vmime-mdn-final-recipient.diff
+
+ A header with the final recipient information was created, but not added to the MDN email. This patch adds this information to the mail.
+
+
+vmime-broken-locale-error.diff
+
+ On [WWW] Debian machines, you need to configure the locales (languages) that will be used on the system. When you use a locale (eg. LC_MESSAGES=nl_NL, but did not configure your distribution to have this locale present on your system, a NULL pointer would have thrown an exception in the std::string class. This makes sure that exception never happends.
+
+
+vmime-qp-starts-on-second-line.diff
+
+ Headers can be broken over multiple lines in an email. When the wrapped line directly started with quoted-printable, vmime copied this text as normal text, in stead of parsing it as quoted-printable.
+
+
+vmime-quoted-printable-specials.diff
+
+ This patch adds some characters that should be "escaped" in quoted-printable. With this fix you can have these characters in a fullname of an email address.
+
+
+vmime-header-value-on-next-line.diff
+
+ When an email header has the data part on the second line, vmime was unable to parse this data and skip adds the header as empty to it's internal structures. This makes sure these headers are still correctly parsed.
+
+
+vmime-oe-compatibility.diff
+
+ Fixes attachment names in Outlook Express which are long and have high characters.
+
+
+vmime-unicode-1-1-utf-7-charset.diff
+
+ Some mails have a special definition of the utf-7 character set, named unicode-1-1-utf-7. Since this name is not defined by iconv, we rename it to utf-7.
+
+
+vmime-out-of-bounds-copy.diff
+
+ When a line in a plain text mail starts with a '.', the character needs to be escaped. VMime has a special filter for this, but due to a bug in this filter, a second line starting with a '.' would trigger a wrong buffer copy, and your email would contain double parts.
+
+
+vmime-default-transfer-encoding.diff
+
+ Some broken generators may set the Content-Tranfer-Encoding header, but did not set any value. We'll assume the default value '7bit'.
+
+
+vmime-contentid-without-at.diff
+
+ Enables re-generation of broken content-id's that had no @ sign in them.
+
+
+vmime-socket-backport-and-timeout-fix.diff
+
+ Small partial backport of some socket handling code from 0.8.1
+ Only receiving data is handled better. It also has a timeout, when receiving data from a socket hasn't worked for 5 minutes. This isn't present in 0.8.1.
+
+
+vmime-double-empty-boundary.diff
+
+ When an email contains the same boundary to announce a new body part directly one after another, vmime would have crashed because the body part added to the object with size of (size_type)(-1). Thus having a body part of 4294967294 bytes on 32bit and 18446744073709551615 bytes on 64bit systems.
+
+
+vmime-quoted-printable-encode-questionmark.diff
+
+ Special characters break the quotedprintable encoding when they are typed after a ?. This fix also encodes ?-characters, so we can't break the encoding with this trick.
+
+
+vmime-gcc-4.3-support.diff
+
+ Adds required include headers to compile with g++-4.3.
+
+vmime-charset-output-buffer.diff
+
+ Fixes iconv conversion with source buffers >64Kb not to add a '?' and skip one byte of the input buffer.
+
+vmime-timezone-name.diff
+
+ Fixes dates in headers which use a timezone definition, instead of a numeric timezone offset.
+
+vmime-socket-tcp-nodelay.diff
+
+ Adds the TCP_NODELAY flag to vmime sockets. This makes the SMTP connection much faster.
+
+vmime-threading-remove-static_non-abi-change.diff
+
+ Workaround a static variable in the smart_ptr class using a pthread mutex, which fixes multi-threading issues in libvmime.
+
+vmime-gcc-4.4-support.diff
+
+ Adds required include headers to compile with g++-4.4.
+
+vmime-plain-bodycopy.diff
+
+ When constructing a plaintext only body without attachments, a copy of the body was made to set as the real body, and thus
+ removing all the multiparts. However, the same reference is removed before setting the new body, thus invalidating that body
+ we wish to copy, possibly resulting in a crash.
diff --git a/libraries/libvmime-zarafa/zarafa-patches/README b/libraries/libvmime-zarafa/zarafa-patches/README
new file mode 100644
index 0000000000000..a3877f6f35897
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/README
@@ -0,0 +1,3 @@
+These are the patches applied to the sourcecode of libvmime as shipped
+by Zarafa. The source of libvmime can be downloaded from:
+http://www.vmime.org/
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-allow-no-recips-and-senders.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-allow-no-recips-and-senders.diff
new file mode 100644
index 0000000000000..973b56d13cfbf
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-allow-no-recips-and-senders.diff
@@ -0,0 +1,23 @@
+diff -urN pristine/src/messageBuilder.cpp libvmime-0.7.1/src/messageBuilder.cpp
+--- pristine/src/messageBuilder.cpp 2005-03-18 22:26:47.000000000 +0100
++++ libvmime-0.7.1/src/messageBuilder.cpp 2006-01-13 09:49:51.000000000 +0100
+@@ -50,14 +50,11 @@
+ // Generate the header fields
+ msg->getHeader()->Subject().setValue(m_subject);
+
+- if (m_from.isEmpty())
+- throw exceptions::no_expeditor();
+-
+- if (m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty())
+- throw exceptions::no_recipient();
+-
+- msg->getHeader()->From().setValue(m_from);
+- msg->getHeader()->To().setValue(m_to);
++ if (!m_from.isEmpty())
++ msg->getHeader()->From().setValue(m_from);
++
++ if (!m_to.isEmpty())
++ msg->getHeader()->To().setValue(m_to);
+
+ if (!m_cc.isEmpty())
+ msg->getHeader()->Cc().setValue(m_cc);
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-attachfnamelen.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-attachfnamelen.diff
new file mode 100644
index 0000000000000..6de58db5f5578
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-attachfnamelen.diff
@@ -0,0 +1,13 @@
+diff -urN libvmime-0.7.1-pristine/src/defaultParameter.cpp libvmime-0.7.1/src/defaultParameter.cpp
+--- libvmime-0.7.1-pristine/src/defaultParameter.cpp 2005-06-21 19:06:35.000000000 +0200
++++ libvmime-0.7.1/src/defaultParameter.cpp 2006-08-01 10:42:18.277853120 +0200
+@@ -200,7 +200,8 @@
+ bool needQuoting = false;
+ string::size_type valueLength = 0;
+
+- for (string::size_type i = 0 ; (i < value.length()) && (pos + valueLength < maxLineLength - 4) ; ++i, ++valueLength)
++ // Use worst-case length name.length()+2 for 'name=' part of line
++ for (string::size_type i = 0 ; (i < value.length()) && (pos + name.length() + 2 + valueLength < maxLineLength - 4) ; ++i, ++valueLength)
+ {
+ switch (value[i])
+ {
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-bmoted-printable.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-bmoted-printable.diff
new file mode 100644
index 0000000000000..d6999a8d95339
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-bmoted-printable.diff
@@ -0,0 +1,11 @@
+diff -Nurb libvmime-0.7.1.orig/src/encoderFactory.cpp libvmime-0.7.1/src/encoderFactory.cpp
+--- libvmime-0.7.1.orig/src/encoderFactory.cpp 2005-03-18 22:26:47.000000000 +0100
++++ libvmime-0.7.1/src/encoderFactory.cpp 2006-04-05 10:35:25.618215000 +0200
+@@ -37,6 +37,7 @@
+ // Register some default encoders
+ registerName <encoderB64>("base64");
+ registerName <encoderQP>("quoted-printable");
++ registerName <encoderQP>("bmoted-printable");
+ registerName <encoderUUE>("uuencode");
+ registerName <encoder7bit>("7bit");
+ registerName <encoder8bit>("8bit");
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-broken-locale-error.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-broken-locale-error.diff
new file mode 100644
index 0000000000000..6656a9a322a9f
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-broken-locale-error.diff
@@ -0,0 +1,15 @@
+diff -Nurb libvmime-0.7.1.orig/src/platforms/posix/posixHandler.cpp libvmime-0.7.1.edited/src/platforms/posix/posixHandler.cpp
+--- libvmime-0.7.1.orig/src/platforms/posix/posixHandler.cpp 2005-04-30 09:53:21.000000000 +0200
++++ libvmime-0.7.1.edited/src/platforms/posix/posixHandler.cpp 2006-12-28 17:29:43.883410000 +0100
+@@ -106,9 +106,9 @@
+
+ const vmime::charset posixHandler::getLocaleCharset() const
+ {
+- vmime::string prevLocale(::setlocale(LC_ALL, ""));
++ char *prevLocale = ::setlocale(LC_ALL, "");
+ vmime::charset ch(::nl_langinfo(CODESET));
+- ::setlocale(LC_ALL, prevLocale.c_str());
++ ::setlocale(LC_ALL, prevLocale);
+
+ return (ch);
+ }
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-charset-catch.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-charset-catch.diff
new file mode 100644
index 0000000000000..9f8e723f6587d
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-charset-catch.diff
@@ -0,0 +1,17 @@
+diff -Nurb libvmime-0.7.1.orig/src/word.cpp libvmime-0.7.1/src/word.cpp
+--- libvmime-0.7.1.orig/src/word.cpp 2005-06-13 12:56:52.000000000 +0200
++++ libvmime-0.7.1/src/word.cpp 2005-11-15 18:02:45.000000000 +0100
+@@ -688,7 +688,13 @@
+ {
+ string out;
+
++ try {
+ charset::convert(m_buffer, out, m_charset, dest);
++ }
++ catch (vmime::exception &e) {
++ // copy 'word' as text
++ out = m_buffer;
++ }
+
+ return (out);
+ }
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-charset-output-buffer-full.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-charset-output-buffer-full.diff
new file mode 100644
index 0000000000000..eadd9755c912b
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-charset-output-buffer-full.diff
@@ -0,0 +1,15 @@
+--- libvmime-0.7.1.orig/src/charset.cpp 2005-03-18 22:26:46.000000000 +0100
++++ libvmime-0.7.1.patched/src/charset.cpp 2008-07-07 13:51:33.414160106 +0200
+@@ -206,10 +206,12 @@
+ out += STRINGT(static_cast <ovt*>(buffer), sizeof(buffer) - outBytesLeft);
+
+ // Ignore this "blocking" character and continue
++ if (outBytesLeft > 0) {
+ out += '?';
+ ++inBuffer;
+ --inBytesLeft;
+ }
++ }
+ else
+ {
+ out += STRINGT(static_cast <ovt*>(buffer), sizeof(buffer) - outBytesLeft);
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-contentid-without-at.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-contentid-without-at.diff
new file mode 100644
index 0000000000000..97af9290c4a1f
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-contentid-without-at.diff
@@ -0,0 +1,32 @@
+--- libvmime-0.7.1.orig/src/messageId.cpp 2005-03-27 14:59:12.000000000 +0200
++++ libvmime-0.7.1.patched/src/messageId.cpp 2007-07-31 14:14:38.827718500 +0200
+@@ -102,7 +102,7 @@
+ // Extract left part
+ const string::size_type leftStart = position + (p - pstart);
+
+- while (p < pend && *p != '@') ++p;
++ while (p < pend && *p != '@' && *p != '>') ++p;
+
+ m_left = string(buffer.begin() + leftStart,
+ buffer.begin() + position + (p - pstart));
+@@ -162,6 +162,8 @@
+
+ const string messageId::getId() const
+ {
++ if (m_right == "")
++ return m_left;
+ return (m_left + '@' + m_right);
+ }
+
+@@ -177,7 +179,10 @@
+ pos = NEW_LINE_SEQUENCE_LENGTH;
+ }
+
+- os << '<' << m_left << '@' << m_right << '>';
++ os << '<' << m_left;
++ if (m_right != "")
++ os << '@' << m_right;
++ os << '>';
+
+ if (newLinePos)
+ *newLinePos = pos + m_left.length() + m_right.length() + 3;
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-default-transfer-encoding.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-default-transfer-encoding.diff
new file mode 100644
index 0000000000000..51f31296dcca8
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-default-transfer-encoding.diff
@@ -0,0 +1,12 @@
+--- libvmime-0.7.1.orig/src/body.cpp 2007-01-26 14:44:10.259563000 +0100
++++ libvmime-0.7.1.patched/src/body.cpp 2007-07-13 12:14:30.699846500 +0200
+@@ -465,6 +465,9 @@
+ const contentEncodingField& cef = dynamic_cast<contentEncodingField&>
+ (*m_header->findField(fields::CONTENT_TRANSFER_ENCODING));
+
++ if (cef.getValue().getName().empty())
++ return (vmime::encoding(encodingTypes::SEVEN_BIT));
++
+ return (cef.getValue());
+ }
+ catch (exceptions::no_such_field&)
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-double-empty-boundary.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-double-empty-boundary.diff
new file mode 100644
index 0000000000000..303aea421a5a2
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-double-empty-boundary.diff
@@ -0,0 +1,12 @@
+diff -urb libvmime-0.7.1.orig/src/body.cpp libvmime-0.7.1.patched/src/body.cpp
+--- libvmime-0.7.1.orig/src/body.cpp 2005-03-18 22:26:46.000000000 +0100
++++ libvmime-0.7.1.patched/src/body.cpp 2007-11-01 16:45:20.688580500 +0100
+@@ -173,7 +173,7 @@
+ ++pos;
+ }
+
+- if (index > 0)
++ if (index > 0 && partStart < partEnd)
+ {
+ bodyPart* part = new bodyPart;
+
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.3-support.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.3-support.diff
new file mode 100644
index 0000000000000..c291141328605
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.3-support.diff
@@ -0,0 +1,47 @@
+diff -Nurb libvmime-0.7.1.orig/src/messaging/imap/IMAPMessage.cpp libvmime-0.7.1/src/messaging/imap/IMAPMessage.cpp
+--- libvmime-0.7.1.orig/src/messaging/imap/IMAPMessage.cpp 2005-05-27 21:31:44.000000000 +0200
++++ libvmime-0.7.1/src/messaging/imap/IMAPMessage.cpp 2008-07-07 15:41:38.034166062 +0200
+@@ -26,7 +26,7 @@
+
+ #include <sstream>
+ #include <iterator>
+-
++#include <typeinfo>
+
+ namespace vmime {
+ namespace messaging {
+diff -Nurb libvmime-0.7.1.orig/src/platforms/posix/posixSocket.cpp libvmime-0.7.1/src/platforms/posix/posixSocket.cpp
+--- libvmime-0.7.1.orig/src/platforms/posix/posixSocket.cpp 2005-03-18 22:26:49.000000000 +0100
++++ libvmime-0.7.1/src/platforms/posix/posixSocket.cpp 2008-07-07 15:42:16.700025085 +0200
+@@ -19,6 +19,7 @@
+
+ #include "vmime/platforms/posix/posixSocket.hpp"
+
++#include <string.h>
+ #include <unistd.h>
+ #include <sys/socket.h>
+ #include <arpa/inet.h>
+diff -Nurb libvmime-0.7.1.orig/src/utility/md5.cpp libvmime-0.7.1/src/utility/md5.cpp
+--- libvmime-0.7.1.orig/src/utility/md5.cpp 2005-03-18 22:26:48.000000000 +0100
++++ libvmime-0.7.1/src/utility/md5.cpp 2008-07-07 15:41:38.034166062 +0200
+@@ -45,7 +45,7 @@
+ // documentation and/or software.
+
+ #include "vmime/utility/md5.hpp"
+-
++#include <string.h>
+
+ namespace vmime {
+ namespace utility {
+diff -Nurb libvmime-0.7.1.orig/vmime/utility/filteredStream.hpp libvmime-0.7.1/vmime/utility/filteredStream.hpp
+--- libvmime-0.7.1.orig/vmime/utility/filteredStream.hpp 2005-06-16 21:19:12.000000000 +0200
++++ libvmime-0.7.1/vmime/utility/filteredStream.hpp 2008-07-07 15:41:38.034166062 +0200
+@@ -22,7 +22,7 @@
+
+
+ #include "vmime/utility/stream.hpp"
+-
++#include <algorithm>
+
+ namespace vmime {
+ namespace utility {
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.4-support.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.4-support.diff
new file mode 100644
index 0000000000000..ed8ccf1128618
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-gcc-4.4-support.diff
@@ -0,0 +1,10 @@
+--- libvmime-0.7.1/src/platforms/posix/posixFile.cpp 2005-04-09 10:42:46.000000000 +0200
++++ libvmime-0.7.1/src/platforms/posix/posixFile.cpp.gcc44 2009-03-29 21:09:07.000000000 +0200
+@@ -28,6 +28,7 @@
+
+ #include <dirent.h>
+
++#include <stdio.h>
+ #include <string.h>
+
+ #include "vmime/exception.hpp"
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-header-value-on-next-line.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-header-value-on-next-line.diff
new file mode 100644
index 0000000000000..9b256623f87b0
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-header-value-on-next-line.diff
@@ -0,0 +1,27 @@
+diff -urb libvmime-0.7.1/src/headerField.cpp libvmime-0.7.1.patched/src/headerField.cpp
+--- libvmime-0.7.1/src/headerField.cpp 2007-01-26 14:44:10.315567250 +0100
++++ libvmime-0.7.1.patched/src/headerField.cpp 2007-02-07 13:35:35.177077750 +0100
+@@ -147,14 +147,12 @@
+ {
+ contentsEnd = pos;
+ pos += 2;
+- break;
+ }
+ else if (c == '\n')
+ {
+ contentsEnd = pos;
+ ++pos;
+- break;
+- }
++ } else {
+
+ while (pos < end)
+ {
+@@ -176,6 +174,7 @@
+
+ ++pos;
+ }
++ }
+
+ // Handle the case of folded lines
+ if (buffer[pos] == ' ' || buffer[pos] == '\t')
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-disposition.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-disposition.diff
new file mode 100644
index 0000000000000..c84ab40d4cb67
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-disposition.diff
@@ -0,0 +1,12 @@
+diff -Nurb libvmime-0.7.1.orig/src/mdn/MDNHelper.cpp libvmime-0.7.1/src/mdn/MDNHelper.cpp
+--- libvmime-0.7.1.orig/src/mdn/MDNHelper.cpp 2005-04-09 21:45:07.000000000 +0200
++++ libvmime-0.7.1/src/mdn/MDNHelper.cpp 2006-11-28 09:37:56.009129500 +0100
+@@ -143,7 +143,7 @@
+
+ hdr->ContentType().setValue(mediaType(vmime::mediaTypes::MULTIPART,
+ vmime::mediaTypes::MULTIPART_REPORT));
+- hdr->ContentType().setReportType("disosition-notification");
++ hdr->ContentType().setReportType("disposition-notification");
+
+ hdr->Disposition().setValue(dispo);
+
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-final-recipient.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-final-recipient.diff
new file mode 100644
index 0000000000000..006748f4fd041
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-mdn-final-recipient.diff
@@ -0,0 +1,11 @@
+diff -Nurb libvmime-0.7.1.orig/src/mdn/MDNHelper.cpp libvmime-0.7.1/src/mdn/MDNHelper.cpp
+--- libvmime-0.7.1.orig/src/mdn/MDNHelper.cpp 2006-11-28 09:43:47.995127250 +0100
++++ libvmime-0.7.1/src/mdn/MDNHelper.cpp 2006-11-28 09:43:27.505846750 +0100
+@@ -246,6 +246,7 @@
+ (headerFieldFactory::getInstance()->create(vmime::fields::FINAL_RECIPIENT));
+
+ fr->setValue("rfc822; " + mdnInfos.getRecipient().getEmail());
++ fields.appendField(fr);
+
+ // -- Original-Message-ID
+ if (mdnInfos.getMessage()->getHeader()->hasField(vmime::fields::MESSAGE_ID))
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-missing-boundary.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-missing-boundary.diff
new file mode 100644
index 0000000000000..724a68427f67c
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-missing-boundary.diff
@@ -0,0 +1,31 @@
+diff -Nurb libvmime-0.7.1.orig/src/body.cpp libvmime-0.7.1/src/body.cpp
+--- libvmime-0.7.1.orig/src/body.cpp 2005-03-18 22:26:46.000000000 +0100
++++ libvmime-0.7.1/src/body.cpp 2006-01-12 15:45:48.443911888 +0100
+@@ -200,6 +200,27 @@
+
+ if (partStart < end)
+ m_epilogText = string(buffer.begin() + partStart, buffer.begin() + end);
++
++ // lastPart was not found, so the last boundary was missing
++ // m_epilogText will become a bodyPart
++ if (!lastPart && pos == string::npos) {
++ bodyPart* part = new bodyPart;
++
++ try
++ {
++ part->parse(m_epilogText);
++ }
++ catch (std::exception&)
++ {
++ delete (part);
++ throw;
++ }
++
++ part->m_parent = m_part;
++
++ m_parts.push_back(part);
++ }
++
+ }
+ // Treat the contents as 'simple' data
+ else
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-oe-compatibility.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-oe-compatibility.diff
new file mode 100644
index 0000000000000..acd717dbc2a25
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-oe-compatibility.diff
@@ -0,0 +1,163 @@
+--- libvmime-0.7.1/src/defaultParameter.cpp 2007-01-26 14:44:10.243562750 +0100
++++ libvmime-0.7.1.patched/src/defaultParameter.cpp 2007-04-24 13:43:36.579203500 +0200
+@@ -186,18 +186,18 @@
+ {
+ const string& name = getName();
+ const string& value = m_value.getBuffer();
++ string tmpbuf;
++ utility::outputStreamStringAdapter tmpos(tmpbuf);
+
+ // For compatibility with implementations that do not understand RFC-2231,
+ // also generate a normal "7bit/us-ascii" parameter
+ string::size_type pos = curLinePos;
+
+- if (pos + name.length() + 10 + value.length() > maxLineLength)
+- {
+- os << NEW_LINE_SEQUENCE;
++ tmpos << NEW_LINE_SEQUENCE;
+ pos = NEW_LINE_SEQUENCE_LENGTH;
+- }
+
+ bool needQuoting = false;
++ bool needQuotedPrintable = false;
+ string::size_type valueLength = 0;
+
+ // Use worst-case length name.length()+2 for 'name=' part of line
+@@ -228,35 +228,50 @@
+ needQuoting = true;
+ break;
+ }
++ if (!parserHelpers::isAscii(value[i]))
++ {
++ needQuotedPrintable = true;
++ needQuoting = true;
++ }
+ }
+
+ const bool cutValue = (valueLength != value.length()); // has the value been cut?
+
+ if (needQuoting)
+ {
+- os << name << "=\"";
++ tmpos << name << "=\"";
+ pos += name.length() + 2;
+ }
+ else
+ {
+- os << name << "=";
++ tmpos << name << "=";
+ pos += name.length() + 1;
+ }
+
+ bool extended = false;
+-
+- for (string::size_type i = 0 ; (i < value.length()) && (pos < maxLineLength - 4) ; ++i)
++ if (needQuotedPrintable)
++ {
++ // send the name in quoted-printable, so outlook express et.al. will understand the real filename
++ size_t oldlen = tmpbuf.length();
++ m_value.generate(tmpos);
++ pos += tmpbuf.length() - oldlen;
++ extended = true; // also send with RFC-2231 encoding
++ }
++ else
++ {
++ // do not chop off this value, but just add the complete name as one header line.
++ for (string::size_type i = 0 ; (i < value.length()) /*&& (pos < maxLineLength - 4) */ ; ++i)
+ {
+ const char_t c = value[i];
+
+ if (/* needQuoting && */ (c == '"' || c == '\\')) // 'needQuoting' is implicit
+ {
+- os << '\\' << value[i]; // escape 'x' with '\x'
++ tmpos << '\\' << value[i]; // escape 'x' with '\x'
+ pos += 2;
+ }
+ else if (parserHelpers::isAscii(c))
+ {
+- os << value[i];
++ tmpos << value[i];
+ ++pos;
+ }
+ else
+@@ -264,10 +279,11 @@
+ extended = true;
+ }
+ }
++ }
+
+ if (needQuoting)
+ {
+- os << '"';
++ tmpos << '"';
+ ++pos;
+ }
+
+@@ -275,7 +291,7 @@
+ // or is too long for a single line
+ if (extended || cutValue)
+ {
+- os << ';';
++ tmpos << ';';
+ ++pos;
+
+ /* RFC-2231
+@@ -301,11 +317,8 @@
+ name.length() + 4 /* *0*= */ + 2 /* '' */
+ + m_value.getCharset().getName().length();
+
+- if (pos + firstSectionLength + 5 >= maxLineLength)
+- {
+- os << NEW_LINE_SEQUENCE;
++ tmpos << NEW_LINE_SEQUENCE;
+ pos = NEW_LINE_SEQUENCE_LENGTH;
+- }
+
+ // Split text into multiple sections that fit on one line
+ int sectionCount = 0;
+@@ -384,33 +397,36 @@
+ // Output sections
+ for (int sectionNumber = 0 ; sectionNumber < sectionCount ; ++sectionNumber)
+ {
+- os << name;
++ tmpos << name;
+
+ if (sectionCount != 1) // no section specifier when only a single one
+ {
+- os << '*';
+- os << sectionNumber;
++ tmpos << '*';
++ tmpos << sectionNumber;
+ }
+
+- os << "*=";
++ tmpos << "*=";
+
+ if (sectionNumber == 0)
+ {
+- os << m_value.getCharset().getName();
+- os << '\'' << /* No language */ '\'';
++ tmpos << m_value.getCharset().getName();
++ tmpos << '\'' << /* No language */ '\'';
+ }
+
+- os << sectionText[sectionNumber];
++ tmpos << sectionText[sectionNumber];
+
+ if (sectionNumber + 1 < sectionCount)
+ {
+- os << ';';
+- os << NEW_LINE_SEQUENCE;
++ tmpos << ';';
++ tmpos << NEW_LINE_SEQUENCE;
+ pos = NEW_LINE_SEQUENCE_LENGTH;
+ }
+ }
+ }
+
++ // write the complete header
++ os << tmpbuf;
++
+ if (newLinePos)
+ *newLinePos = pos;
+ }
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-out-of-bounds-copy.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-out-of-bounds-copy.diff
new file mode 100644
index 0000000000000..8dd673719d894
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-out-of-bounds-copy.diff
@@ -0,0 +1,11 @@
+--- libvmime-0.7.1/src/utility/filteredStream.cpp 2005-06-16 21:50:12.000000000 +0200
++++ libvmime-0.7.1.patched/src/utility/filteredStream.cpp 2007-06-15 14:29:40.907779750 +0200
+@@ -146,7 +146,7 @@
+
+ if (previousChar == '\n')
+ {
+- m_stream.write(start, pos - data);
++ m_stream.write(start, pos - start);
+ m_stream.write("..", 2);
+
+ start = pos + 1;
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-plain-bodycopy.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-plain-bodycopy.diff
new file mode 100644
index 0000000000000..6c1795d969953
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-plain-bodycopy.diff
@@ -0,0 +1,21 @@
+--- libvmime-0.7.1.orig/src/messageBuilder.cpp 2009-08-21 15:35:23.708082164 +0200
++++ libvmime-0.7.1/src/messageBuilder.cpp 2009-08-21 15:37:00.400088431 +0200
+@@ -137,6 +137,8 @@
+ if (msg->getBody()->getPartCount() == 1)
+ {
+ const bodyPart& part = *msg->getBody()->getPartAt(0);
++ // make a full copy of the body, otherwise the copyFrom will delete the body we're copying
++ const body* bodyCopy = part.getBody()->clone();
+
+ // First, copy (and replace) the header fields
+ const std::vector <const headerField*> fields = part.getHeader()->getFieldList();
+@@ -149,7 +151,8 @@
+
+ // 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);
++ delete bodyCopy;
+ }
+
+ return (msg);
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-qp-starts-on-second-line.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-qp-starts-on-second-line.diff
new file mode 100644
index 0000000000000..daf98e8c01ea2
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-qp-starts-on-second-line.diff
@@ -0,0 +1,11 @@
+diff -Nurb libvmime-0.7.1.orig/src/word.cpp libvmime-0.7.1/src/word.cpp
+--- libvmime-0.7.1.orig/src/word.cpp 2007-01-26 14:44:10.251563000 +0100
++++ libvmime-0.7.1/src/word.cpp 2007-01-26 14:45:01.074739500 +0100
+@@ -91,6 +91,7 @@
+ unencoded += ' ';
+
+ startPos = pos;
++ continue;
+ }
+ // Start of an encoded word
+ else if (pos + 8 < end && // 8 = "=?(.+)?(.+)?(.*)?="
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-encode-questionmark.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-encode-questionmark.diff
new file mode 100644
index 0000000000000..76a5f4eafcec0
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-encode-questionmark.diff
@@ -0,0 +1,11 @@
+--- libvmime-0.7.1.orig/src/encoderQP.cpp 2008-03-10 13:57:05.055163691 +0100
++++ libvmime-0.7.1.patched/src/encoderQP.cpp 2008-03-10 13:51:53.071163435 +0100
+@@ -249,7 +249,7 @@
+ default:
+ {
+ //if ((c >= 33 && c <= 60) || (c >= 62 && c <= 126))
+- if (c >= 33 && c <= 126 && c != 61)
++ if (c >= 33 && c <= 126 && c != 61 && c!= 63)
+ {
+ outBuffer[outBufferPos++] = c;
+ ++curCol;
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-specials.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-specials.diff
new file mode 100644
index 0000000000000..c7d3cb3fb3728
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-quoted-printable-specials.diff
@@ -0,0 +1,21 @@
+--- libvmime-0.7.1.orig/src/encoderQP.cpp 2005-03-18 22:26:47.000000000 +0100
++++ libvmime-0.7.1.patched/src/encoderQP.cpp 2007-02-02 10:09:26.273653250 +0100
+@@ -214,10 +214,18 @@
+ QP_ENCODE_HEX('=')
+ break;
+ }
++ // http://www.faqs.org/rfcs/rfc2047.html, see 'especials' characters
+ case ',':
+ case ';':
+ case ':':
+ case '_':
++ case '@':
++ case '(':
++ case ')':
++ case '<':
++ case '>':
++ case '[':
++ case ']':
+ {
+ if (rfc2047)
+ {
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-remove-bcc.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-remove-bcc.diff
new file mode 100644
index 0000000000000..b7535a3669bac
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-remove-bcc.diff
@@ -0,0 +1,17 @@
+--- libvmime-0.7.1-pristine/src/messaging/transport.cpp 2005-04-27 18:42:58.000000000 +0200
++++ libvmime-0.7.1/src/messaging/transport.cpp 2006-10-10 14:01:43.602621328 +0200
+@@ -90,6 +90,14 @@
+ }
+ catch (exceptions::no_such_field&) { }
+
++ // Remove BCC headers from the message we're about to send
++ try {
++ headerField* bcc = msg->getHeader()->findField(fields::BCC);
++
++ msg->getHeader()->removeField(bcc);
++ }
++ catch (exceptions::no_such_field&) { }
++
+ // Generate the message, "stream" it and delegate the sending
+ // to the generic send() function.
+ std::ostringstream oss;
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-socket-backport-and-timeout-fix.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-socket-backport-and-timeout-fix.diff
new file mode 100644
index 0000000000000..f9a1faea07536
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-socket-backport-and-timeout-fix.diff
@@ -0,0 +1,170 @@
+diff -urb libvmime-0.7.1/src/platforms/posix/posixSocket.cpp libvmime-0.7.1.patched/src/platforms/posix/posixSocket.cpp
+--- libvmime-0.7.1/src/platforms/posix/posixSocket.cpp 2007-10-18 11:19:47.000000000 +0200
++++ libvmime-0.7.1.patched/src/platforms/posix/posixSocket.cpp 2007-10-18 11:02:54.000000000 +0200
+@@ -26,6 +26,7 @@
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <fcntl.h>
++#include <errno.h>
+
+ #include "vmime/exception.hpp"
+
+@@ -43,7 +44,7 @@
+ //
+
+ posixSocket::posixSocket()
+- : m_desc(-1)
++ : m_desc(-1), m_timeouts(0)
+ {
+ }
+
+@@ -101,6 +102,8 @@
+ // Error
+ throw vmime::exceptions::connection_error("Error while connecting socket.");
+ }
++
++ m_timeouts = 0;
+ }
+
+
+@@ -121,38 +124,62 @@
+ }
+ }
+
+-
+ void posixSocket::receive(vmime::string& buffer)
+ {
+- ::ssize_t ret = ::recv(m_desc, m_buffer, sizeof(m_buffer), 0);
+-
+- if (ret == -1)
+- {
+- // Error or no data
+- return;
+- }
+- else if (ret > 0)
+- {
+- buffer = vmime::string(m_buffer, ret);
+- }
++ const int size = receiveRaw(m_buffer, sizeof(m_buffer));
++ buffer = vmime::string(m_buffer, size);
+ }
+
+
+ const int posixSocket::receiveRaw(char* buffer, const int count)
+ {
+- ::ssize_t ret = ::recv(m_desc, buffer, count, 0);
++ fd_set fds;
++ struct timeval tv;
++ int ret;
++
++ FD_ZERO(&fds);
++ FD_SET(m_desc, &fds);
++
++ tv.tv_sec = 10;
++ tv.tv_usec = 0;
++
++ ret = ::select(m_desc+1, &fds, NULL, NULL, &tv);
++ if (ret < 0)
++ {
++ if (errno != EAGAIN)
++ throwSocketError(errno);
++
++ m_timeouts++;
++ if (m_timeouts > (5*60))
++ throwSocketError(errno); // SMTP server did not react within 5 minutes
++
++ // No data available at this time
++ return 0;
++ }
+
+- if (ret == -1)
++ ret = ::recv(m_desc, buffer, count, 0);
++
++ if (ret < 0)
+ {
+- // Error or no data
+- return (0);
++ if (errno != EAGAIN)
++ throwSocketError(errno);
++
++ m_timeouts++;
++ if (m_timeouts > (5*60))
++ throwSocketError(errno); // SMTP server did not react within 5 minutes
++
++ // No data available at this time
++ return 0;
+ }
+- else
++ else if (ret == 0)
+ {
+- return (ret);
++ // Host shutdown
++ throwSocketError(ENOTCONN);
+ }
+-}
+
++ m_timeouts = 0;
++ return ret;
++}
+
+ void posixSocket::send(const vmime::string& buffer)
+ {
+@@ -166,6 +193,41 @@
+ }
+
+
++void posixSocket::throwSocketError(const int err)
++{
++ string msg;
++
++ switch (err)
++ {
++ case EACCES: msg = "EACCES: permission denied"; break;
++ case EAFNOSUPPORT: msg = "EAFNOSUPPORT: address family not supported"; break;
++ case EMFILE: msg = "EMFILE: process file table overflow"; break;
++ case ENFILE: msg = "ENFILE: system limit reached"; break;
++ case EPROTONOSUPPORT: msg = "EPROTONOSUPPORT: protocol not supported"; break;
++ case EAGAIN: msg = "EAGAIN: blocking operation"; break;
++ case EBADF: msg = "EBADF: invalid descriptor"; break;
++ case ECONNRESET: msg = "ECONNRESET: connection reset by peer"; break;
++ case EFAULT: msg = "EFAULT: bad user space address"; break;
++ case EINTR: msg = "EINTR: signal occured before transmission"; break;
++ case EINVAL: msg = "EINVAL: invalid argument"; break;
++ case EMSGSIZE: msg = "EMSGSIZE: message cannot be sent atomically"; break;
++ case ENOBUFS: msg = "ENOBUFS: output queue is full"; break;
++ case ENOMEM: msg = "ENOMEM: out of memory"; break;
++ case EPIPE:
++ case ENOTCONN: msg = "ENOTCONN: not connected"; break;
++ case ECONNREFUSED: msg = "ECONNREFUSED: connection refused"; break;
++ default:
++
++ std::ostringstream oss;
++ oss << ::strerror(err);
++
++ msg = oss.str();
++ break;
++ }
++
++ throw vmime::exceptions::connection_error(msg);
++}
++
+
+
+ //
+diff -urb libvmime-0.7.1/vmime/platforms/posix/posixSocket.hpp libvmime-0.7.1.patched/vmime/platforms/posix/posixSocket.hpp
+--- libvmime-0.7.1/vmime/platforms/posix/posixSocket.hpp 2007-10-18 11:19:47.000000000 +0200
++++ libvmime-0.7.1.patched/vmime/platforms/posix/posixSocket.hpp 2007-10-18 10:34:46.000000000 +0200
+@@ -49,10 +49,13 @@
+ void send(const vmime::string& buffer);
+ void sendRaw(const char* buffer, const int count);
+
++ void throwSocketError(const int err);
++
+ private:
+
+ char m_buffer[65536];
+ int m_desc;
++ int m_timeouts;
+ };
+
+
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-socket-tcp-nodelay.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-socket-tcp-nodelay.diff
new file mode 100644
index 0000000000000..1a1f590679583
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-socket-tcp-nodelay.diff
@@ -0,0 +1,28 @@
+--- libvmime-0.7.1.orig/src/platforms/posix/posixSocket.cpp 2005-03-18 22:26:49.000000000 +0100
++++ libvmime-0.7.1.patched/src/platforms/posix/posixSocket.cpp 2009-03-27 10:51:06.405594549 +0100
+@@ -24,6 +24,7 @@
+ #include <arpa/inet.h>
+ #include <sys/types.h>
+ #include <netinet/in.h>
++#include <netinet/tcp.h>
+ #include <netdb.h>
+ #include <fcntl.h>
+
+@@ -57,6 +58,8 @@
+
+ void posixSocket::connect(const vmime::string& address, const vmime::port_t port)
+ {
++ int flag = 1;
++
+ // Close current connection, if any
+ if (m_desc != -1)
+ {
+@@ -92,6 +95,8 @@
+ if (m_desc == -1)
+ throw vmime::exceptions::connection_error("Error while creating socket.");
+
++ ::setsockopt(m_desc, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag));
++
+ // Start connection
+ if (::connect(m_desc, reinterpret_cast <sockaddr*>(&addr), sizeof(addr)) == -1)
+ {
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-strip-header-endspaces.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-strip-header-endspaces.diff
new file mode 100644
index 0000000000000..13801b00fc4cd
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-strip-header-endspaces.diff
@@ -0,0 +1,17 @@
+--- libvmime-0.7.1/src/headerField.cpp 2007-07-31 12:54:21.898679250 +0200
++++ libvmime-0.7.1.patched/src/headerField.cpp 2007-07-31 12:43:08.408588750 +0200
+@@ -189,6 +189,14 @@
+ }
+ }
+
++ // strip spaces from end of header lines, also through continuation headers
++ contentsEnd--; // original enter
++ while (contentsEnd>contentsStart &&
++ (buffer[contentsEnd] == ' ' || buffer[contentsEnd] == '\t' ||
++ buffer[contentsEnd] == '\r' || buffer[contentsEnd] == '\n'))
++ contentsEnd--;
++ contentsEnd++; // new 'enter'
++
+ // Return a new field
+ headerField* field = headerFieldFactory::getInstance()->create(name);
+
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-threading-remove-static_non-abi-change.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-threading-remove-static_non-abi-change.diff
new file mode 100644
index 0000000000000..b5bd15ffd8555
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-threading-remove-static_non-abi-change.diff
@@ -0,0 +1,40 @@
+--- libvmime-0.7.1.orig/vmime/utility/smartPtr.hpp 2005-05-19 19:17:17.000000000 +0200
++++ libvmime-0.7.1.patched/vmime/utility/smartPtr.hpp 2009-05-13 15:21:53.276875219 +0200
+@@ -20,6 +20,9 @@
+ #ifndef VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
+ #define VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
+
++// non-portable, but atleast not an abi change
++#include <pthread.h>
++static pthread_mutex_t mapLock = PTHREAD_MUTEX_INITIALIZER;
+
+ namespace vmime {
+ namespace utility {
+@@ -108,8 +111,10 @@
+ {
+ if (m_data->refCount == 1)
+ {
++ pthread_mutex_lock(&mapLock);
+ typename MapType::iterator it = sm_map.find(m_data->ptr);
+ if (it != sm_map.end()) sm_map.erase(it);
++ pthread_mutex_unlock(&mapLock);
+
+ delete (m_data->ptr);
+ delete (m_data);
+@@ -127,6 +132,8 @@
+ {
+ detach();
+
++ pthread_mutex_lock(&mapLock);
++
+ typename MapType::iterator it = sm_map.find(p);
+
+ if (it != sm_map.end())
+@@ -141,6 +148,7 @@
+
+ sm_map.insert(typename MapType::value_type(p, m_data));
+ }
++ pthread_mutex_unlock(&mapLock);
+ }
+
+ void attach(const smart_ptr <T>& p)
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-timezone-name.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-timezone-name.diff
new file mode 100644
index 0000000000000..450d2e1053ee6
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-timezone-name.diff
@@ -0,0 +1,21 @@
+diff -Nurb libvmime-0.7.1.orig/src/dateTime.cpp libvmime-0.7.1/src/dateTime.cpp
+--- libvmime-0.7.1.orig/src/dateTime.cpp 2005-04-23 11:02:48.000000000 +0200
++++ libvmime-0.7.1/src/dateTime.cpp 2009-01-08 10:51:39.000000000 +0100
+@@ -423,7 +423,7 @@
+ zone[zoneLength++] = *p;
+ ++p;
+ }
+- while (zoneLength < 3 && p < pend && parserHelpers::isDigit(*p));
++ while (zoneLength < 3 && p < pend);
+
+ switch (zone[0])
+ {
+@@ -487,6 +487,8 @@
+
+ break;
+ }
++ case 'g':
++ case 'G':
+ case 'u':
+ case 'U':
+ {
diff --git a/libraries/libvmime-zarafa/zarafa-patches/vmime-unicode-1-1-utf-7-charset.diff b/libraries/libvmime-zarafa/zarafa-patches/vmime-unicode-1-1-utf-7-charset.diff
new file mode 100644
index 0000000000000..5014738992ea9
--- /dev/null
+++ b/libraries/libvmime-zarafa/zarafa-patches/vmime-unicode-1-1-utf-7-charset.diff
@@ -0,0 +1,23 @@
+--- libvmime-0.7.1/src/charset.cpp 2005-03-18 22:26:46.000000000 +0100
++++ libvmime-0.7.1.patched/src/charset.cpp 2007-04-23 17:08:46.714435000 +0200
+@@ -64,6 +64,9 @@
+ charset::charset(const string& name)
+ : m_name(name)
+ {
++ // if we receive this rfc-1642 valid MIME charset, convert it to something usefull for iconv
++ if (utility::stringUtils::isStringEqualNoCase(m_name, "unicode-1-1-utf-7"))
++ m_name = "utf-7";
+ }
+
+
+@@ -72,6 +75,10 @@
+ {
+ m_name = string(buffer.begin() + position, buffer.begin() + end);
+
++ // if we parsed this rfc-1642 valid MIME charset, convert it to something usefull for iconv
++ if (utility::stringUtils::isStringEqualNoCase(m_name, "unicode-1-1-utf-7"))
++ m_name = "utf-7";
++
+ setParsedBounds(position, end);
+
+ if (newPosition)