view src/vmime-1-fastforward.patch @ 1329:41f1febdeacf

upgrade package vmime
author Mark Brand <mabrand@mabrand.nl>
date Wed, 20 Oct 2010 13:12:30 +0200
parents 754f3464bc1a
children
line wrap: on
line source

This file is part of mingw-cross-env.
See doc/index.html for further information.

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
-==============================
+VMIME AUTHOR
+============
 
 Vincent Richard <vincent@vincent-richard.net>
-Project originator, design, core implementation.
+Project owner and creator. VMime was created in 1998, and publicly released
+under the GNU GPL license in 2003.
 
-Pierre Thierry <nowhere.man@levallois.eu.org>
-Patches for STL algorithms.
 
-Zarafa <http://developer.zarafa.com/VmimePatches>
-Miscellaneous patches.
-
-Other contributors:
+VMIME CONTRIBUTORS
+==================
 
  - Stefan Uhrig  <stefanuhrig@gmx.net>
  - Rafael Fernandez <prf@adinet.com.uy>
@@ -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>
+ - Pierre Thierry <nowhere.man@levallois.eu.org> (patches for STL algorithms)
+ - Zarafa <http://developer.zarafa.com/VmimePatches>
+
+Please apologize if I have forgotten someone here.  ;)
+See SVN Changelog for full list.
 
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
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
 
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-			    Preamble
+                            Preamble
 
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
 your programs, too.
 
   When we speak of free software, we are referring to freedom, not
 price.  Our General Public Licenses are designed to make sure that you
 have the freedom to distribute copies of free software (and charge for
-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.
+  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
+you modify it: responsibilities to respect the freedom of others.
 
   For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
 this License.
 
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
 otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-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
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  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
 address new problems or concerns.
 
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
 
   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 @@ 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
-convey the exclusion of warranty; and each file should have at least
+state the exclusion of warranty; and each file should have at least
 the "copyright" line and a pointer to where the full notice is found.
 
     <one line to give the program's name and a brief idea of what it does.>
     Copyright (C) <year>  <name of author>
 
-    This program is free software; you can redistribute it and/or modify
+    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
+    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,
@@ -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
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 Also add information on how to contact you by electronic and paper mail.
 
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
 
 The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+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 --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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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
 // 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/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
 // 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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/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)
-// 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,

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();
 
+	/** Tests whether this word is empty.
+	  *
+	  * @return true if the buffer is empty, false otherwise
+	  */
+	bool isEmpty() const;
+
 	/** Set the raw data for this encoded word.
 	  *
 	  * @param buffer raw data buffer

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;
 
-#if VMIME_WIDE_CHAR_SUPPORT
-	const wstring getDecodedText() const;
-#endif
-
 	/** Return the contained text converted to the specified charset.
 	  *
 	  * @param dest output charset

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);
 }
 
 

commit b7ec3accd3fa1b6dc7d7724aab968f860fe1930b
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Mon Sep 6 20:20:45 2010 +0000

    Fixed extraction of root part body.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@563 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
index adfef01..bbdba69 100644
--- a/src/net/imap/IMAPMessage.cpp
+++ b/src/net/imap/IMAPMessage.cpp
@@ -273,9 +273,12 @@ void IMAPMessage::extract(ref <const part> p, utility::outputStream& os,
 	if (peek) command << ".PEEK";
 	command << "[";
 
-	if (section.str().empty() && headerOnly)
+	if (section.str().empty())
 	{
-		command << "HEADER";
+		if (headerOnly)
+			command << "HEADER";
+		else
+			command << "TEXT";
 	}
 	else
 	{

commit 98843499d10a458f7029b054ceb3cda944e52e88
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Sep 7 07:44:15 2010 +0000

    Support filenames with charset (thanks to John van der Kamp, Zarafa).
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@564 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/parameter.cpp b/src/parameter.cpp
index d923e68..91a7e5c 100644
--- a/src/parameter.cpp
+++ b/src/parameter.cpp
@@ -25,6 +25,7 @@
 #include "vmime/parserHelpers.hpp"
 
 #include "vmime/text.hpp"
+#include "vmime/encoding.hpp"
 
 
 namespace vmime
@@ -322,7 +323,13 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
 		pos += name.length() + 1;
 	}
 
-	bool extended = false;
+	// 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 = m_value.getCharset().getRecommendedEncoding(recommendedEnc);
+	bool extended = alwaysEncode;
 
 	for (string::size_type i = 0 ; (i < value.length()) && (pos < maxLineLength - 4) ; ++i)
 	{
@@ -454,7 +461,8 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL
 			default:
 
 				encode = (!parserHelpers::isPrint(c) ||
-				          !parserHelpers::isAscii(c));
+				          !parserHelpers::isAscii(c) ||
+				          alwaysEncode);
 
 				break;
 			}

commit a5a7e03fd144e6c46e5418f8bdd0e3f754bd980f
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Sep 7 10:46:24 2010 +0000

    Added an option to recognize inline objects as attachments.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@565 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp
index 65e8c88..c23ee95 100644
--- a/src/attachmentHelper.cpp
+++ b/src/attachmentHelper.cpp
@@ -36,7 +36,8 @@ namespace vmime
 
 
 // static
-bool attachmentHelper::isBodyPartAnAttachment(ref <const bodyPart> part)
+bool attachmentHelper::isBodyPartAnAttachment
+	(ref <const bodyPart> part, const unsigned int options)
 {
 	try
 	{
@@ -49,54 +50,63 @@ bool attachmentHelper::isBodyPartAnAttachment(ref <const bodyPart> part)
 		if (disp.getName() != contentDispositionTypes::INLINE)
 			return true;
 
-		// If the Content-Disposition is 'inline' and there is no
-		// Content-Id or Content-Location field, it may be an attachment
-		if (!part->getHeader()->hasField(vmime::fields::CONTENT_ID) &&
-		    !part->getHeader()->hasField(vmime::fields::CONTENT_LOCATION))
+		if ((options & INLINE_OBJECTS) == 0)
 		{
-			// If this is the root part, it might not be an attachment
-			if (part->getParentPart() == NULL)
-				return false;
+			// If the Content-Disposition is 'inline' and there is no
+			// Content-Id or Content-Location field, it may be an attachment
+			if (!part->getHeader()->hasField(vmime::fields::CONTENT_ID) &&
+			    !part->getHeader()->hasField(vmime::fields::CONTENT_LOCATION))
+			{
+				// If this is the root part, it might not be an attachment
+				if (part->getParentPart() == NULL)
+					return false;
 
-			return true;
+				return true;
+			}
+
+			return false;
 		}
 	}
 	catch (exceptions::no_such_field&)
 	{
-		// No "Content-disposition" field: assume "attachment" if
-		// type is not "text/..." or "multipart/...".
-		mediaType type;
+		// Will try using Content-Type
+	}
 
-		try
-		{
-			const contentTypeField& ctf = dynamic_cast<contentTypeField&>
-				(*part->getHeader()->findField(fields::CONTENT_TYPE));
+	// Assume "attachment" if type is not "text/..." or "multipart/...".
+	mediaType type;
 
-			type = *ctf.getValue().dynamicCast <const mediaType>();
-		}
-		catch (exceptions::no_such_field&)
-		{
-			// If this is the root part and no Content-Type field is present,
-			// then this may not be a MIME message, so do not assume it is
-			// an attachment
-			if (part->getParentPart() == NULL)
-				return false;
+	try
+	{
+		const contentTypeField& ctf = dynamic_cast<contentTypeField&>
+			(*part->getHeader()->findField(fields::CONTENT_TYPE));
 
-			// No "Content-type" field: assume "application/octet-stream".
-			type = mediaType(mediaTypes::APPLICATION,
-			                 mediaTypes::APPLICATION_OCTET_STREAM);
-		}
+		type = *ctf.getValue().dynamicCast <const mediaType>();
+	}
+	catch (exceptions::no_such_field&)
+	{
+		// If this is the root part and no Content-Type field is present,
+		// then this may not be a MIME message, so do not assume it is
+		// an attachment
+		if (part->getParentPart() == NULL)
+			return false;
+
+		// No "Content-type" field: assume "application/octet-stream".
+		type = mediaType(mediaTypes::APPLICATION,
+				     mediaTypes::APPLICATION_OCTET_STREAM);
+	}
 
-		if (type.getType() != mediaTypes::TEXT &&
-		    type.getType() != mediaTypes::MULTIPART)
+	if (type.getType() != mediaTypes::TEXT &&
+	    type.getType() != mediaTypes::MULTIPART)
+	{
+		if ((options & INLINE_OBJECTS) == 0)
 		{
 			// If a "Content-Id" field is present, it might be an
 			// embedded object (MHTML messages)
 			if (part->getHeader()->hasField(vmime::fields::CONTENT_ID))
 				return false;
-
-			return true;
 		}
+
+		return true;
 	}
 
 	return false;
@@ -104,10 +114,10 @@ bool attachmentHelper::isBodyPartAnAttachment(ref <const bodyPart> part)
 
 
 // static
-ref <const attachment>
-	attachmentHelper::getBodyPartAttachment(ref <const bodyPart> part)
+ref <const attachment> attachmentHelper::getBodyPartAttachment
+	(ref <const bodyPart> part, const unsigned int options)
 {
-	if (!isBodyPartAnAttachment(part))
+	if (!isBodyPartAnAttachment(part, options))
 		return NULL;
 
 	mediaType type;
@@ -140,22 +150,24 @@ ref <const attachment>
 
 // static
 const std::vector <ref <const attachment> >
-	attachmentHelper::findAttachmentsInMessage(ref <const message> msg)
+	attachmentHelper::findAttachmentsInMessage
+		(ref <const message> msg, const unsigned int options)
 {
-	return findAttachmentsInBodyPart(msg);
+	return findAttachmentsInBodyPart(msg, options);
 }
 
 
 // static
 const std::vector <ref <const attachment> >
-	attachmentHelper::findAttachmentsInBodyPart(ref <const bodyPart> part)
+	attachmentHelper::findAttachmentsInBodyPart
+		(ref <const bodyPart> part, const unsigned int options)
 {
 	std::vector <ref <const attachment> > atts;
 
 	// Test this part
-	if (isBodyPartAnAttachment(part))
+	if (isBodyPartAnAttachment(part, options))
 	{
-		atts.push_back(getBodyPartAttachment(part));
+		atts.push_back(getBodyPartAttachment(part, options));
 	}
 	// Find in sub-parts
 	else
@@ -165,7 +177,7 @@ const std::vector <ref <const attachment> >
 		for (int i = 0 ; i < bdy->getPartCount() ; ++i)
 		{
 			std::vector <ref <const attachment> > partAtts =
-				findAttachmentsInBodyPart(bdy->getPartAt(i));
+				findAttachmentsInBodyPart(bdy->getPartAt(i), options);
 
 			std::copy(partAtts.begin(), partAtts.end(), std::back_inserter(atts));
 		}
diff --git a/vmime/attachmentHelper.hpp b/vmime/attachmentHelper.hpp
index 3ce86c8..a383367 100644
--- a/vmime/attachmentHelper.hpp
+++ b/vmime/attachmentHelper.hpp
@@ -30,10 +30,6 @@
 #include "vmime/attachment.hpp"
 #include "vmime/message.hpp"
 
-#if VMIME_HAVE_MESSAGING_FEATURES
-	#include "vmime/net/message.hpp"
-#endif
-
 
 namespace vmime
 {
@@ -45,31 +41,57 @@ class attachmentHelper
 {
 public:
 
+	/** Options for use with the following functions:
+	  *     findAttachmentsInMessage,
+	  *     getBodyPartAttachment,
+	  * and isBodyPartAnAttachment.
+	  */
+	enum FindOptions
+	{
+		INLINE_OBJECTS = (1 << 0)        /**< Recognize and return inline objects. The aim is to
+		                                      consider MHTML objects (parts with a "Content-Id" or
+		                                      a "Content-Location", such as inline images) as attachments. */
+	};
+
 	/** Test whether a body part is an attachment.
 	  *
 	  * @param part message part to test
+	  * @param options search options (see FindOptions)
 	  * @return true if the part is an attachment, false otherwise
 	  */
-	static bool isBodyPartAnAttachment(ref <const bodyPart> part);
+	static bool isBodyPartAnAttachment(ref <const bodyPart> part, const unsigned int options = 0);
 
 	/** Return attachment information in the specified body part.
 	  * If the specified body part does not contain attachment
 	  * information (ie. is not an attachment), NULL is returned.
 	  *
 	  * @param part message part in which to search
+	  * @param options search options (see FindOptions)
 	  * @return attachment found in the part, or NULL
 	  */
 	static ref <const attachment>
-		getBodyPartAttachment(ref <const bodyPart> part);
+		getBodyPartAttachment(ref <const bodyPart> part, const unsigned int options = 0);
+
+	/** Find all attachments contained in the specified part
+	  * and all its children parts.
+	  * This is simply a recursive call to getBodyPartAttachment().
+	  *
+	  * @param part part in which to search
+	  * @param options search options (see FindOptions)
+	  * @return a list of attachments found
+	  */
+	static const std::vector <ref <const attachment> >
+		findAttachmentsInBodyPart(ref <const bodyPart> part, const unsigned int options = 0);
 
 	/** Find all attachments contained in the specified message.
 	  * This is simply a recursive call to getBodyPartAttachment().
 	  *
 	  * @param msg message in which to search
+	  * @param options search options (see FindOptions)
 	  * @return a list of attachments found
 	  */
 	static const std::vector <ref <const attachment> >
-		findAttachmentsInMessage(ref <const message> msg);
+		findAttachmentsInMessage(ref <const message> msg, const unsigned int options = 0);
 
 	/** Add an attachment to the specified message.
 	  *
@@ -87,9 +109,6 @@ public:
 
 protected:
 
-	static const std::vector <ref <const attachment> >
-		findAttachmentsInBodyPart(ref <const bodyPart> part);
-
 	static ref <bodyPart> findBodyPart
 		(ref <bodyPart> part, const mediaType& type);
 };

commit 81d279e1f26e9938489ed0a64f26a0873e86b7ee
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Oct 12 09:45:16 2010 +0000

    Encode quotation marks in QP/RFC-2047.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@566 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp
index c3a8c6d..e20be9f 100644
--- a/src/utility/encoder/qpEncoder.cpp
+++ b/src/utility/encoder/qpEncoder.cpp
@@ -236,6 +236,7 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
 		case '>':
 		case '[':
 		case ']':
+		case '"':
 		{
 			if (rfc2047)
 			{
diff --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
index 4a7e394..b455d91 100644
--- a/tests/parser/textTest.cpp
+++ b/tests/parser/textTest.cpp
@@ -46,6 +46,7 @@ VMIME_TEST_SUITE_BEGIN
 		VMIME_TEST(testWordGenerateMultiBytes)
 		VMIME_TEST(testWordGenerateQuote)
 		VMIME_TEST(testWordGenerateSpecialCharsets)
+		VMIME_TEST(testWordGenerateSpecials)
 	VMIME_TEST_LIST_END
 
 
@@ -370,5 +371,12 @@ VMIME_TEST_SUITE_BEGIN
 				vmime::charset("iso-2022-jp")).generate(100)));
 	}
 
+	void testWordGenerateSpecials()
+	{
+		// In RFC-2047, quotation marks (ASCII 22h) should be encoded
+		VASSERT_EQ("1", "=?UTF-8?Q?=22=C3=9Cml=C3=A4ute=22?=",
+			vmime::word("\x22\xC3\x9Cml\xC3\xA4ute\x22", vmime::charset("UTF-8")).generate());
+	}
+
 VMIME_TEST_SUITE_END
 
diff --git a/tests/utility/encoderTest.cpp b/tests/utility/encoderTest.cpp
index 4e2c9a7..f2d42b6 100644
--- a/tests/utility/encoderTest.cpp
+++ b/tests/utility/encoderTest.cpp
@@ -33,15 +33,19 @@ VMIME_TEST_SUITE_BEGIN
 	VMIME_TEST_LIST_BEGIN
 		VMIME_TEST(testBase64)
 		VMIME_TEST(testQuotedPrintable)
+		VMIME_TEST(testQuotedPrintable_RFC2047)
 	VMIME_TEST_LIST_END
 
 
 	// Encoding helper function
-	static const vmime::string encode(const vmime::string& name, const vmime::string& in, int maxLineLength = 0)
+	static const vmime::string encode(const vmime::string& name, const vmime::string& in,
+		int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet())
 	{
 		vmime::ref <vmime::utility::encoder::encoder> enc =
 			vmime::utility::encoder::encoderFactory::getInstance()->create(name);
 
+		enc->getProperties() = props;
+
 		if (maxLineLength != 0)
 			enc->getProperties()["maxlinelength"] = maxLineLength;
 
@@ -284,6 +288,37 @@ VMIME_TEST_SUITE_BEGIN
 		}
 	}
 
+	void testQuotedPrintable_RFC2047()
+	{
+		/*
+		 * The RFC (http://tools.ietf.org/html/rfc2047#section-5) says:
+		 *
+		 *    In this case the set of characters that may be used in a "Q"-encoded
+		 *    'encoded-word' is restricted to: <upper and lower case ASCII
+		 *    letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"
+		 *    (underscore, ASCII 95.)>.  An 'encoded-word' that appears within a
+		 *    'phrase' MUST be separated from any adjacent 'word', 'text' or
+		 *    'special' by 'linear-white-space'.
+		 */
+
+		vmime::propertySet encProps;
+		encProps["rfc2047"] = true;
+
+		// Ensure 'especials' are encoded
+		VASSERT_EQ("especials.1",  "=2C", encode("quoted-printable", ",", 10, encProps));
+		VASSERT_EQ("especials.2",  "=3B", encode("quoted-printable", ";", 10, encProps));
+		VASSERT_EQ("especials.3",  "=3A", encode("quoted-printable", ":", 10, encProps));
+		VASSERT_EQ("especials.4",  "=5F", encode("quoted-printable", "_", 10, encProps));
+		VASSERT_EQ("especials.5",  "=40", encode("quoted-printable", "@", 10, encProps));
+		VASSERT_EQ("especials.6",  "=28", encode("quoted-printable", "(", 10, encProps));
+		VASSERT_EQ("especials.7",  "=29", encode("quoted-printable", ")", 10, encProps));
+		VASSERT_EQ("especials.8",  "=3C", encode("quoted-printable", "<", 10, encProps));
+		VASSERT_EQ("especials.9",  "=3E", encode("quoted-printable", ">", 10, encProps));
+		VASSERT_EQ("especials.10", "=5B", encode("quoted-printable", "[", 10, encProps));
+		VASSERT_EQ("especials.11", "=5D", encode("quoted-printable", "]", 10, encProps));
+		VASSERT_EQ("especials.12", "=22", encode("quoted-printable", "\"", 10, encProps));
+	}
+
 	// TODO: UUEncode
 
 VMIME_TEST_SUITE_END

commit fb268637f2f06d710f0ef475d71a8d4034a28e6c
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Oct 12 17:10:58 2010 +0000

    Better RFC-2047 encoding.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@567 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp
index e20be9f..aa95022 100644
--- a/src/utility/encoder/qpEncoder.cpp
+++ b/src/utility/encoder/qpEncoder.cpp
@@ -51,10 +51,52 @@ const std::vector <string> qpEncoder::getAvailableProperties() const
 
 
 
-// Encoding table
+// Hex-encoding table
 const unsigned char qpEncoder::sm_hexDigits[] = "0123456789ABCDEF";
 
-// Decoding table
+
+// RFC-2047 encoding table: we always encode RFC-2047 using the restricted
+// charset, that is the one used for 'phrase' in From/To/Cc/... headers.
+//
+// " The set of characters that may be used in a "Q"-encoded 'encoded-word'
+//   is restricted to: <upper and lower case ASCII letters, decimal digits,
+//   "!", "*", "+", "-", "/", "=", and "_" (underscore, ASCII 95.)>. "
+//
+// Two special cases:
+// - encode space (32) as underscore (95)
+// - encode underscore as hex (=5F)
+//
+// This is a quick lookup table:
+//   '1' means "encode", '0' means "no encoding"
+//
+const unsigned char qpEncoder::sm_RFC2047EncodeTable[] =
+{
+	/*   0  NUL */ 1, /*   1  SOH */ 1, /*   2  STX */ 1, /*   3  ETX */ 1, /*   4  EOT */ 1, /*   5  ENQ */ 1,
+	/*   6  ACK */ 1, /*   7  BEL */ 1, /*   8   BS */ 1, /*   9  TAB */ 1, /*  10   LF */ 1, /*  11   VT */ 1,
+	/*  12   FF */ 1, /*  13   CR */ 1, /*  14   SO */ 1, /*  15   SI */ 1, /*  16  DLE */ 1, /*  17  DC1 */ 1,
+	/*  18  DC2 */ 1, /*  19  DC3 */ 1, /*  20  DC4 */ 1, /*  21  NAK */ 1, /*  22  SYN */ 1, /*  23  ETB */ 1,
+	/*  24  CAN */ 1, /*  25   EM */ 1, /*  26  SUB */ 1, /*  27  ESC */ 1, /*  28   FS */ 1, /*  29   GS */ 1,
+	/*  30   RS */ 1, /*  31   US */ 1, /*  32 SPACE*/ 1, /*  33    ! */ 0, /*  34    " */ 1, /*  35    # */ 1,
+	/*  36    $ */ 1, /*  37    % */ 1, /*  38    & */ 1, /*  39    ' */ 1, /*  40    ( */ 1, /*  41    ) */ 1,
+	/*  42    * */ 0, /*  43    + */ 0, /*  44    , */ 1, /*  45    - */ 0, /*  46    . */ 1, /*  47    / */ 0,
+	/*  48    0 */ 0, /*  49    1 */ 0, /*  50    2 */ 0, /*  51    3 */ 0, /*  52    4 */ 0, /*  53    5 */ 0,
+	/*  54    6 */ 0, /*  55    7 */ 0, /*  56    8 */ 0, /*  57    9 */ 0, /*  58    : */ 1, /*  59    ; */ 1,
+	/*  60    < */ 1, /*  61    = */ 1, /*  62    > */ 1, /*  63    ? */ 1, /*  64    @ */ 1, /*  65    A */ 0,
+	/*  66    B */ 0, /*  67    C */ 0, /*  68    D */ 0, /*  69    E */ 0, /*  70    F */ 0, /*  71    G */ 0,
+	/*  72    H */ 0, /*  73    I */ 0, /*  74    J */ 0, /*  75    K */ 0, /*  76    L */ 0, /*  77    M */ 0,
+	/*  78    N */ 0, /*  79    O */ 0, /*  80    P */ 0, /*  81    Q */ 0, /*  82    R */ 0, /*  83    S */ 0,
+	/*  84    T */ 0, /*  85    U */ 0, /*  86    V */ 0, /*  87    W */ 0, /*  88    X */ 0, /*  89    Y */ 0,
+	/*  90    Z */ 0, /*  91    [ */ 1, /*  92    " */ 1, /*  93    ] */ 1, /*  94    ^ */ 1, /*  95    _ */ 1,
+	/*  96    ` */ 1, /*  97    a */ 0, /*  98    b */ 0, /*  99    c */ 0, /* 100    d */ 0, /* 101    e */ 0,
+	/* 102    f */ 0, /* 103    g */ 0, /* 104    h */ 0, /* 105    i */ 0, /* 106    j */ 0, /* 107    k */ 0,
+	/* 108    l */ 0, /* 109    m */ 0, /* 110    n */ 0, /* 111    o */ 0, /* 112    p */ 0, /* 113    q */ 0,
+	/* 114    r */ 0, /* 115    s */ 0, /* 116    t */ 0, /* 117    u */ 0, /* 118    v */ 0, /* 119    w */ 0,
+	/* 120    x */ 0, /* 121    y */ 0, /* 122    z */ 0, /* 123    { */ 1, /* 124    | */ 1, /* 125    } */ 1,
+	/* 126    ~ */ 1, /* 127  DEL */ 1
+};
+
+
+// Hex-decoding table
 const unsigned char qpEncoder::sm_hexDecodeTable[256] =
 {
 	 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -76,6 +118,36 @@ const unsigned char qpEncoder::sm_hexDecodeTable[256] =
 };
 
 
+// static
+bool qpEncoder::RFC2047_isEncodingNeededForChar(const unsigned char c)
+{
+	return (c >= 128 || sm_RFC2047EncodeTable[c] != 0);
+}
+
+
+// static
+int qpEncoder::RFC2047_getEncodedLength(const unsigned char c)
+{
+	if (c >= 128 || sm_RFC2047EncodeTable[c] != 0)
+	{
+		if (c == 32)  // space
+		{
+			// Encoded as "_"
+			return 1;
+		}
+		else
+		{
+			// Hex encoding
+			return 3;
+		}
+	}
+	else
+	{
+		return 1;  // no encoding
+	}
+}
+
+
 #ifndef VMIME_BUILDING_DOC
 
 #define QP_ENCODE_HEX(x) \
@@ -83,7 +155,7 @@ const unsigned char qpEncoder::sm_hexDecodeTable[256] =
 	outBuffer[outBufferPos + 1] = sm_hexDigits[x >> 4];  \
 	outBuffer[outBufferPos + 2] = sm_hexDigits[x & 0xF]; \
 	outBufferPos += 3;                                       \
-	curCol += 3;
+	curCol += 3
 
 #define QP_WRITE(s, x, l) s.write(reinterpret_cast <utility::stream::value_type*>(x), l)
 
@@ -145,34 +217,51 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
 		// Get the next char and encode it
 		const unsigned char c = static_cast <unsigned char>(buffer[bufferPos++]);
 
-		switch (c)
-		{
-		case '.':
+		if (rfc2047)
 		{
-			if (!rfc2047 && curCol == 0)
+			if (c >= 128 || sm_RFC2047EncodeTable[c] != 0)
 			{
-				// If a '.' appears at the beginning of a line, we encode it to
-				// to avoid problems with SMTP servers... ("\r\n.\r\n" means the
-				// end of data transmission).
-				QP_ENCODE_HEX('.')
-				continue;
+				if (c == 32)  // space
+				{
+					// RFC-2047, Page 5, 4.2. The "Q" encoding:
+					// << The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
+					// represented as "_" (underscore, ASCII 95.). >>
+					outBuffer[outBufferPos++] = '_';
+					++curCol;
+				}
+				else
+				{
+					// Other characters: '=' + hexadecimal encoding
+					QP_ENCODE_HEX(c);
+				}
+			}
+			else
+			{
+				// No encoding
+				outBuffer[outBufferPos++] = c;
+				++curCol;
 			}
-
-			outBuffer[outBufferPos++] = '.';
-			++curCol;
-			break;
 		}
-		case ' ':
+		else
 		{
-			// RFC-2047, Page 5, 4.2. The "Q" encoding:
-			// << The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
-			// represented as "_" (underscore, ASCII 95.). >>
-			if (rfc2047)
+			switch (c)
 			{
-				outBuffer[outBufferPos++] = '_';
+			case 46:  // .
+			{
+				if (curCol == 0)
+				{
+					// If a '.' appears at the beginning of a line, we encode it to
+					// to avoid problems with SMTP servers... ("\r\n.\r\n" means the
+					// end of data transmission).
+					QP_ENCODE_HEX('.');
+					continue;
+				}
+
+				outBuffer[outBufferPos++] = '.';
 				++curCol;
+				break;
 			}
-			else
+			case 32:  // space
 			{
 				// Need to get more data?
 				if (bufferPos >= bufferLength)
@@ -192,100 +281,74 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
 					outBuffer[outBufferPos++] = ' ';
 					++curCol;
 				}
-			}
 
-			break;
-		}
-		case '\t':
-		{
-			QP_ENCODE_HEX(c)
-			break;
-		}
-		case '\r':
-		case '\n':
-		{
-			// Text mode (where using CRLF or LF or ... does not
-			// care for a new line...)
-			if (text)
-			{
-				outBuffer[outBufferPos++] = c;
-				++curCol;
+				break;
 			}
-			// Binary mode (where CR and LF bytes are important!)
-			else
+			case 9:   // TAB
 			{
-				QP_ENCODE_HEX(c)
-			}
-
-			break;
-		}
-		case '=':
-		{
-			QP_ENCODE_HEX('=')
-			break;
-		}
-		// RFC-2047 'especials' characters
-		case ',':
-		case ';':
-		case ':':
-		case '_':
-		case '@':
-		case '(':
-		case ')':
-		case '<':
-		case '>':
-		case '[':
-		case ']':
-		case '"':
-		{
-			if (rfc2047)
-			{
-				QP_ENCODE_HEX(c)
+				QP_ENCODE_HEX(c);
+				break;
 			}
-			else
+			case 13:  // CR
+			case 10:  // LF
 			{
-				outBuffer[outBufferPos++] = c;
-				++curCol;
-			}
+				// Text mode (where using CRLF or LF or ... does not
+				// care for a new line...)
+				if (text)
+				{
+					outBuffer[outBufferPos++] = c;
+					++curCol;
+				}
+				// Binary mode (where CR and LF bytes are important!)
+				else
+				{
+					QP_ENCODE_HEX(c);
+				}
 
-			break;
-		}
-		/*
-			Rule #2: (Literal representation) Octets with decimal values of 33
-			through 60 inclusive, and 62 through 126, inclusive, MAY be
-			represented as the ASCII characters which correspond to those
-			octets (EXCLAMATION POINT through LESS THAN, and GREATER THAN
-			through TILDE, respectively).
-		*/
-		default:
-		{
-			//if ((c >= 33 && c <= 60) || (c >= 62 && c <= 126))
-			if (c >= 33 && c <= 126 && c != 61 && c != 63)
-			{
-				outBuffer[outBufferPos++] = c;
-				++curCol;
+				break;
 			}
-			// Other characters: '=' + hexadecimal encoding
-			else
+			case 61:  // =
 			{
-				QP_ENCODE_HEX(c)
+				QP_ENCODE_HEX('=');
+				break;
 			}
+			/*
+				Rule #2: (Literal representation) Octets with decimal values of 33
+				through 60 inclusive, and 62 through 126, inclusive, MAY be
+				represented as the ASCII characters which correspond to those
+				octets (EXCLAMATION POINT through LESS THAN, and GREATER THAN
+				through TILDE, respectively).
+			*/
+			default:
+
+				//if ((c >= 33 && c <= 60) || (c >= 62 && c <= 126))
+				if (c >= 33 && c <= 126 && c != 61 && c != 63)
+				{
+					outBuffer[outBufferPos++] = c;
+					++curCol;
+				}
+				// Other characters: '=' + hexadecimal encoding
+				else
+				{
+					QP_ENCODE_HEX(c);
+				}
 
-			break;
-		}
+				break;
 
-		}
+			} // switch (c)
 
-		// Soft line break : "=\r\n"
-		if (cutLines && curCol >= maxLineLength - 1)
-		{
-			outBuffer[outBufferPos] = '=';
-			outBuffer[outBufferPos + 1] = '\r';
-			outBuffer[outBufferPos + 2] = '\n';
+			// Soft line break : "=\r\n"
+			if (cutLines && curCol >= maxLineLength - 1)
+			{
+				outBuffer[outBufferPos] = '=';
+				outBuffer[outBufferPos + 1] = '\r';
+				outBuffer[outBufferPos + 2] = '\n';
 
-			outBufferPos += 3;
-			curCol = 0;
-		}
+				outBufferPos += 3;
+				curCol = 0;
+			}
+
+		} // !rfc2047
 
 		++inTotal;
 
diff --git a/src/wordEncoder.cpp b/src/wordEncoder.cpp
index 22994ed..67bd7a1 100644
--- a/src/wordEncoder.cpp
+++ b/src/wordEncoder.cpp
@@ -150,29 +150,9 @@ const string wordEncoder::getNextChunk(const string::size_type maxLength)
 			while ((inputCount == 0 || outputCount < maxLength) && (inputCount < remaining))
 			{
 				const unsigned char c = m_buffer[m_pos + inputCount];
-				bool encoded = true;
-
-				switch (c)
-				{
-				case ',':
-				case ';':
-				case ':':
-				case '_':
-				case '=':
-
-					encoded = true;
-					break;
-
-				default:
-
-					if (c >= 33 && c <= 126 && c != 61)
-						encoded = false;
-
-					break;
-				}
 
 				inputCount++;
-				outputCount += (encoded ? 3 : 1);
+				outputCount += utility::encoder::qpEncoder::RFC2047_getEncodedLength(c);
 			}
 
 			// Encode chunk
@@ -217,28 +197,7 @@ const string wordEncoder::getNextChunk(const string::size_type maxLength)
 				for (string::size_type i = 0, n = encodeBytes.length() ; i < n ; ++i)
 				{
 					const unsigned char c = encodeBytes[i];
-					bool encoded = true;
-
-					switch (c)
-					{
-					case ',':
-					case ';':
-					case ':':
-					case '_':
-					case '=':
-
-						encoded = true;
-						break;
-
-					default:
-
-						if (c >= 33 && c <= 126 && c != 61)
-							encoded = false;
-
-						break;
-					}
-
-					outputCount += (encoded ? 3 : 1);
+					outputCount += utility::encoder::qpEncoder::RFC2047_getEncodedLength(c);
 				}
 			}
 
diff --git a/vmime/utility/encoder/qpEncoder.hpp b/vmime/utility/encoder/qpEncoder.hpp
index 098b4c8..a969126 100644
--- a/vmime/utility/encoder/qpEncoder.hpp
+++ b/vmime/utility/encoder/qpEncoder.hpp
@@ -47,10 +47,14 @@ public:
 
 	const std::vector <string> getAvailableProperties() const;
 
+	static bool RFC2047_isEncodingNeededForChar(const unsigned char c);
+	static int RFC2047_getEncodedLength(const unsigned char c);
+
 protected:
 
 	static const unsigned char sm_hexDigits[17];
 	static const unsigned char sm_hexDecodeTable[256];
+	static const unsigned char sm_RFC2047EncodeTable[128];
 };
 
 

commit 3c46d1a864399d924a4a7c8a0cfdd348ecfd5fbc
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Oct 12 20:01:34 2010 +0000

    Fixed missing whitespace in text parsing.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@568 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/text.cpp b/src/text.cpp
index a2fe060..2454456 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -299,6 +299,12 @@ void text::createFromString(const string& in, const charset& ch)
 					}
 					else
 					{
+						if (count)
+						{
+							ref <word> w = getWordAt(getWordCount() - 1);
+							w->getBuffer() += ' ';
+						}
+
 						appendWord(vmime::create <word>(chunk, ch));
 
 						prevIs8bit = true;
@@ -314,6 +320,12 @@ void text::createFromString(const string& in, const charset& ch)
 					}
 					else
 					{
+						if (count)
+						{
+							ref <word> w = getWordAt(getWordCount() - 1);
+							w->getBuffer() += ' ';
+						}
+
 						appendWord(vmime::create <word>
 							(chunk, charset(charsets::US_ASCII)));
 
diff --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
index b455d91..c60da5a 100644
--- a/tests/parser/textTest.cpp
+++ b/tests/parser/textTest.cpp
@@ -47,6 +47,9 @@ VMIME_TEST_SUITE_BEGIN
 		VMIME_TEST(testWordGenerateQuote)
 		VMIME_TEST(testWordGenerateSpecialCharsets)
 		VMIME_TEST(testWordGenerateSpecials)
+
+		VMIME_TEST(testWhitespace)
+		VMIME_TEST(testWhitespaceMBox)
 	VMIME_TEST_LIST_END
 
 
@@ -141,9 +144,9 @@ VMIME_TEST_SUITE_BEGIN
 		t2.createFromString(s2, c2);
 
 		VASSERT_EQ("2.1", 3, t2.getWordCount());
-		VASSERT_EQ("2.2", "some ASCII characters and special chars:", t2.getWordAt(0)->getBuffer());
+		VASSERT_EQ("2.2", "some ASCII characters and special chars: ", t2.getWordAt(0)->getBuffer());
 		VASSERT_EQ("2.3", vmime::charset(vmime::charsets::US_ASCII), t2.getWordAt(0)->getCharset());
-		VASSERT_EQ("2.4", "\xf1\xf2\xf3\xf4", t2.getWordAt(1)->getBuffer());
+		VASSERT_EQ("2.4", "\xf1\xf2\xf3\xf4 ", t2.getWordAt(1)->getBuffer());
 		VASSERT_EQ("2.5", c2, t2.getWordAt(1)->getCharset());
 		VASSERT_EQ("2.6", "and then more ASCII chars.", t2.getWordAt(2)->getBuffer());
 		VASSERT_EQ("2.7", vmime::charset(vmime::charsets::US_ASCII), t2.getWordAt(2)->getCharset());
@@ -378,5 +381,52 @@ VMIME_TEST_SUITE_BEGIN
 			vmime::word("\x22\xC3\x9Cml\xC3\xA4ute\x22", vmime::charset("UTF-8")).generate());
 	}
 
+	void testWhitespace()
+	{
+		// Create
+		vmime::text text;
+		text.createFromString("Achim Br\xc3\xa4ndt", vmime::charsets::UTF_8);
+
+		VASSERT_EQ("1", 2, text.getWordCount());
+		VASSERT_EQ("2", "Achim ", text.getWordAt(0)->getBuffer());
+		VASSERT_EQ("3", "us-ascii", text.getWordAt(0)->getCharset());
+		VASSERT_EQ("4", "Br\xc3\xa4ndt", text.getWordAt(1)->getBuffer());
+		VASSERT_EQ("5", "utf-8", text.getWordAt(1)->getCharset());
+
+		// Generate
+		VASSERT_EQ("6", "Achim =?utf-8?Q?Br=C3=A4ndt?=", text.generate());
+
+		// Parse
+		text.parse("=?us-ascii?Q?Achim_?= =?utf-8?Q?Br=C3=A4ndt?=");
+
+		VASSERT_EQ("7", 2, text.getWordCount());
+		VASSERT_EQ("8", "Achim ", text.getWordAt(0)->getBuffer());
+		VASSERT_EQ("9", "us-ascii", text.getWordAt(0)->getCharset());
+		VASSERT_EQ("10", "Br\xc3\xa4ndt", text.getWordAt(1)->getBuffer());
+		VASSERT_EQ("11", "utf-8", text.getWordAt(1)->getCharset());
+	}
+
+	void testWhitespaceMBox()
+	{
+		// Space MUST be encoded inside a word
+		vmime::mailbox mbox(vmime::text("Achim Br\xc3\xa4ndt", vmime::charsets::UTF_8), "me@vmime.org");
+		VASSERT_EQ("generate1", "=?us-ascii?Q?Achim_?= =?utf-8?Q?Br=C3=A4ndt?= <me@vmime.org>", mbox.generate());
+
+		vmime::text txt;
+		txt.appendWord(vmime::create <vmime::word>("Achim ", "us-ascii"));
+		txt.appendWord(vmime::create <vmime::word>("Br\xc3\xa4ndt", "utf-8"));
+		mbox = vmime::mailbox(txt, "me@vmime.org");
+		VASSERT_EQ("generate2", "=?us-ascii?Q?Achim_?= =?utf-8?Q?Br=C3=A4ndt?= <me@vmime.org>", mbox.generate());
+
+		mbox.parse("=?us-ascii?Q?Achim?= =?utf-8?Q?Br=C3=A4ndt?= <me@vmime.org>");
+		VASSERT_EQ("parse.name.count", 2, mbox.getName().getWordCount());
+		VASSERT_EQ("parse.name.word1.buffer", "Achim", mbox.getName().getWordAt(0)->getBuffer());
+		VASSERT_EQ("parse.name.word1.charset", "us-ascii", mbox.getName().getWordAt(0)->getCharset());
+		VASSERT_EQ("parse.name.word2.buffer", "Br\xc3\xa4ndt", mbox.getName().getWordAt(1)->getBuffer());
+		VASSERT_EQ("parse.name.word2.charset", "utf-8", mbox.getName().getWordAt(1)->getCharset());
+
+		VASSERT_EQ("parse.email", "me@vmime.org", mbox.getEmail());
+	}
+
 VMIME_TEST_SUITE_END
 

commit 5c4011ca61000a4ae09705d360d6b85ea9128dc3
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Mon Oct 18 14:20:34 2010 +0000

    Fold non-encoded lines in the case there is no whitespace in them.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@569 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/word.cpp b/src/word.cpp
index 9d0177f..db720dc 100644
--- a/src/word.cpp
+++ b/src/word.cpp
@@ -351,7 +351,6 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
 	//  - there is enough remaining space on the current line to hold the whole buffer
 	if (!encodingNeeded &&
 	    (flags & text::QUOTE_IF_POSSIBLE) &&
-	    !encodingNeeded &&
 	    m_buffer.find('"') == string::npos &&
 	    (curLineLength + 2 /* 2 x " */ + m_buffer.length()) < maxLineLength)
 	{
@@ -361,6 +360,40 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
 	// We will fold lines without encoding them.
 	else if (!encodingNeeded)
 	{
+		// Here, we could have the following conditions:
+		//
+		//  * a maximum line length of N bytes
+		//  * a buffer containing N+1 bytes, with no whitespace
+		//
+		// Look in the buffer for any run (ie. whitespace-separated sequence) which
+		// is longer than the maximum line length. If there is one, then force encoding,
+		// so that no generated line is longer than the maximum line length.
+		string::size_type maxRunLength = 0;
+		string::size_type curRunLength = 0;
+
+		for (string::const_iterator p = m_buffer.begin(), end = m_buffer.end() ; p != end ; ++p)
+		{
+			if (parserHelpers::isSpace(*p))
+			{
+				maxRunLength = std::max(maxRunLength, curRunLength);
+				curRunLength = 0;
+			}
+			else
+			{
+				curRunLength++;
+			}
+		}
+
+		maxRunLength = std::max(maxRunLength, curRunLength);
+
+		if (maxRunLength >= maxLineLength - 3)
+		{
+			// Generate with encoding forced
+			generate(os, maxLineLength, curLinePos, newLinePos, flags | text::FORCE_ENCODING, state);
+			return;
+		}
+
+		// Output runs, and fold line when a whitespace is encountered
 		string::const_iterator lastWSpos = m_buffer.end(); // last white-space position
 		string::const_iterator curLineStart = m_buffer.begin(); // current line start
 
diff --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
index c60da5a..b84f376 100644
--- a/tests/parser/textTest.cpp
+++ b/tests/parser/textTest.cpp
@@ -50,6 +50,8 @@ VMIME_TEST_SUITE_BEGIN
 
 		VMIME_TEST(testWhitespace)
 		VMIME_TEST(testWhitespaceMBox)
+
+		VMIME_TEST(testFoldingAscii)
 	VMIME_TEST_LIST_END
 
 
@@ -428,5 +430,17 @@ VMIME_TEST_SUITE_BEGIN
 		VASSERT_EQ("parse.email", "me@vmime.org", mbox.getEmail());
 	}
 
+	void testFoldingAscii()
+	{
+		// In this test, no encoding is needed, but line should be folded anyway
+		vmime::word w("01234567890123456789012345678901234567890123456789"
+		              "01234567890123456789012345678901234567890123456789", vmime::charset("us-ascii"));
+
+		VASSERT_EQ("fold.ascii",
+			"=?us-ascii?Q?01234567890123456789012345678901234?=\r\n"
+			" =?us-ascii?Q?5678901234567890123456789012345678?=\r\n"
+			" =?us-ascii?Q?9012345678901234567890123456789?=", w.generate(50));
+	}
+
 VMIME_TEST_SUITE_END
 

commit efeffacbf9ef683edb4c6cd92b9582df67b8fca4
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Oct 19 13:28:43 2010 +0000

    Added support for DRAFT flag.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@570 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/AUTHORS b/AUTHORS
index f0b5e2d..6acebd0 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -20,6 +20,7 @@ VMIME CONTRIBUTORS
  - 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>
+ - Achim Brändt <http://sourceforge.net/users/a-brandt/>
 
 Please apologize if I have forgotten someone here.  ;)
 See SVN Changelog for full list.
diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
index bbdba69..bc661ed 100644
--- a/src/net/imap/IMAPMessage.cpp
+++ b/src/net/imap/IMAPMessage.cpp
@@ -555,6 +555,7 @@ void IMAPMessage::setFlags(const int flags, const int mode)
 	if (flags & FLAG_MARKED) flagList.push_back("\\Flagged");
 	if (flags & FLAG_DELETED) flagList.push_back("\\Deleted");
 	if (flags & FLAG_SEEN) flagList.push_back("\\Seen");
+	if (flags & FLAG_DRAFT) flagList.push_back("\\Draft");
 
 	if (!flagList.empty())
 	{
diff --git a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp
index c4651ed..0d6fc47 100644
--- a/src/net/imap/IMAPUtils.cpp
+++ b/src/net/imap/IMAPUtils.cpp
@@ -419,10 +419,12 @@ int IMAPUtils::messageFlagsFromFlags(const IMAPParser::flag_list* list)
 		case IMAPParser::flag::SEEN:
 			flags |= message::FLAG_SEEN;
 			break;
+		case IMAPParser::flag::DRAFT:
+			flags |= message::FLAG_DRAFT;
+			break;
 
 		default:
 		//case IMAPParser::flag::UNKNOWN:
-		//case IMAPParser::flag::DRAFT:
 			break;
 		}
 	}
@@ -439,6 +441,7 @@ const string IMAPUtils::messageFlagList(const int flags)
 	if (flags & message::FLAG_MARKED) flagList.push_back("\\Flagged");
 	if (flags & message::FLAG_DELETED) flagList.push_back("\\Deleted");
 	if (flags & message::FLAG_SEEN) flagList.push_back("\\Seen");
+	if (flags & message::FLAG_DRAFT) flagList.push_back("\\Draft");
 
 	if (!flagList.empty())
 	{
diff --git a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
index 19887b2..3430d1f 100644
--- a/src/net/maildir/maildirUtils.cpp
+++ b/src/net/maildir/maildirUtils.cpp
@@ -102,6 +102,7 @@ int maildirUtils::extractFlags(const utility::file::path::component& comp)
 		case 'T': case 't': flags |= message::FLAG_DELETED; break;
 		case 'F': case 'f': flags |= message::FLAG_MARKED; break;
 		case 'P': case 'p': flags |= message::FLAG_PASSED; break;
+		case 'D': case 'd': flags |= message::FLAG_DRAFT; break;
 		}
 	}
 
@@ -121,6 +122,7 @@ const utility::file::path::component maildirUtils::buildFlags(const int flags)
 	if (flags & message::FLAG_REPLIED) str += "R";
 	if (flags & message::FLAG_SEEN)    str += "S";
 	if (flags & message::FLAG_DELETED) str += "T";
+	if (flags & message::FLAG_DRAFT)   str += "D";
 
 	return (utility::file::path::component(str));
 }
diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp
index b6ebef8..1fbd008 100644
--- a/vmime/net/message.hpp
+++ b/vmime/net/message.hpp
@@ -227,6 +227,7 @@ public:
 		FLAG_REPLIED = (1 << 3),   /**< User replied to this message. */
 		FLAG_MARKED  = (1 << 4),   /**< Used-defined flag. */
 		FLAG_PASSED  = (1 << 5),   /**< Message has been resent/forwarded/bounced. */
+		FLAG_DRAFT   = (1 << 6),   /**< Message is marked as a 'draft'. */
 
 		FLAG_UNDEFINED = 9999      /**< Used internally (this should not be returned
 		                                by the flags() function). */

commit c853ee3020480e91878813730d6beb2b29bf2323
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Tue Oct 19 14:25:44 2010 +0000

    Fixed wrong name.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@571 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/AUTHORS b/AUTHORS
index 6acebd0..4164052 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -20,7 +20,7 @@ VMIME CONTRIBUTORS
  - 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>
- - Achim Brändt <http://sourceforge.net/users/a-brandt/>
+ - Achim Brandt <http://sourceforge.net/users/a-brandt/>
 
 Please apologize if I have forgotten someone here.  ;)
 See SVN Changelog for full list.

commit accc75399541bcaff0a8c7c4bd282370be9ca494
Author: vincent-richard <vincent-richard@5301114d-f842-0410-bbdd-996ee0417009>
Date:   Wed Oct 20 09:37:39 2010 +0000

    Return failed email address in exception for RCPT TO.
    
    git-svn-id: https://vmime.svn.sourceforge.net/svnroot/vmime/trunk@572 5301114d-f842-0410-bbdd-996ee0417009

diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
index 71f166b..204daae 100644
--- a/src/net/smtp/SMTPTransport.cpp
+++ b/src/net/smtp/SMTPTransport.cpp
@@ -583,7 +583,7 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients
 		if ((resp = readResponse())->getCode() != 250)
 		{
 			internalDisconnect();
-			throw exceptions::command_error("RCPT TO", resp->getText());
+			throw exceptions::command_error("RCPT TO", resp->getText(), mbox.getEmail());
 		}
 	}