changeset 723:1d0d78bf2dd2

upgrade package vmime to 0.9.1-svn-r529
author Mark Brand <mabrand@mabrand.nl>
date Wed, 10 Feb 2010 12:58:41 +0100
parents dc0a01dbbcd6
children 20bb3a6a9c81
files src/vmime-0.9.1-svn-r529-20100210.patch src/vmime-win32.patch src/vmime.mk
diffstat 3 files changed, 9378 insertions(+), 485 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/vmime-0.9.1-svn-r529-20100210.patch	Wed Feb 10 12:58:41 2010 +0100
@@ -0,0 +1,9371 @@
+This file is part of mingw-cross-env.
+diff -urN a/AUTHORS b/AUTHORS
+--- a/AUTHORS	2008-07-11 20:42:32.000000000 +0200
++++ b/AUTHORS	2010-02-09 14:34:54.000000000 +0100
+@@ -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>
+@@ -19,4 +16,11 @@
+  - Benjamin Biron <benbiron@gmail.com>
+  - 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>
++ - Bartek Szurgot <vempirelord@wp.pl, http://baszerr.org>
++
++Please apologize if I have forgotten someone here.  ;)
++See SVN Changelog for full list.
+ 
+diff -urN a/bootstrap b/bootstrap
+--- a/bootstrap	2008-10-19 14:35:41.000000000 +0200
++++ b/bootstrap	2010-02-09 14:34:54.000000000 +0100
+@@ -40,6 +40,7 @@
+ 		|| (echo "[NO]" ; cat bootstrap.tmpout ; rm -f bootstrap.tmpout ; not_a_command >& /dev/null) || DIE=1
+ fi
+ 
++# Bug with automake 1.10?
+ touch autotools/config.rpath
+ 
+ if test $DIE = 0 ; then
+diff -urN a/ChangeLog b/ChangeLog
+--- a/ChangeLog	2008-10-19 13:57:34.000000000 +0200
++++ b/ChangeLog	2010-02-09 14:34:54.000000000 +0100
+@@ -1,4 +1,17 @@
+ 
++VERSION 0.9.1svn
++================
++
++2009-09-06  Vincent Richard  <vincent@vincent-richard.net>
++
++ * Relicensed VMime under the GNU GPL license version 3. Dual licensing
++   is now available. More info here: http://www.vmime.org/pages/Licensing
++
++2008-10-19  Vincent Richard  <vincent@vincent-richard.net>
++
++ * Started version 0.9.1.
++
++
+ VERSION 0.9.0
+ =============
+ 
+diff -urN a/COPYING b/COPYING
+--- a/COPYING	2008-01-05 18:49:22.000000000 +0100
++++ b/COPYING	2010-02-09 14:34:54.000000000 +0100
+@@ -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.
+-
+-  To protect your rights, we need to make restrictions that forbid
+-anyone to deny you these rights or to ask you to surrender the rights.
+-These restrictions translate to certain responsibilities for you if you
+-distribute copies of the software, or if you modify it.
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
++
++  To protect your rights, we need to prevent others from denying you
++these rights or asking you to surrender the rights.  Therefore, you have
++certain responsibilities if you distribute copies of the software, or if
++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.
++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.
+ 
+-  9. The Free Software Foundation may publish revised and/or new versions
+-of the General Public License from time to time.  Such new versions will
++  The Free Software Foundation may publish revised and/or new versions of
++the GNU General Public License from time to time.  Such new versions will
+ be similar in spirit to the present version, but may differ in detail to
+ 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 @@
+ 
+   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 @@
+     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 -urN a/examples/example1.cpp b/examples/example1.cpp
+--- a/examples/example1.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example1.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/examples/example2.cpp b/examples/example2.cpp
+--- a/examples/example2.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example2.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/examples/example3.cpp b/examples/example3.cpp
+--- a/examples/example3.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example3.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/examples/example4.cpp b/examples/example4.cpp
+--- a/examples/example4.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example4.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/examples/example5.cpp b/examples/example5.cpp
+--- a/examples/example5.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example5.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/examples/example6.cpp b/examples/example6.cpp
+--- a/examples/example6.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example6.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/examples/example7.cpp b/examples/example7.cpp
+--- a/examples/example7.cpp	2008-10-12 10:54:34.000000000 +0200
++++ b/examples/example7.cpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/INSTALL b/INSTALL
+--- a/INSTALL	2008-10-19 14:36:21.000000000 +0200
++++ b/INSTALL	2010-02-10 11:06:52.000000000 +0100
+@@ -2,15 +2,15 @@
+ *************************
+ 
+ Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+-2006, 2007 Free Software Foundation, Inc.
++2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 
+-This file is free documentation; the Free Software Foundation gives
++   This file is free documentation; the Free Software Foundation gives
+ unlimited permission to copy, distribute and modify it.
+ 
+ Basic Installation
+ ==================
+ 
+-Briefly, the shell commands `./configure; make; make install' should
++   Briefly, the shell commands `./configure; make; make install' should
+ configure, build, and install this package.  The following
+ more-detailed instructions are generic; see the `README' file for
+ instructions specific to this package.
+@@ -73,9 +73,9 @@
+ Compilers and Options
+ =====================
+ 
+-Some systems require unusual options for compilation or linking that the
+-`configure' script does not know about.  Run `./configure --help' for
+-details on some of the pertinent environment variables.
++   Some systems require unusual options for compilation or linking that
++the `configure' script does not know about.  Run `./configure --help'
++for details on some of the pertinent environment variables.
+ 
+    You can give `configure' initial values for configuration parameters
+ by setting variables in the command line or in the environment.  Here
+@@ -88,7 +88,7 @@
+ Compiling For Multiple Architectures
+ ====================================
+ 
+-You can compile the package for more than one kind of computer at the
++   You can compile the package for more than one kind of computer at the
+ same time, by placing the object files for each architecture in their
+ own directory.  To do this, you can use GNU `make'.  `cd' to the
+ directory where you want the object files and executables to go and run
+@@ -100,10 +100,24 @@
+ installed the package for one architecture, use `make distclean' before
+ reconfiguring for another architecture.
+ 
++   On MacOS X 10.5 and later systems, you can create libraries and
++executables that work on multiple system types--known as "fat" or
++"universal" binaries--by specifying multiple `-arch' options to the
++compiler but only a single `-arch' option to the preprocessor.  Like
++this:
++
++     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
++                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
++                 CPP="gcc -E" CXXCPP="g++ -E"
++
++   This is not guaranteed to produce working output in all cases, you
++may have to build one architecture at a time and combine the results
++using the `lipo' tool if you have problems.
++
+ Installation Names
+ ==================
+ 
+-By default, `make install' installs the package's commands under
++   By default, `make install' installs the package's commands under
+ `/usr/local/bin', include files under `/usr/local/include', etc.  You
+ can specify an installation prefix other than `/usr/local' by giving
+ `configure' the option `--prefix=PREFIX'.
+@@ -126,7 +140,7 @@
+ Optional Features
+ =================
+ 
+-Some packages pay attention to `--enable-FEATURE' options to
++   Some packages pay attention to `--enable-FEATURE' options to
+ `configure', where FEATURE indicates an optional part of the package.
+ They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+ is something like `gnu-as' or `x' (for the X Window System).  The
+@@ -138,14 +152,46 @@
+ you can use the `configure' options `--x-includes=DIR' and
+ `--x-libraries=DIR' to specify their locations.
+ 
++Particular systems
++==================
++
++   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
++CC is not installed, it is recommended to use the following options in
++order to use an ANSI C compiler:
++
++     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
++
++and if that doesn't work, install pre-built binaries of GCC for HP-UX.
++
++   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
++parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
++a workaround.  If GNU CC is not installed, it is therefore recommended
++to try
++
++     ./configure CC="cc"
++
++and if that doesn't work, try
++
++     ./configure CC="cc -nodtk"
++
++   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
++directory contains several dysfunctional programs; working variants of
++these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
++in your `PATH', put it _after_ `/usr/bin'.
++
++   On Haiku, software installed for all users goes in `/boot/common',
++not `/usr/local'.  It is recommended to use the following options:
++
++     ./configure --prefix=/boot/common
++
+ Specifying the System Type
+ ==========================
+ 
+-There may be some features `configure' cannot figure out automatically,
+-but needs to determine by the type of machine the package will run on.
+-Usually, assuming the package is built to be run on the _same_
+-architectures, `configure' can figure that out, but if it prints a
+-message saying it cannot guess the machine type, give it the
++   There may be some features `configure' cannot figure out
++automatically, but needs to determine by the type of machine the package
++will run on.  Usually, assuming the package is built to be run on the
++_same_ architectures, `configure' can figure that out, but if it prints
++a message saying it cannot guess the machine type, give it the
+ `--build=TYPE' option.  TYPE can either be a short name for the system
+ type, such as `sun4', or a canonical name which has the form:
+ 
+@@ -153,7 +199,8 @@
+ 
+ where SYSTEM can have one of these forms:
+ 
+-     OS KERNEL-OS
++     OS
++     KERNEL-OS
+ 
+    See the file `config.sub' for the possible values of each field.  If
+ `config.sub' isn't included in this package, then this package doesn't
+@@ -171,9 +218,9 @@
+ Sharing Defaults
+ ================
+ 
+-If you want to set default values for `configure' scripts to share, you
+-can create a site shell script called `config.site' that gives default
+-values for variables like `CC', `cache_file', and `prefix'.
++   If you want to set default values for `configure' scripts to share,
++you can create a site shell script called `config.site' that gives
++default values for variables like `CC', `cache_file', and `prefix'.
+ `configure' looks for `PREFIX/share/config.site' if it exists, then
+ `PREFIX/etc/config.site' if it exists.  Or, you can set the
+ `CONFIG_SITE' environment variable to the location of the site script.
+@@ -182,7 +229,7 @@
+ Defining Variables
+ ==================
+ 
+-Variables not defined in a site shell script can be set in the
++   Variables not defined in a site shell script can be set in the
+ environment passed to `configure'.  However, some packages may run
+ configure again during the build, and the customized values of these
+ variables may be lost.  In order to avoid this problem, you should set
+@@ -201,11 +248,19 @@
+ `configure' Invocation
+ ======================
+ 
+-`configure' recognizes the following options to control how it operates.
++   `configure' recognizes the following options to control how it
++operates.
+ 
+ `--help'
+ `-h'
+-     Print a summary of the options to `configure', and exit.
++     Print a summary of all of the options to `configure', and exit.
++
++`--help=short'
++`--help=recursive'
++     Print a summary of the options unique to this package's
++     `configure', and exit.  The `short' variant lists options used
++     only in the top level, while the `recursive' variant lists options
++     also present in any nested packages.
+ 
+ `--version'
+ `-V'
+@@ -232,6 +287,16 @@
+      Look for the package's source code in directory DIR.  Usually
+      `configure' can determine that directory automatically.
+ 
++`--prefix=DIR'
++     Use DIR as the installation prefix.  *Note Installation Names::
++     for more details, including other options available for fine-tuning
++     the installation locations.
++
++`--no-create'
++`-n'
++     Run the configure checks, but stop before creating any output
++     files.
++
+ `configure' also accepts some other, not widely useful, options.  Run
+ `configure --help' for more details.
+ 
+diff -urN a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
+--- a/m4/acx_pthread.m4	1970-01-01 01:00:00.000000000 +0100
++++ b/m4/acx_pthread.m4	2010-02-09 14:34:51.000000000 +0100
+@@ -0,0 +1,235 @@
++dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
++dnl
++dnl This macro figures out how to build C programs using POSIX threads.
++dnl It sets the PTHREAD_LIBS output variable to the threads library and
++dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
++dnl C compiler flags that are needed. (The user can also force certain
++dnl compiler flags/libs to be tested by setting these environment
++dnl variables.)
++dnl
++dnl Also sets PTHREAD_CC to any special C compiler that is needed for
++dnl multi-threaded programs (defaults to the value of CC otherwise).
++dnl (This is necessary on AIX to use the special cc_r compiler alias.)
++dnl
++dnl NOTE: You are assumed to not only compile your program with these
++dnl flags, but also link it with them as well. e.g. you should link
++dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
++dnl $LIBS
++dnl
++dnl If you are only building threads programs, you may wish to use
++dnl these variables in your default LIBS, CFLAGS, and CC:
++dnl
++dnl        LIBS="$PTHREAD_LIBS $LIBS"
++dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++dnl        CC="$PTHREAD_CC"
++dnl
++dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
++dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
++dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
++dnl
++dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
++dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
++dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
++dnl default action will define HAVE_PTHREAD.
++dnl
++dnl Please let the authors know if this macro fails on any platform, or
++dnl if you have any other suggestions or comments. This macro was based
++dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
++dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
++dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
++dnl We are also grateful for the helpful feedback of numerous users.
++dnl
++dnl @category InstalledPackages
++dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
++dnl @version 2005-01-14
++dnl @license GPLWithACException
++
++AC_DEFUN([ACX_PTHREAD], [
++AC_REQUIRE([AC_CANONICAL_HOST])
++AC_LANG_SAVE
++AC_LANG_C
++acx_pthread_ok=no
++
++# We used to check for pthread.h first, but this fails if pthread.h
++# requires special compiler flags (e.g. on True64 or Sequent).
++# It gets checked for in the link test anyway.
++
++# First of all, check if the user has set any of the PTHREAD_LIBS,
++# etcetera environment variables, and if threads linking works using
++# them:
++if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
++        save_CFLAGS="$CFLAGS"
++        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++        save_LIBS="$LIBS"
++        LIBS="$PTHREAD_LIBS $LIBS"
++        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
++        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
++        AC_MSG_RESULT($acx_pthread_ok)
++        if test x"$acx_pthread_ok" = xno; then
++                PTHREAD_LIBS=""
++                PTHREAD_CFLAGS=""
++        fi
++        LIBS="$save_LIBS"
++        CFLAGS="$save_CFLAGS"
++fi
++
++# We must check for the threads library under a number of different
++# names; the ordering is very important because some systems
++# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
++# libraries is broken (non-POSIX).
++
++# Create a list of thread flags to try.  Items starting with a "-" are
++# C compiler flags, and other items are library names, except for "none"
++# which indicates that we try without any flags at all, and "pthread-config"
++# which is a program returning the flags for the Pth emulation library.
++
++acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
++
++# The ordering *is* (sometimes) important.  Some notes on the
++# individual items follow:
++
++# pthreads: AIX (must check this before -lpthread)
++# none: in case threads are in libc; should be tried before -Kthread and
++#       other compiler flags to prevent continual compiler warnings
++# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
++# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
++# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
++# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
++# -pthreads: Solaris/gcc
++# -mthreads: Mingw32/gcc, Lynx/gcc
++# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
++#      doesn't hurt to check since this sometimes defines pthreads too;
++#      also defines -D_REENTRANT)
++# pthread: Linux, etcetera
++# --thread-safe: KAI C++
++# pthread-config: use pthread-config program (for GNU Pth library)
++
++case "${host_cpu}-${host_os}" in
++        *solaris*)
++
++        # On Solaris (at least, for some versions), libc contains stubbed
++        # (non-functional) versions of the pthreads routines, so link-based
++        # tests will erroneously succeed.  (We need to link with -pthread or
++        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
++        # a function called by this macro, so we could check for that, but
++        # who knows whether they'll stub that too in a future libc.)  So,
++        # we'll just look for -pthreads and -lpthread first:
++
++        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
++        ;;
++esac
++
++if test x"$acx_pthread_ok" = xno; then
++for flag in $acx_pthread_flags; do
++
++        case $flag in
++                none)
++                AC_MSG_CHECKING([whether pthreads work without any flags])
++                ;;
++
++                -*)
++                AC_MSG_CHECKING([whether pthreads work with $flag])
++                PTHREAD_CFLAGS="$flag"
++                ;;
++
++		pthread-config)
++		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
++		if test x"$acx_pthread_config" = xno; then continue; fi
++		PTHREAD_CFLAGS="`pthread-config --cflags`"
++		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
++		;;
++
++                *)
++                AC_MSG_CHECKING([for the pthreads library -l$flag])
++                PTHREAD_LIBS="-l$flag"
++                ;;
++        esac
++
++        save_LIBS="$LIBS"
++        save_CFLAGS="$CFLAGS"
++        LIBS="$PTHREAD_LIBS $LIBS"
++        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++
++        # Check for various functions.  We must include pthread.h,
++        # since some functions may be macros.  (On the Sequent, we
++        # need a special flag -Kthread to make this header compile.)
++        # We check for pthread_join because it is in -lpthread on IRIX
++        # while pthread_create is in libc.  We check for pthread_attr_init
++        # due to DEC craziness with -lpthreads.  We check for
++        # pthread_cleanup_push because it is one of the few pthread
++        # functions on Solaris that doesn't have a non-functional libc stub.
++        # We try pthread_create on general principles.
++        AC_TRY_LINK([#include <pthread.h>],
++                    [pthread_t th; pthread_join(th, 0);
++                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
++                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
++                    [acx_pthread_ok=yes])
++
++        LIBS="$save_LIBS"
++        CFLAGS="$save_CFLAGS"
++
++        AC_MSG_RESULT($acx_pthread_ok)
++        if test "x$acx_pthread_ok" = xyes; then
++                break;
++        fi
++
++        PTHREAD_LIBS=""
++        PTHREAD_CFLAGS=""
++done
++fi
++
++# Various other checks:
++if test "x$acx_pthread_ok" = xyes; then
++        save_LIBS="$LIBS"
++        LIBS="$PTHREAD_LIBS $LIBS"
++        save_CFLAGS="$CFLAGS"
++        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
++
++        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
++	AC_MSG_CHECKING([for joinable pthread attribute])
++	attr_name=unknown
++	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
++	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
++                        [attr_name=$attr; break])
++	done
++        AC_MSG_RESULT($attr_name)
++        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
++            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
++                               [Define to necessary symbol if this constant
++                                uses a non-standard name on your system.])
++        fi
++
++        AC_MSG_CHECKING([if more special flags are required for pthreads])
++        flag=no
++        case "${host_cpu}-${host_os}" in
++            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
++            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
++        esac
++        AC_MSG_RESULT(${flag})
++        if test "x$flag" != xno; then
++            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
++        fi
++
++        LIBS="$save_LIBS"
++        CFLAGS="$save_CFLAGS"
++
++        # More AIX lossage: must compile with cc_r
++        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
++else
++        PTHREAD_CC="$CC"
++fi
++
++AC_SUBST(PTHREAD_LIBS)
++AC_SUBST(PTHREAD_CFLAGS)
++AC_SUBST(PTHREAD_CC)
++
++# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
++if test x"$acx_pthread_ok" = xyes; then
++        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
++        :
++else
++        acx_pthread_ok=no
++        $2
++fi
++AC_LANG_RESTORE
++])dnl ACX_PTHREAD
+diff -urN a/SConstruct b/SConstruct
+--- a/SConstruct	2008-10-19 14:27:32.000000000 +0200
++++ b/SConstruct	2010-02-10 11:06:33.000000000 +0100
+@@ -29,7 +29,7 @@
+ # Package version number
+ packageVersionMajor = 0
+ packageVersionMinor = 9
+-packageVersionMicro = 0
++packageVersionMicro = 1
+ 
+ # API version number (libtool)
+ #
+@@ -376,6 +376,7 @@
+ ]
+ 
+ libvmime_autotools = [
++	'm4/acx_pthread.m4',
+ 	'm4/iconv.m4',
+ 	'm4/lib-ld.m4',
+ 	'm4/lib-link.m4',
+@@ -439,9 +440,11 @@
+ 
+ SetOption('implicit_cache', 1)
+ 
+-#SourceSignatures('timestamp')
+-SourceSignatures('MD5')
+-TargetSignatures('build')
++try:
++	Decider('MD5-timestamp')
++except:
++	SourceSignatures('MD5')
++	TargetSignatures('build')
+ 
+ 
+ #############
+@@ -528,14 +531,6 @@
+ 		defaultSendmailPath
+ 	),
+ 	EnumOption(
+-		'with_wide_char_support',
+-		'Support for wide characters (rarely used, should be set to "no")',
+-		'no',
+-		allowed_values = ('yes', 'no'),
+-		map = { },
+-		ignorecase = 1
+-	),
+-	EnumOption(
+ 		'byte_order',
+ 		'Byte order (Big Endian or Little Endian)',
+ 		sys.byteorder,
+@@ -592,7 +587,6 @@
+ 
+ env.Append(CPPDEFINES = ['_REENTRANT=1'])
+ 
+-env.Append(CXXFLAGS = ['-pipe'])
+ env.Append(CXXFLAGS = ['-W'])
+ env.Append(CXXFLAGS = ['-Wall'])
+ env.Append(CXXFLAGS = ['-ansi'])
+@@ -801,12 +795,6 @@
+ 
+ config_hpp.write('// Options\n')
+ 
+-config_hpp.write('// -- Wide characters support\n')
+-if env['with_wide_char_support'] == 'yes':
+-	config_hpp.write('#define VMIME_WIDE_CHAR_SUPPORT 1\n')
+-else:
+-	config_hpp.write('#define VMIME_WIDE_CHAR_SUPPORT 0\n')
+-
+ config_hpp.write('// -- File-system support\n')
+ if env['with_filesystem'] == 'yes':
+ 	config_hpp.write('#define VMIME_HAVE_FILESYSTEM_FEATURES 1\n')
+@@ -1417,8 +1405,8 @@
+ AC_MSG_CHECKING([if C++ compiler supports dynamic_cast<> (required)])
+ AC_TRY_COMPILE(
+ [
+-   class foo { virtual ~foo() { } };
+-   class bar : public foo { };
++   class foo { public: virtual ~foo() { } };
++   class bar : public foo { public: virtual ~bar() { } };
+ ],[
+    foo *c=0;
+    bar *c1=dynamic_cast<bar*>(c);
+@@ -1620,7 +1608,7 @@
+ 
+ if test "x$conf_tls" = "xyes"; then
+ 	# -- GNU TLS Library (http://www.gnu.org/software/gnutls/)
+-	AM_PATH_LIBGNUTLS(1.2.0, have_gnutls=yes, have_gnutls=no)
++	PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0], have_gnutls=yes, have_gnutls=no)
+ 
+ 	if test "x$have_gnutls" = "xyes"; then
+ 		AM_CONDITIONAL(VMIME_HAVE_TLS_SUPPORT, true)
+@@ -1833,7 +1821,7 @@
+ 
+ """)
+ 
+-	compilerFlags = [ '-pipe', '-ansi', '-pedantic', '-W', '-Wall', '-Wpointer-arith', '-Wold-style-cast', '-Wconversion' ]
++	compilerFlags = [ '-ansi', '-pedantic', '-W', '-Wall', '-Wpointer-arith', '-Wold-style-cast', '-Wconversion' ]
+ 
+ 	for f in compilerFlags:
+ 		configure_in.write('# ' + f + '\n')
+@@ -1915,8 +1903,6 @@
+ typedef unsigned ${VMIME_TYPE_INT32} vmime_uint32;
+ 
+ // Options
+-// -- Wide characters support
+-#define VMIME_WIDE_CHAR_SUPPORT 0
+ // -- File-system support
+ #define VMIME_HAVE_FILESYSTEM_FEATURES 1
+ // -- SASL support
+@@ -2260,8 +2246,6 @@
+ 
+ 
+ // Options
+-// -- Wide characters support
+-#define VMIME_WIDE_CHAR_SUPPORT 0
+ // -- File-system support
+ #define VMIME_HAVE_FILESYSTEM_FEATURES 1
+ // -- SASL support
+diff -urN a/src/address.cpp b/src/address.cpp
+--- a/src/address.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/address.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/addressList.cpp b/src/addressList.cpp
+--- a/src/addressList.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/addressList.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp
+--- a/src/attachmentHelper.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/attachmentHelper.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/base.cpp b/src/base.cpp
+--- a/src/base.cpp	2008-10-12 15:41:25.000000000 +0200
++++ b/src/base.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -55,12 +55,6 @@
+   */
+ const string NULL_STRING;
+ 
+-#if VMIME_WIDE_CHAR_SUPPORT
+-	/** "Null" (empty) wide-char string.
+-	  */
+-	const wstring NULL_WSTRING;
+-#endif
+-
+ /** "Null" (empty) text.
+   */
+ const text NULL_TEXT;
+diff -urN a/src/body.cpp b/src/body.cpp
+--- a/src/body.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/body.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/bodyPartAttachment.cpp b/src/bodyPartAttachment.cpp
+--- a/src/bodyPartAttachment.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/bodyPartAttachment.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/bodyPart.cpp b/src/bodyPart.cpp
+--- a/src/bodyPart.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/bodyPart.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/charsetConverter.cpp b/src/charsetConverter.cpp
+--- a/src/charsetConverter.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/charsetConverter.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -53,6 +53,27 @@
+ }
+ 
+ 
++
++// Output replacement char when an invalid sequence is encountered
++template <typename OUTPUT_CLASS, typename ICONV_DESC>
++void outputInvalidChar(OUTPUT_CLASS& out, ICONV_DESC cd)
++{
++	const char* invalidCharIn = "?";
++	size_t invalidCharInLen = 1;
++
++	char invalidCharOutBuffer[16];
++	char* invalidCharOutPtr = invalidCharOutBuffer;
++	size_t invalidCharOutLen = 16;
++
++	if (iconv(cd, ICONV_HACK(&invalidCharIn), &invalidCharInLen,
++		&invalidCharOutPtr, &invalidCharOutLen) != static_cast <size_t>(-1))
++	{
++		out.write(invalidCharOutBuffer, 16 - invalidCharOutLen);
++	}
++}
++
++
++
+ namespace vmime
+ {
+ 
+@@ -121,7 +142,7 @@
+ 
+ 				// Output a special character to indicate we don't known how to
+ 				// convert the sequence at this position
+-				out.write("?", 1);
++				outputInvalidChar(out, cd);
+ 
+ 				// Skip a byte and leave unconverted bytes in the input buffer
+ 				std::copy(const_cast <char*>(inPtr + 1), inBuffer + sizeof(inBuffer), inBuffer);
+@@ -235,7 +256,7 @@
+ 			// character and skip one byte in the invalid sequence.
+ 			if (m_unconvCount >= sizeof(m_unconvBuffer))
+ 			{
+-				m_stream.write("?", 1);
++				outputInvalidChar(m_stream, cd);
+ 
+ 				std::copy(m_unconvBuffer + 1,
+ 					m_unconvBuffer + m_unconvCount, m_unconvBuffer);
+@@ -358,7 +379,7 @@
+ 			// Skip a "blocking" character
+ 			if (inputConverted == 0)
+ 			{
+-				m_stream.write("?", 1);
++				outputInvalidChar(m_stream, cd);
+ 
+ 				offset++;
+ 				m_unconvCount--;
+diff -urN a/src/charset.cpp b/src/charset.cpp
+--- a/src/charset.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/charset.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/component.cpp b/src/component.cpp
+--- a/src/component.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/component.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/constants.cpp b/src/constants.cpp
+--- a/src/constants.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/constants.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/contentDisposition.cpp b/src/contentDisposition.cpp
+--- a/src/contentDisposition.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/contentDisposition.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/contentDispositionField.cpp b/src/contentDispositionField.cpp
+--- a/src/contentDispositionField.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/contentDispositionField.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/contentHandler.cpp b/src/contentHandler.cpp
+--- a/src/contentHandler.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/contentHandler.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/contentTypeField.cpp b/src/contentTypeField.cpp
+--- a/src/contentTypeField.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/contentTypeField.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/dateTime.cpp b/src/dateTime.cpp
+--- a/src/dateTime.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/dateTime.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -427,7 +427,7 @@
+ 				zone[zoneLength++] = *p;
+ 				++p;
+ 			}
+-			while (zoneLength < 3 && p < pend && parserHelpers::isDigit(*p));
++			while (zoneLength < 3 && p < pend);
+ 
+ 			switch (zone[0])
+ 			{
+@@ -491,6 +491,8 @@
+ 
+ 				break;
+ 			}
++			case 'g':
++			case 'G':
+ 			case 'u':
+ 			case 'U':
+ 			{
+diff -urN a/src/defaultAttachment.cpp b/src/defaultAttachment.cpp
+--- a/src/defaultAttachment.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/defaultAttachment.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/disposition.cpp b/src/disposition.cpp
+--- a/src/disposition.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/disposition.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
+--- a/src/emptyContentHandler.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/emptyContentHandler.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/encoding.cpp b/src/encoding.cpp
+--- a/src/encoding.cpp	2008-10-12 15:41:52.000000000 +0200
++++ b/src/encoding.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/exception.cpp b/src/exception.cpp
+--- a/src/exception.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/exception.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/fileAttachment.cpp b/src/fileAttachment.cpp
+--- a/src/fileAttachment.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/fileAttachment.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -31,48 +31,93 @@
+ 
+ #include "vmime/contentDispositionField.hpp"
+ 
++#include "vmime/platform.hpp"
++#include "vmime/utility/file.hpp"
++
+ 
+ namespace vmime
+ {
+ 
+ 
+-fileAttachment::fileAttachment(const string& filename, const mediaType& type)
++fileAttachment::fileAttachment(const string& filepath, const mediaType& type)
+ {
+ 	m_type = type;
+ 
+-	setData(filename);
++	setData(filepath);
+ 
+ 	m_encoding = encoding::decide(m_data);
+ }
+ 
+ 
+-fileAttachment::fileAttachment(const string& filename, const mediaType& type, const text& desc)
++fileAttachment::fileAttachment(const string& filepath, const mediaType& type, const text& desc)
+ {
+ 	m_type = type;
+ 	m_desc = desc;
+ 
+-	setData(filename);
++	setData(filepath);
+ 
+ 	m_encoding = encoding::decide(m_data);
+ }
+ 
+ 
+-fileAttachment::fileAttachment(const string& filename, const mediaType& type,
++fileAttachment::fileAttachment(const string& filepath, const mediaType& type,
+ 	const text& desc, const encoding& enc)
+ {
+ 	m_type = type;
+ 	m_desc = desc;
+ 
+-	setData(filename);
++	setData(filepath);
++
++	m_encoding = enc;
++}
++
++
++fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type)
++{
++	if (!filename.isEmpty())
++		m_fileInfo.setFilename(filename);
++
++	m_type = type;
++
++	setData(is);
++
++	m_encoding = encoding::decide(m_data);
++}
++
++
++fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename,
++	const mediaType& type, const text& desc)
++{
++	if (!filename.isEmpty())
++		m_fileInfo.setFilename(filename);
++
++	m_type = type;
++	m_desc = desc;
++
++	setData(is);
++
++	m_encoding = encoding::decide(m_data);
++}
++
++
++fileAttachment::fileAttachment(ref <utility::inputStream> is, const word& filename,
++	const mediaType& type, const text& desc, const encoding& enc)
++{
++	if (!filename.isEmpty())
++		m_fileInfo.setFilename(filename);
+ 
++	m_type = type;
++	m_desc = desc;
+ 	m_encoding = enc;
++
++	setData(is);
+ }
+ 
+ 
+-void fileAttachment::setData(const string& filename)
++void fileAttachment::setData(const string& filepath)
+ {
+ 	std::ifstream* file = new std::ifstream();
+-	file->open(filename.c_str(), std::ios::in | std::ios::binary);
++	file->open(filepath.c_str(), std::ios::in | std::ios::binary);
+ 
+ 	if (!*file)
+ 	{
+@@ -82,6 +127,15 @@
+ 
+ 	ref <utility::inputStream> is = vmime::create <utility::inputStreamPointerAdapter>(file, true);
+ 
++	setData(is);
++
++	utility::file::path path = platform::getHandler()->getFileSystemFactory()->stringToPath(filepath);
++	m_fileInfo.setFilename(path.getLastComponent());
++}
++
++
++void fileAttachment::setData(ref <utility::inputStream> is)
++{
+ 	m_data = vmime::create <streamContentHandler>(is, 0);
+ }
+ 
+@@ -94,7 +148,7 @@
+ 		dynamicCast <contentDispositionField>();
+ 
+ 	if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize()));
+-	if (m_fileInfo.hasFilename()) cdf->setFilename(m_fileInfo.getFilename());
++	if (m_fileInfo.hasFilename() && !m_fileInfo.getFilename().isEmpty()) cdf->setFilename(m_fileInfo.getFilename());
+ 	if (m_fileInfo.hasCreationDate()) cdf->setCreationDate(m_fileInfo.getCreationDate());
+ 	if (m_fileInfo.hasModificationDate()) cdf->setModificationDate(m_fileInfo.getModificationDate());
+ 	if (m_fileInfo.hasReadDate()) cdf->setReadDate(m_fileInfo.getReadDate());
+@@ -134,8 +188,9 @@
+ }
+ 
+ bool fileAttachment::fileInfo::hasFilename() const { return (m_filename != NULL); }
+-const string& fileAttachment::fileInfo::getFilename() const { return (*m_filename); }
+-void fileAttachment::fileInfo::setFilename(const string& name) { if (m_filename) { *m_filename = name; } else { m_filename = new string(name); } }
++const word& fileAttachment::fileInfo::getFilename() const { return (*m_filename); }
++void fileAttachment::fileInfo::setFilename(const string& name) { if (m_filename) { *m_filename = name; } else { m_filename = new word(name); } }
++void fileAttachment::fileInfo::setFilename(const word& name) { if (m_filename) { *m_filename = name; } else { m_filename = new word(name); } }
+ 
+ bool fileAttachment::fileInfo::hasCreationDate() const { return (m_creationDate != NULL); }
+ const datetime& fileAttachment::fileInfo::getCreationDate() const { return (*m_creationDate); }
+diff -urN a/src/generatedMessageAttachment.cpp b/src/generatedMessageAttachment.cpp
+--- a/src/generatedMessageAttachment.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/generatedMessageAttachment.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/header.cpp b/src/header.cpp
+--- a/src/header.cpp	2008-10-12 11:02:22.000000000 +0200
++++ b/src/header.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/headerField.cpp b/src/headerField.cpp
+--- a/src/headerField.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/headerField.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/headerFieldFactory.cpp b/src/headerFieldFactory.cpp
+--- a/src/headerFieldFactory.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/headerFieldFactory.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp
+--- a/src/htmlTextPart.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/htmlTextPart.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mailbox.cpp b/src/mailbox.cpp
+--- a/src/mailbox.cpp	2008-10-12 11:03:13.000000000 +0200
++++ b/src/mailbox.cpp	2010-02-10 10:56:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -369,7 +369,7 @@
+ 		// We have to encode the name:
+ 		//   - if it contains characters in a charset different from "US-ASCII",
+ 		//   - and/or if it contains one or more of these special chars:
+-		//        SPACE  TAB  "  ;  ,  <  >  (  )  @  /  ?  .  =  :
++		//        CR  LF  TAB  "  ;  ,  <  >  (  )  @  /  ?  .  =  :
+ 
+ 		// Check whether there are words that are not "US-ASCII"
+ 		// and/or contain the special chars.
+@@ -386,7 +386,8 @@
+ 				{
+ 					switch (*c)
+ 					{
+-					case ' ':
++					case '\r':
++					case '\n':
+ 					case '\t':
+ 					case ';':
+ 					case ',':
+@@ -415,7 +416,7 @@
+ 		bool newLine = true;
+ 
+ 		m_name.encodeAndFold(os, maxLineLength, pos, &pos,
+-			forceEncode ? text::FORCE_ENCODING : 0);
++			text::QUOTE_IF_POSSIBLE | (forceEncode ? text::FORCE_ENCODING : 0));
+ 
+ 		if (pos + m_email.length() + 3 > maxLineLength)
+ 		{
+diff -urN a/src/mailboxField.cpp b/src/mailboxField.cpp
+--- a/src/mailboxField.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mailboxField.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
+--- a/src/mailboxGroup.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mailboxGroup.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mailboxList.cpp b/src/mailboxList.cpp
+--- a/src/mailboxList.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mailboxList.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mdn/MDNHelper.cpp b/src/mdn/MDNHelper.cpp
+--- a/src/mdn/MDNHelper.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mdn/MDNHelper.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mdn/MDNInfos.cpp b/src/mdn/MDNInfos.cpp
+--- a/src/mdn/MDNInfos.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mdn/MDNInfos.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mdn/receivedMDNInfos.cpp b/src/mdn/receivedMDNInfos.cpp
+--- a/src/mdn/receivedMDNInfos.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mdn/receivedMDNInfos.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mdn/sendableMDNInfos.cpp b/src/mdn/sendableMDNInfos.cpp
+--- a/src/mdn/sendableMDNInfos.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mdn/sendableMDNInfos.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/mediaType.cpp b/src/mediaType.cpp
+--- a/src/mediaType.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/mediaType.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/messageBuilder.cpp b/src/messageBuilder.cpp
+--- a/src/messageBuilder.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/messageBuilder.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -54,11 +54,17 @@
+ 	if (m_from.isEmpty())
+ 		throw exceptions::no_expeditor();
+ 
+-	if (m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty())
++	if ((m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty()) &&
++	    (m_cc.isEmpty() || m_cc.getAddressAt(0)->isEmpty()) &&
++	    (m_bcc.isEmpty() || m_bcc.getAddressAt(0)->isEmpty()))
++	{
+ 		throw exceptions::no_recipient();
++	}
+ 
+ 	msg->getHeader()->From()->setValue(m_from);
+-	msg->getHeader()->To()->setValue(m_to);
++
++	if (!m_to.isEmpty())
++		msg->getHeader()->To()->setValue(m_to);
+ 
+ 	if (!m_cc.isEmpty())
+ 		msg->getHeader()->Cc()->setValue(m_cc);
+@@ -142,6 +148,9 @@
+ 	{
+ 		const bodyPart& part = *msg->getBody()->getPartAt(0);
+ 
++		// Make a full copy of the body, otherwise the copyFrom() will delete the body we're copying
++		ref <body> bodyCopy = part.getBody()->clone().dynamicCast <body>();
++
+ 		// First, copy (and replace) the header fields
+ 		const std::vector <ref <const headerField> > fields = part.getHeader()->getFieldList();
+ 
+@@ -153,7 +162,7 @@
+ 
+ 		// Second, copy the body contents and sub-parts (this also remove
+ 		// the body part we are copying...)
+-		msg->getBody()->copyFrom(*part.getBody());
++		msg->getBody()->copyFrom(*bodyCopy);
+ 	}
+ 
+ 	return (msg);
+diff -urN a/src/message.cpp b/src/message.cpp
+--- a/src/message.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/message.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/messageId.cpp b/src/messageId.cpp
+--- a/src/messageId.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/messageId.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/messageIdSequence.cpp b/src/messageIdSequence.cpp
+--- a/src/messageIdSequence.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/messageIdSequence.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/messageParser.cpp b/src/messageParser.cpp
+--- a/src/messageParser.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/messageParser.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/misc/importanceHelper.cpp b/src/misc/importanceHelper.cpp
+--- a/src/misc/importanceHelper.cpp	2008-10-12 11:12:02.000000000 +0200
++++ b/src/misc/importanceHelper.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/builtinServices.inl b/src/net/builtinServices.inl
+--- a/src/net/builtinServices.inl	2008-01-05 18:49:19.000000000 +0100
++++ b/src/net/builtinServices.inl	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/defaultConnectionInfos.cpp b/src/net/defaultConnectionInfos.cpp
+--- a/src/net/defaultConnectionInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/defaultConnectionInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/events.cpp b/src/net/events.cpp
+--- a/src/net/events.cpp	2008-10-12 11:25:21.000000000 +0200
++++ b/src/net/events.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/folder.cpp b/src/net/folder.cpp
+--- a/src/net/folder.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/folder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
+--- a/src/net/imap/IMAPConnection.cpp	2008-10-12 11:28:37.000000000 +0200
++++ b/src/net/imap/IMAPConnection.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -718,6 +718,12 @@
+ }
+ 
+ 
++ref <const socket> IMAPConnection::getSocket() const
++{
++	return m_socket;
++}
++
++
+ } // imap
+ } // net
+ } // vmime
+diff -urN a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
+--- a/src/net/imap/IMAPFolder.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/imap/IMAPFolder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -1284,7 +1284,11 @@
+ 	if (progress)
+ 		progress->start(total);
+ 
+-	char buffer[65536];
++      const socket::size_type blockSize = std::min(is.getBlockSize(),
++		static_cast <size_t>(m_connection->getSocket()->getBlockSize()));
++
++	std::vector <char> vbuffer(blockSize);
++	char* buffer = &vbuffer.front();
+ 
+ 	while (!is.eof())
+ 	{
+diff -urN a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
+--- a/src/net/imap/IMAPMessage.cpp	2008-10-12 11:33:02.000000000 +0200
++++ b/src/net/imap/IMAPMessage.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/imap/IMAPServiceInfos.cpp b/src/net/imap/IMAPServiceInfos.cpp
+--- a/src/net/imap/IMAPServiceInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/imap/IMAPServiceInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/imap/IMAPSStore.cpp b/src/net/imap/IMAPSStore.cpp
+--- a/src/net/imap/IMAPSStore.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/imap/IMAPSStore.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/imap/IMAPStore.cpp b/src/net/imap/IMAPStore.cpp
+--- a/src/net/imap/IMAPStore.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/imap/IMAPStore.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/imap/IMAPTag.cpp b/src/net/imap/IMAPTag.cpp
+--- a/src/net/imap/IMAPTag.cpp	2008-10-12 11:35:01.000000000 +0200
++++ b/src/net/imap/IMAPTag.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp
+--- a/src/net/imap/IMAPUtils.cpp	2008-10-12 11:34:27.000000000 +0200
++++ b/src/net/imap/IMAPUtils.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp
+--- a/src/net/maildir/format/courierMaildirFormat.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/format/courierMaildirFormat.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -49,7 +49,7 @@
+ 
+ void courierMaildirFormat::createFolder(const folder::path& path)
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY)))
+ 		throw exceptions::invalid_folder_name();
+@@ -80,7 +80,7 @@
+ 
+ void courierMaildirFormat::destroyFolder(const folder::path& path)
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	// Recursively delete directories of subfolders
+ 	const std::vector <folder::path> folders = listFolders(path, true);
+@@ -119,7 +119,7 @@
+ void courierMaildirFormat::renameFolderImpl
+ 	(const folder::path& oldPath, const folder::path& newPath)
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	const utility::file::path oldFSPath =
+ 		folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY);
+@@ -134,7 +134,7 @@
+ 
+ bool courierMaildirFormat::folderExists(const folder::path& path) const
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create
+ 		(folderPathToFileSystemPath(path, ROOT_DIRECTORY));
+@@ -254,7 +254,7 @@
+ bool courierMaildirFormat::listDirectories(const folder::path& root,
+ 	std::vector <string>& dirs, const bool onlyTestForExistence) const
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create
+ 		(getContext()->getStore()->getFileSystemPath());
+@@ -496,7 +496,7 @@
+ 
+ bool courierMaildirFormat::supports() const
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create
+ 		(getContext()->getStore()->getFileSystemPath());
+diff -urN a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp
+--- a/src/net/maildir/format/kmailMaildirFormat.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/format/kmailMaildirFormat.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -49,7 +49,7 @@
+ 
+ void kmailMaildirFormat::createFolder(const folder::path& path)
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	if (!fsf->isValidPath(folderPathToFileSystemPath(path, ROOT_DIRECTORY)))
+ 		throw exceptions::invalid_folder_name();
+@@ -75,7 +75,7 @@
+ void kmailMaildirFormat::destroyFolder(const folder::path& path)
+ {
+ 	// Delete 'folder' and '.folder.directory' directories
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	maildirUtils::recursiveFSDelete(fsf->create
+ 		(folderPathToFileSystemPath(path, ROOT_DIRECTORY)));  // root
+@@ -87,7 +87,7 @@
+ 
+ bool kmailMaildirFormat::folderExists(const folder::path& path) const
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create
+ 		(folderPathToFileSystemPath(path, ROOT_DIRECTORY));
+@@ -177,7 +177,7 @@
+ void kmailMaildirFormat::listFoldersImpl
+ 	(std::vector <folder::path>& list, const folder::path& root, const bool recursive) const
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create(folderPathToFileSystemPath(root,
+ 		root.isEmpty() ? ROOT_DIRECTORY : CONTAINER_DIRECTORY));
+@@ -226,7 +226,7 @@
+ 
+ void kmailMaildirFormat::renameFolder(const folder::path& oldPath, const folder::path& newPath)
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create
+ 		(folderPathToFileSystemPath(oldPath, ROOT_DIRECTORY));
+@@ -277,7 +277,7 @@
+ 
+ bool kmailMaildirFormat::folderHasSubfolders(const folder::path& path) const
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> rootDir = fsf->create
+ 		(folderPathToFileSystemPath(path, CONTAINER_DIRECTORY));
+diff -urN a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
+--- a/src/net/maildir/maildirFolder.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/maildirFolder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -264,7 +264,7 @@
+ 		m_messageCount = 0;
+ 		m_unreadMessageCount = 0;
+ 
+-		utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++		ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 		utility::file::path newDirPath = store->getFormat()->folderPathToFileSystemPath
+ 			(m_path, maildirFormat::NEW_DIRECTORY);
+@@ -760,7 +760,7 @@
+ {
+ 	ref <maildirStore> store = m_store.acquire();
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	utility::file::path curDirPath = store->getFormat()->
+ 		folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
+@@ -832,12 +832,15 @@
+ 	else if (m_mode == MODE_READ_ONLY)
+ 		throw exceptions::illegal_state("Folder is read-only");
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	utility::file::path tmpDirPath = store->getFormat()->
+-		folderPathToFileSystemPath(m_path, maildirFormat::TMP_DIRECTORY);
+-	utility::file::path curDirPath = store->getFormat()->
+-		folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
++		folderPathToFileSystemPath(m_path,maildirFormat::TMP_DIRECTORY);
++	utility::file::path dstDirPath = store->getFormat()->
++		folderPathToFileSystemPath(m_path,
++			flags == message::FLAG_RECENT ?
++				maildirFormat::NEW_DIRECTORY :
++				maildirFormat::CUR_DIRECTORY);
+ 
+ 	const utility::file::path::component filename =
+ 		maildirUtils::buildFilename(maildirUtils::generateId(),
+@@ -855,7 +858,7 @@
+ 
+ 	try
+ 	{
+-		ref <utility::file> curDir = fsf->create(curDirPath);
++		ref <utility::file> curDir = fsf->create(dstDirPath);
+ 		curDir->createDirectory(true);
+ 	}
+ 	catch (exceptions::filesystem_exception&)
+@@ -864,7 +867,7 @@
+ 	}
+ 
+ 	// Actually add the message
+-	copyMessageImpl(tmpDirPath, curDirPath, filename, is, size, progress);
++	copyMessageImpl(tmpDirPath, dstDirPath, filename, is, size, progress);
+ 
+ 	// Append the message to the cache list
+ 	messageInfos msgInfos;
+@@ -910,11 +913,12 @@
+ 
+ 
+ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
+-	const utility::file::path& curDirPath, const utility::file::path::component& filename,
++	const utility::file::path& dstDirPath,
++	const utility::file::path::component& filename,
+ 	utility::inputStream& is, const utility::stream::size_type size,
+ 	utility::progressListener* progress)
+ {
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	ref <utility::file> file = fsf->create(tmpDirPath / filename);
+ 
+@@ -945,6 +949,8 @@
+ 			if (progress)
+ 				progress->progress(total, size);
+ 		}
++
++		os->flush();
+ 	}
+ 	catch (exception& e)
+ 	{
+@@ -968,7 +974,7 @@
+ 	// ...then, move it to 'cur'
+ 	try
+ 	{
+-		file->rename(curDirPath / filename);
++		file->rename(dstDirPath / filename);
+ 	}
+ 	catch (exception& e)
+ 	{
+@@ -978,7 +984,8 @@
+ 		// Delete temporary file
+ 		try
+ 		{
+-			ref <utility::file> file = fsf->create(tmpDirPath / filename);
++			file->remove();
++			ref <utility::file> file = fsf->create(dstDirPath / filename);
+ 			file->remove();
+ 		}
+ 		catch (exceptions::filesystem_exception&)
+@@ -1051,7 +1058,7 @@
+ {
+ 	ref <maildirStore> store = m_store.acquire();
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	utility::file::path curDirPath = store->getFormat()->folderPathToFileSystemPath
+ 		(m_path, maildirFormat::CUR_DIRECTORY);
+@@ -1193,7 +1200,7 @@
+ 	else if (m_mode == MODE_READ_ONLY)
+ 		throw exceptions::illegal_state("Folder is read-only");
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	utility::file::path curDirPath = store->getFormat()->
+ 		folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
+diff -urN a/src/net/maildir/maildirFormat.cpp b/src/net/maildir/maildirFormat.cpp
+--- a/src/net/maildir/maildirFormat.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/maildirFormat.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -52,7 +52,7 @@
+ 
+ ref <maildirStore> maildirFormat::context::getStore() const
+ {
+-	return m_store;
++	return m_store.acquire().constCast <maildirStore>();
+ }
+ 
+ 
+diff -urN a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
+--- a/src/net/maildir/maildirMessage.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/maildirMessage.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -346,7 +346,7 @@
+ {
+ 	ref <const maildirFolder> folder = m_folder.acquire();
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	const utility::file::path path = folder->getMessageFSPath(m_num);
+ 	ref <utility::file> file = fsf->create(path);
+@@ -393,7 +393,7 @@
+ 
+ 	ref <maildirPart> mp = p.dynamicCast <maildirPart>();
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	const utility::file::path path = folder->getMessageFSPath(m_num);
+ 	ref <utility::file> file = fsf->create(path);
+@@ -430,7 +430,7 @@
+ 	if (folder != msgFolder)
+ 		throw exceptions::folder_not_found();
+ 
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	const utility::file::path path = folder->getMessageFSPath(m_num);
+ 	ref <utility::file> file = fsf->create(path);
+diff -urN a/src/net/maildir/maildirServiceInfos.cpp b/src/net/maildir/maildirServiceInfos.cpp
+--- a/src/net/maildir/maildirServiceInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/maildirServiceInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp
+--- a/src/net/maildir/maildirStore.cpp	2008-10-12 11:36:52.000000000 +0200
++++ b/src/net/maildir/maildirStore.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -132,7 +132,7 @@
+ 		throw exceptions::already_connected();
+ 
+ 	// Get root directory
+-	utility::fileSystemFactory* fsf = platform::getHandler()->getFileSystemFactory();
++	ref <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
+ 
+ 	m_fsPath = fsf->stringToPath(GET_PROPERTY(string, PROPERTY_SERVER_ROOTPATH));
+ 
+diff -urN a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
+--- a/src/net/maildir/maildirUtils.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/maildir/maildirUtils.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -25,6 +25,7 @@
+ #include "vmime/net/maildir/maildirStore.hpp"
+ 
+ #include "vmime/utility/random.hpp"
++#include "vmime/platform.hpp"
+ 
+ #include "vmime/exception.hpp"
+ 
+@@ -128,18 +129,24 @@
+ const utility::file::path::component maildirUtils::buildFilename
+ 	(const utility::file::path::component& id, const int flags)
+ {
+-	return (buildFilename(id, buildFlags(flags)));
++	if (flags == message::FLAG_RECENT)
++		return id;
++	else
++		return (buildFilename(id, buildFlags(flags)));
+ }
+ 
+ 
+ const utility::file::path::component maildirUtils::buildFilename
+-	(const utility::file::path::component& id, const utility::file::path::component& flags)
++	(const utility::file::path::component& id,
++	 const utility::file::path::component& flags)
+ {
+ #if VMIME_BUILTIN_PLATFORM_WINDOWS
+-	return (utility::path::component(id.getBuffer() + "-" + flags.getBuffer()));  // use dash
++	static const char DELIMITER[] = "-";
+ #else
+-	return (utility::path::component(id.getBuffer() + ":" + flags.getBuffer()));  // use colon
++	static const char DELIMITER[] = ":";
+ #endif
++
++	return utility::path::component(id.getBuffer() + DELIMITER + flags.getBuffer());
+ }
+ 
+ 
+@@ -153,6 +160,8 @@
+ 	oss << utility::random::getProcess();
+ 	oss << ".";
+ 	oss << utility::random::getString(6);
++	oss << ".";
++	oss << platform::getHandler()->getHostName();
+ 
+ 	return (utility::file::path::component(oss.str()));
+ }
+diff -urN a/src/net/message.cpp b/src/net/message.cpp
+--- a/src/net/message.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/message.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/pop3/POP3Folder.cpp b/src/net/pop3/POP3Folder.cpp
+--- a/src/net/pop3/POP3Folder.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/pop3/POP3Folder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
+--- a/src/net/pop3/POP3Message.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/pop3/POP3Message.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/pop3/POP3ServiceInfos.cpp b/src/net/pop3/POP3ServiceInfos.cpp
+--- a/src/net/pop3/POP3ServiceInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/pop3/POP3ServiceInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/pop3/POP3SStore.cpp b/src/net/pop3/POP3SStore.cpp
+--- a/src/net/pop3/POP3SStore.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/pop3/POP3SStore.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp
+--- a/src/net/pop3/POP3Store.cpp	2008-10-12 11:32:11.000000000 +0200
++++ b/src/net/pop3/POP3Store.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/pop3/POP3Utils.cpp b/src/net/pop3/POP3Utils.cpp
+--- a/src/net/pop3/POP3Utils.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/pop3/POP3Utils.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/sendmail/sendmailServiceInfos.cpp b/src/net/sendmail/sendmailServiceInfos.cpp
+--- a/src/net/sendmail/sendmailServiceInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/sendmail/sendmailServiceInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/sendmail/sendmailTransport.cpp b/src/net/sendmail/sendmailTransport.cpp
+--- a/src/net/sendmail/sendmailTransport.cpp	2008-10-12 11:36:47.000000000 +0200
++++ b/src/net/sendmail/sendmailTransport.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/service.cpp b/src/net/service.cpp
+--- a/src/net/service.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/service.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/serviceFactory.cpp b/src/net/serviceFactory.cpp
+--- a/src/net/serviceFactory.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/serviceFactory.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/serviceInfos.cpp b/src/net/serviceInfos.cpp
+--- a/src/net/serviceInfos.cpp	2008-10-12 10:58:42.000000000 +0200
++++ b/src/net/serviceInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/serviceRegistration.inl b/src/net/serviceRegistration.inl
+--- a/src/net/serviceRegistration.inl	2008-10-12 11:25:52.000000000 +0200
++++ b/src/net/serviceRegistration.inl	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/session.cpp b/src/net/session.cpp
+--- a/src/net/session.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/session.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/smtp/SMTPResponse.cpp b/src/net/smtp/SMTPResponse.cpp
+--- a/src/net/smtp/SMTPResponse.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/smtp/SMTPResponse.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/smtp/SMTPServiceInfos.cpp b/src/net/smtp/SMTPServiceInfos.cpp
+--- a/src/net/smtp/SMTPServiceInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/smtp/SMTPServiceInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/smtp/SMTPSTransport.cpp b/src/net/smtp/SMTPSTransport.cpp
+--- a/src/net/smtp/SMTPSTransport.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/smtp/SMTPSTransport.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
+--- a/src/net/smtp/SMTPTransport.cpp	2008-10-12 15:50:54.000000000 +0200
++++ b/src/net/smtp/SMTPTransport.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -617,8 +617,10 @@
+ 
+ void SMTPTransport::sendRequest(const string& buffer, const bool end)
+ {
+-	m_socket->send(buffer);
+-	if (end) m_socket->send("\r\n");
++	if (end)
++		m_socket->send(buffer + "\r\n");
++	else
++		m_socket->send(buffer);
+ }
+ 
+ 
+diff -urN a/src/net/tls/TLSSecuredConnectionInfos.cpp b/src/net/tls/TLSSecuredConnectionInfos.cpp
+--- a/src/net/tls/TLSSecuredConnectionInfos.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/tls/TLSSecuredConnectionInfos.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
+--- a/src/net/tls/TLSSession.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/tls/TLSSession.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -24,6 +24,13 @@
+ #include <gnutls/gnutls.h>
+ #include <gnutls/extra.h>
+ 
++#include "vmime/config.hpp"
++
++#if VMIME_HAVE_PTHREAD
++#	include <gcrypt.h>
++#	include <errno.h>
++#endif // VMIME_HAVE_PTHREAD
++
+ #include "vmime/net/tls/TLSSession.hpp"
+ 
+ #include "vmime/exception.hpp"
+@@ -38,6 +45,14 @@
+ #endif // VMIME_DEBUG && GNUTLS_DEBUG
+ 
+ 
++#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
++extern "C"
++{
++	GCRY_THREAD_OPTION_PTHREAD_IMPL;
++}
++#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
++
++
+ namespace vmime {
+ namespace net {
+ namespace tls {
+@@ -50,6 +65,10 @@
+ {
+ 	TLSGlobal()
+ 	{
++#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
++		gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
++#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
++
+ 		gnutls_global_init();
+ 		//gnutls_global_init_extra();
+ 
+diff -urN a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp
+--- a/src/net/tls/TLSSocket.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/net/tls/TLSSocket.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -90,6 +90,12 @@
+ }
+ 
+ 
++TLSSocket::size_type TLSSocket::getBlockSize() const
++{
++	return 16384;  // 16 KB
++}
++
++
+ void TLSSocket::receive(string& buffer)
+ {
+ 	const int size = receiveRaw(m_buffer, sizeof(m_buffer));
+@@ -103,7 +109,7 @@
+ }
+ 
+ 
+-int TLSSocket::receiveRaw(char* buffer, const int count)
++TLSSocket::size_type TLSSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ 	const ssize_t ret = gnutls_record_recv
+ 		(*m_session->m_gnutlsSession,
+@@ -124,7 +130,7 @@
+ }
+ 
+ 
+-void TLSSocket::sendRaw(const char* buffer, const int count)
++void TLSSocket::sendRaw(const char* buffer, const size_type count)
+ {
+ 	gnutls_record_send
+ 		(*m_session->m_gnutlsSession,
+@@ -292,27 +298,26 @@
+ 	// Try X.509
+ 	gnutls_x509_crt* x509Certs = new gnutls_x509_crt[certCount];
+ 
+-	unsigned int count = certCount;
+-
+-	int res = gnutls_x509_crt_list_import
+-		(x509Certs, &count, rawData, GNUTLS_X509_FMT_PEM, 0);
+-
+-	if (res <= 0)
++	for (unsigned int i = 0; i < certCount; ++i)
+ 	{
+-		count = certCount;
++		gnutls_x509_crt_init(x509Certs + i);
++
++		int res = gnutls_x509_crt_import(x509Certs[i], rawData + i,
++			GNUTLS_X509_FMT_DER);
+ 
+-		res = gnutls_x509_crt_list_import
+-			(x509Certs, &count, rawData, GNUTLS_X509_FMT_DER, 0);
++		if (res < 0)
++		{
++			// XXX more fine-grained error reporting?
++			delete [] x509Certs;
++			return NULL;
++		}
+ 	}
+ 
+-	if (res >= 1)
+ 	{
+ 		std::vector <ref <security::cert::certificate> > certs;
+ 		bool error = false;
+ 
+-		count = static_cast <unsigned int>(res);
+-
+-		for (unsigned int i = 0 ; i < count ; ++i)
++		for (unsigned int i = 0 ; i < certCount ; ++i)
+ 		{
+ 			size_t dataSize = 0;
+ 
+diff -urN a/src/net/transport.cpp b/src/net/transport.cpp
+--- a/src/net/transport.cpp	2008-10-12 11:30:53.000000000 +0200
++++ b/src/net/transport.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/object.cpp b/src/object.cpp
+--- a/src/object.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/object.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/options.cpp b/src/options.cpp
+--- a/src/options.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/options.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/parameter.cpp b/src/parameter.cpp
+--- a/src/parameter.cpp	2008-10-12 11:08:59.000000000 +0200
++++ b/src/parameter.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
+--- a/src/parameterizedHeaderField.cpp	2008-10-12 11:47:37.000000000 +0200
++++ b/src/parameterizedHeaderField.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/parsedMessageAttachment.cpp b/src/parsedMessageAttachment.cpp
+--- a/src/parsedMessageAttachment.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/parsedMessageAttachment.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/path.cpp b/src/path.cpp
+--- a/src/path.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/path.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/plainTextPart.cpp b/src/plainTextPart.cpp
+--- a/src/plainTextPart.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/plainTextPart.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/platform.cpp b/src/platform.cpp
+--- a/src/platform.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/platform.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posixChildProcess.cpp
+--- a/src/platforms/posix/posixChildProcess.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/platforms/posix/posixChildProcess.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
+--- a/src/platforms/posix/posixFile.cpp	2008-10-12 11:42:23.000000000 +0200
++++ b/src/platforms/posix/posixFile.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -32,6 +32,7 @@
+ 
+ #include <dirent.h>
+ 
++#include <stdio.h>
+ #include <string.h>
+ 
+ #include "vmime/exception.hpp"
+@@ -62,7 +63,10 @@
+ posixFileIterator::~posixFileIterator()
+ {
+ 	if (m_dir != NULL)
+-		::closedir(m_dir);
++	{
++		if (::closedir(m_dir) == -1)
++			posixFileSystemFactory::reportError(m_path, errno);
++	}
+ }
+ 
+ 
+@@ -85,6 +89,8 @@
+ 
+ void posixFileIterator::getNextElement()
+ {
++	errno = 0;
++
+ 	while ((m_dirEntry = ::readdir(m_dir)) != NULL)
+ 	{
+ 		const char* name = m_dirEntry->d_name;
+@@ -96,6 +102,9 @@
+ 			break;
+ 		}
+ 	}
++
++	if (errno)
++		posixFileSystemFactory::reportError(m_path, errno);
+ }
+ 
+ 
+@@ -118,14 +127,36 @@
+ 
+ void posixFileWriterOutputStream::write(const value_type* const data, const size_type count)
+ {
+-	if (::write(m_fd, data, count) == -1)
+-		posixFileSystemFactory::reportError(m_path, errno);
++	const value_type* array = data;
++	size_t size = count;
++
++	while (1)
++	{
++		ssize_t ret = ::write(m_fd, array, size);
++
++		if (ret == -1)
++		{
++			if (errno == EINTR)
++				continue;
++
++			posixFileSystemFactory::reportError(m_path, errno);
++			break;
++		}
++		else if (size_t(ret) < size)
++		{
++			array += ret;
++			size -= ret;
++		}
++
++		break;
++	}
+ }
+ 
+ 
+ void posixFileWriterOutputStream::flush()
+ {
+-	::fsync(m_fd);
++	if (::fsync(m_fd) == -1)
++		posixFileSystemFactory::reportError(m_path, errno);
+ }
+ 
+ 
+@@ -142,7 +173,8 @@
+ 
+ posixFileReaderInputStream::~posixFileReaderInputStream()
+ {
+-	::close(m_fd);
++	if (::close(m_fd) == -1)
++		posixFileSystemFactory::reportError(m_path, errno);
+ }
+ 
+ 
+@@ -154,7 +186,10 @@
+ 
+ void posixFileReaderInputStream::reset()
+ {
+-	::lseek(m_fd, 0, SEEK_SET);
++	if (::lseek(m_fd, 0, SEEK_SET) == off_t(-1))
++		posixFileSystemFactory::reportError(m_path, errno);
++
++	m_eof = false;
+ }
+ 
+ 
+@@ -166,7 +201,7 @@
+ 	if ((c = ::read(m_fd, data, count)) == -1)
+ 		posixFileSystemFactory::reportError(m_path, errno);
+ 
+-	if (c == 0)
++	if (c == 0 && count != 0)
+ 		m_eof = true;
+ 
+ 	return static_cast <size_type>(c);
+@@ -176,8 +211,15 @@
+ vmime::utility::stream::size_type posixFileReaderInputStream::skip(const size_type count)
+ {
+ 	const off_t curPos = ::lseek(m_fd, 0, SEEK_CUR);
++
++	if (curPos == off_t(-1))
++		posixFileSystemFactory::reportError(m_path, errno);
++
+ 	const off_t newPos = ::lseek(m_fd, count, SEEK_CUR);
+ 
++	if (newPos == off_t(-1))
++		posixFileSystemFactory::reportError(m_path, errno);
++
+ 	return static_cast <size_type>(newPos - curPos);
+ }
+ 
+@@ -244,7 +286,11 @@
+ 	if ((fd = ::open(m_nativePath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0660)) == -1)
+ 		posixFileSystemFactory::reportError(m_path, errno);
+ 
+-	::close(fd);
++	if (::fsync(fd) == -1)
++		posixFileSystemFactory::reportError(m_path, errno);
++
++	if (::close(fd) == -1)
++		posixFileSystemFactory::reportError(m_path, errno);
+ }
+ 
+ 
+@@ -257,32 +303,58 @@
+ bool posixFile::isFile() const
+ {
+ 	struct stat buf;
+-	return (::stat(m_nativePath.c_str(), &buf) == 0 && S_ISREG(buf.st_mode));
++
++	if (::stat(m_nativePath.c_str(), &buf) == -1)
++	{
++		posixFileSystemFactory::reportError(m_path, errno);
++		return false;
++	}
++
++	return S_ISREG(buf.st_mode);
+ }
+ 
+ 
+ bool posixFile::isDirectory() const
+ {
+ 	struct stat buf;
+-	return (::stat(m_nativePath.c_str(), &buf) == 0 && S_ISDIR(buf.st_mode));
++
++	if (::stat(m_nativePath.c_str(), &buf) == -1)
++	{
++		posixFileSystemFactory::reportError(m_path, errno);
++		return false;
++	}
++
++	return S_ISDIR(buf.st_mode);
+ }
+ 
+ 
+ bool posixFile::canRead() const
+ {
+ 	struct stat buf;
+-	return (::stat(m_nativePath.c_str(), &buf) == 0 &&
+-			S_ISREG(buf.st_mode) &&
+-			::access(m_nativePath.c_str(), R_OK | F_OK) == 0);
++
++	if (::stat(m_nativePath.c_str(), &buf) == -1)
++	{
++		posixFileSystemFactory::reportError(m_path, errno);
++		return false;
++	}
++
++	return S_ISREG(buf.st_mode) &&
++		::access(m_nativePath.c_str(), R_OK | F_OK) == 0;
+ }
+ 
+ 
+ bool posixFile::canWrite() const
+ {
+ 	struct stat buf;
+-	return (::stat(m_nativePath.c_str(), &buf) == 0 &&
+-			S_ISREG(buf.st_mode) &&
+-			::access(m_nativePath.c_str(), W_OK | F_OK) == 0);
++
++	if (::stat(m_nativePath.c_str(), &buf) == -1)
++	{
++		posixFileSystemFactory::reportError(m_path, errno);
++		return false;
++	}
++
++	return S_ISREG(buf.st_mode) &&
++		::access(m_nativePath.c_str(), W_OK | F_OK) == 0;
+ }
+ 
+ 
+@@ -290,7 +362,7 @@
+ {
+ 	struct stat buf;
+ 
+-	if (::stat(m_nativePath.c_str(), &buf) != 0)
++	if (::stat(m_nativePath.c_str(), &buf) == -1)
+ 		posixFileSystemFactory::reportError(m_path, errno);
+ 
+ 	return static_cast <length_type>(buf.st_size);
+@@ -323,7 +395,14 @@
+ {
+ 	const vmime::string newNativePath = posixFileSystemFactory::pathToStringImpl(newName);
+ 
+-	if (::rename(m_nativePath.c_str(), newNativePath.c_str()) != 0)
++	posixFile dest(newName);
++
++	if (isDirectory())
++		dest.createDirectory();
++	else
++		dest.createFile();
++
++	if (::rename(m_nativePath.c_str(), newNativePath.c_str()) == -1)
+ 		posixFileSystemFactory::reportError(m_path, errno);
+ 
+ 	m_path = newName;
+@@ -335,17 +414,17 @@
+ {
+ 	struct stat buf;
+ 
+-	if (::stat(m_nativePath.c_str(), &buf) != 0)
++	if (::stat(m_nativePath.c_str(), &buf) == -1)
+ 		posixFileSystemFactory::reportError(m_path, errno);
+ 
+ 	if (S_ISDIR(buf.st_mode))
+ 	{
+-		if (::rmdir(m_nativePath.c_str()) != 0)
++		if (::rmdir(m_nativePath.c_str()) == -1)
+ 			posixFileSystemFactory::reportError(m_path, errno);
+ 	}
+ 	else if (S_ISREG(buf.st_mode))
+ 	{
+-		if (::unlink(m_nativePath.c_str()) != 0)
++		if (::unlink(m_nativePath.c_str()) == -1)
+ 			posixFileSystemFactory::reportError(m_path, errno);
+ 	}
+ }
+@@ -384,7 +463,7 @@
+ 	if (!path.isEmpty() && recursive)
+ 		createDirectoryImpl(fullPath, path.getParent(), true);
+ 
+-	if (::mkdir(nativePath.c_str(), 0750) != 0)
++	if (::mkdir(nativePath.c_str(), 0750) == -1)
+ 		posixFileSystemFactory::reportError(fullPath, errno);
+ }
+ 
+@@ -487,7 +566,9 @@
+ 	case ENOMEM: desc = "ENOMEM: insufficient kernel memory."; break;
+ 	case EMFILE: desc = "ENFILE: limit on number of files open by the process has been reached."; break;
+ 	case ENFILE: desc = "ENFILE: limit on number of files open on the system has been reached."; break;
++#ifndef AIX
+ 	case ENOTEMPTY: desc = "ENOTEMPTY: directory is not empty."; break;
++#endif
+ 
+ 	default:
+ 
+diff -urN a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
+--- a/src/platforms/posix/posixHandler.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/platforms/posix/posixHandler.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -36,6 +36,11 @@
+ #include <netdb.h>
+ 
+ #include <string.h>
++#include <cassert>
++
++#if VMIME_HAVE_PTHREAD
++#	include <pthread.h>
++#endif // VMIME_HAVE_PTHREAD
+ 
+ /*
+ #ifdef _POSIX_PRIORITY_SCHEDULING
+@@ -44,6 +49,43 @@
+ */
+ 
+ 
++#if VMIME_HAVE_PTHREAD
++
++namespace
++{
++	// This construction ensures mutex will be initialized in compile-time
++	// and will be available any time in the runtime.
++	pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
++
++	// Helper lock, to be exception safe all the time.
++	class PLockHelper
++	{
++	public:
++
++		PLockHelper()
++		{
++			if (pthread_mutex_lock(&g_mutex) != 0)
++				assert(!"unable to lock mutex - thread safety's void");
++		}
++
++		~PLockHelper()
++		{
++			if (pthread_mutex_unlock(&g_mutex) != 0)
++				assert(!"unable to unlock mutex - application's dead...");
++		}
++
++	private:
++
++		// Object cannot be copied
++		PLockHelper(const PLockHelper&);
++		const PLockHelper& operator=(const PLockHelper&);
++	};
++
++} // unnamed namespace
++
++#endif // VMIME_HAVE_PTHREAD
++
++
+ namespace vmime {
+ namespace platforms {
+ namespace posix {
+@@ -55,18 +97,14 @@
+ 	m_socketFactory = vmime::create <posixSocketFactory>();
+ #endif
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+-	m_fileSysFactory = new posixFileSystemFactory();
+-	m_childProcFactory = new posixChildProcessFactory();
++	m_fileSysFactory = vmime::create <posixFileSystemFactory>();
++	m_childProcFactory = vmime::create <posixChildProcessFactory>();
+ #endif
+ }
+ 
+ 
+ posixHandler::~posixHandler()
+ {
+-#if VMIME_HAVE_FILESYSTEM_FEATURES
+-	delete (m_fileSysFactory);
+-	delete (m_childProcFactory);
+-#endif
+ }
+ 
+ 
+@@ -113,6 +151,8 @@
+ 
+ const vmime::charset posixHandler::getLocaleCharset() const
+ {
++	const PLockHelper lock;
++
+ 	const char* prevLocale = ::setlocale(LC_ALL, "");
+ 	vmime::charset ch(::nl_langinfo(CODESET));
+ 	::setlocale(LC_ALL, prevLocale);
+@@ -173,9 +213,9 @@
+ 
+ #if VMIME_HAVE_MESSAGING_FEATURES
+ 
+-ref <vmime::net::socketFactory> posixHandler::getSocketFactory() const
++ref <vmime::net::socketFactory> posixHandler::getSocketFactory()
+ {
+-	return m_socketFactory.dynamicCast <vmime::net::socketFactory>();
++	return m_socketFactory;
+ }
+ 
+ #endif
+@@ -183,15 +223,15 @@
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+ 
+-vmime::utility::fileSystemFactory* posixHandler::getFileSystemFactory() const
++ref <vmime::utility::fileSystemFactory> posixHandler::getFileSystemFactory()
+ {
+-	return (m_fileSysFactory);
++	return m_fileSysFactory;
+ }
+ 
+ 
+-vmime::utility::childProcessFactory* posixHandler::getChildProcessFactory() const
++ref <vmime::utility::childProcessFactory> posixHandler::getChildProcessFactory()
+ {
+-	return (m_childProcFactory);
++	return m_childProcFactory;
+ }
+ 
+ #endif
+diff -urN a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
+--- a/src/platforms/posix/posixSocket.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/platforms/posix/posixSocket.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -217,6 +217,12 @@
+ }
+ 
+ 
++posixSocket::size_type posixSocket::getBlockSize() const
++{
++	return 16384;  // 16 KB
++}
++
++
+ void posixSocket::receive(vmime::string& buffer)
+ {
+ 	const int size = receiveRaw(m_buffer, sizeof(m_buffer));
+@@ -224,7 +230,7 @@
+ }
+ 
+ 
+-int posixSocket::receiveRaw(char* buffer, const int count)
++posixSocket::size_type posixSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ 	const int ret = ::recv(m_desc, buffer, count, 0);
+ 
+@@ -252,9 +258,9 @@
+ }
+ 
+ 
+-void posixSocket::sendRaw(const char* buffer, const int count)
++void posixSocket::sendRaw(const char* buffer, const size_type count)
+ {
+-	int size = count;
++	size_type size = count;
+ 
+ 	while (size > 0)
+ 	{
+diff -urN a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
+--- a/src/platforms/windows/windowsFile.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/platforms/windows/windowsFile.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -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,
+@@ -268,7 +268,7 @@
+ 	return true;
+ }
+ 
+-const windowsFile::length_type windowsFile::getLength()
++windowsFile::length_type windowsFile::getLength()
+ {
+ 	HANDLE hFile = CreateFile(
+ 		m_nativePath.c_str(),
+@@ -464,7 +464,7 @@
+ 	SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
+ }
+ 
+-const vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
++vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
+ {
+ 	DWORD dwBytesRead;
+ 	if (!ReadFile(m_hFile, (LPVOID)data, (DWORD)count, &dwBytesRead, NULL))
+@@ -472,7 +472,7 @@
+ 	return dwBytesRead;
+ }
+ 
+-const vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
++vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
+ {
+ 	DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
+ 	DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)count, NULL, FILE_CURRENT);
+diff -urN a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
+--- a/src/platforms/windows/windowsHandler.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/platforms/windows/windowsHandler.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -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,
+@@ -49,17 +49,13 @@
+ 	m_socketFactory = vmime::create <windowsSocketFactory>();
+ #endif
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+-	m_fileSysFactory = new windowsFileSystemFactory();
++	m_fileSysFactory = vmime::create <windowsFileSystemFactory>();
+ #endif
+ }
+ 
+ 
+ windowsHandler::~windowsHandler()
+ {
+-#if VMIME_HAVE_FILESYSTEM_FEATURES
+-	delete (m_fileSysFactory);
+-#endif
+-
+ 	WSACleanup();
+ }
+ 
+@@ -240,9 +236,9 @@
+ 
+ #if VMIME_HAVE_MESSAGING_FEATURES
+ 
+-ref <vmime::net::socketFactory> windowsHandler::getSocketFactory() const
++ref <vmime::net::socketFactory> windowsHandler::getSocketFactory()
+ {
+-	return m_socketFactory.dynamicCast <vmime::net::socketFactory>();
++	return m_socketFactory;
+ }
+ 
+ #endif
+@@ -250,13 +246,13 @@
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+ 
+-vmime::utility::fileSystemFactory* windowsHandler::getFileSystemFactory() const
++ref <vmime::utility::fileSystemFactory> windowsHandler::getFileSystemFactory()
+ {
+-	return (m_fileSysFactory);
++	return m_fileSysFactory;
+ }
+ 
+ 
+-vmime::utility::childProcessFactory* windowsHandler::getChildProcessFactory() const
++ref <vmime::utility::childProcessFactory> windowsHandler::getChildProcessFactory()
+ {
+ 	// TODO: Not implemented
+ 	return (NULL);
+diff -urN a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
+--- a/src/platforms/windows/windowsSocket.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/platforms/windows/windowsSocket.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -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,
+@@ -121,6 +121,12 @@
+ }
+ 
+ 
++windowsSocket::size_type windowsSocket::getBlockSize() const
++{
++	return 16384;  // 16 KB
++}
++
++
+ void windowsSocket::receive(vmime::string& buffer)
+ {
+ 	int ret = ::recv(m_desc, m_buffer, sizeof(m_buffer), 0);
+@@ -137,7 +143,7 @@
+ }
+ 
+ 
+-int windowsSocket::receiveRaw(char* buffer, const int count)
++windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ 	int ret = ::recv(m_desc, buffer, count, 0);
+ 
+@@ -159,7 +165,7 @@
+ }
+ 
+ 
+-void windowsSocket::sendRaw(const char* buffer, const int count)
++void windowsSocket::sendRaw(const char* buffer, const size_type count)
+ {
+ 	::send(m_desc, buffer, count, 0);
+ }
+diff -urN a/src/propertySet.cpp b/src/propertySet.cpp
+--- a/src/propertySet.cpp	2008-10-12 11:48:09.000000000 +0200
++++ b/src/propertySet.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/relay.cpp b/src/relay.cpp
+--- a/src/relay.cpp	2008-10-12 11:50:43.000000000 +0200
++++ b/src/relay.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/cert/certificateChain.cpp b/src/security/cert/certificateChain.cpp
+--- a/src/security/cert/certificateChain.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/cert/certificateChain.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/cert/defaultCertificateVerifier.cpp b/src/security/cert/defaultCertificateVerifier.cpp
+--- a/src/security/cert/defaultCertificateVerifier.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/cert/defaultCertificateVerifier.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/cert/X509Certificate.cpp b/src/security/cert/X509Certificate.cpp
+--- a/src/security/cert/X509Certificate.cpp	2008-10-12 11:41:13.000000000 +0200
++++ b/src/security/cert/X509Certificate.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/defaultAuthenticator.cpp b/src/security/defaultAuthenticator.cpp
+--- a/src/security/defaultAuthenticator.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/defaultAuthenticator.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/digest/md5/md5MessageDigest.cpp b/src/security/digest/md5/md5MessageDigest.cpp
+--- a/src/security/digest/md5/md5MessageDigest.cpp	2008-10-12 11:24:44.000000000 +0200
++++ b/src/security/digest/md5/md5MessageDigest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/digest/messageDigest.cpp b/src/security/digest/messageDigest.cpp
+--- a/src/security/digest/messageDigest.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/digest/messageDigest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/digest/messageDigestFactory.cpp b/src/security/digest/messageDigestFactory.cpp
+--- a/src/security/digest/messageDigestFactory.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/digest/messageDigestFactory.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
+--- a/src/security/digest/sha1/sha1MessageDigest.cpp	2008-10-12 11:24:21.000000000 +0200
++++ b/src/security/digest/sha1/sha1MessageDigest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -27,6 +27,7 @@
+ #include "vmime/security/digest/sha1/sha1MessageDigest.hpp"
+ 
+ #include <cstring>
++#include <cassert>
+ 
+ 
+ namespace vmime {
+@@ -161,8 +162,8 @@
+ 	i = j = 0;
+ 
+ 	std::memset(m_buffer, 0, 64);
+-	std::memset(m_state, 0, 20);
+-	std::memset(m_count, 0, 8);
++	std::memset(m_state, 0, 5 * sizeof(unsigned long));
++	std::memset(m_count, 0, 2 * sizeof(unsigned long));
+ 	std::memset(&finalcount, 0, 8);
+ }
+ 
+@@ -201,6 +202,8 @@
+ 		unsigned long l[16];
+ 	} CHAR64LONG16;
+ 
++	assert(sizeof(unsigned long) == 4);
++
+ 	CHAR64LONG16* block;
+ 	static unsigned char workspace[64];
+ 
+diff -urN a/src/security/sasl/builtinSASLMechanism.cpp b/src/security/sasl/builtinSASLMechanism.cpp
+--- a/src/security/sasl/builtinSASLMechanism.cpp	2008-10-12 11:39:59.000000000 +0200
++++ b/src/security/sasl/builtinSASLMechanism.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/sasl/defaultSASLAuthenticator.cpp b/src/security/sasl/defaultSASLAuthenticator.cpp
+--- a/src/security/sasl/defaultSASLAuthenticator.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/sasl/defaultSASLAuthenticator.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/sasl/SASLContext.cpp b/src/security/sasl/SASLContext.cpp
+--- a/src/security/sasl/SASLContext.cpp	2008-10-12 15:52:16.000000000 +0200
++++ b/src/security/sasl/SASLContext.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/sasl/SASLMechanismFactory.cpp b/src/security/sasl/SASLMechanismFactory.cpp
+--- a/src/security/sasl/SASLMechanismFactory.cpp	2008-10-12 11:38:33.000000000 +0200
++++ b/src/security/sasl/SASLMechanismFactory.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cpp
+--- a/src/security/sasl/SASLSession.cpp	2008-10-12 11:37:11.000000000 +0200
++++ b/src/security/sasl/SASLSession.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
+--- a/src/security/sasl/SASLSocket.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/security/sasl/SASLSocket.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -69,6 +69,12 @@
+ }
+ 
+ 
++SASLSocket::size_type SASLSocket::getBlockSize() const
++{
++	return m_wrapped->getBlockSize();
++}
++
++
+ void SASLSocket::receive(string& buffer)
+ {
+ 	const int n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer));
+@@ -77,7 +83,7 @@
+ }
+ 
+ 
+-int SASLSocket::receiveRaw(char* buffer, const int count)
++SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count)
+ {
+ 	if (m_pendingLen != 0)
+ 	{
+@@ -141,7 +147,7 @@
+ }
+ 
+ 
+-void SASLSocket::sendRaw(const char* buffer, const int count)
++void SASLSocket::sendRaw(const char* buffer, const size_type count)
+ {
+ 	byte_t* output = 0;
+ 	int outputLen = 0;
+diff -urN a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
+--- a/src/streamContentHandler.cpp	2008-10-12 15:44:22.000000000 +0200
++++ b/src/streamContentHandler.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
+--- a/src/stringContentHandler.cpp	2008-10-12 15:42:48.000000000 +0200
++++ b/src/stringContentHandler.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/text.cpp b/src/text.cpp
+--- a/src/text.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/text.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -91,21 +91,6 @@
+ }
+ 
+ 
+-#if VMIME_WIDE_CHAR_SUPPORT
+-
+-const wstring text::getDecodedText() const
+-{
+-	wstring out;
+-
+-	for (std::vector <ref <word> >::const_iterator i = m_words.begin() ; i != m_words.end() ; ++i)
+-		out += (*i)->getDecodedText();
+-
+-	return (out);
+-}
+-
+-#endif
+-
+-
+ void text::copyFrom(const component& other)
+ {
+ 	const text& t = dynamic_cast <const text&>(other);
+diff -urN a/src/textPartFactory.cpp b/src/textPartFactory.cpp
+--- a/src/textPartFactory.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/src/textPartFactory.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/datetimeUtils.cpp b/src/utility/datetimeUtils.cpp
+--- a/src/utility/datetimeUtils.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/datetimeUtils.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -256,7 +256,7 @@
+ }
+ 
+ 
+-int datetimeUtils::getWeekOfYear(const int year, const int month, const int day)
++int datetimeUtils::getWeekOfYear(const int year, const int month, const int day, const bool iso)
+ {
+ 	// Algorithm from http://personal.ecu.edu/mccartyr/ISOwdALG.txt
+ 
+@@ -322,6 +322,9 @@
+ 			WeekNumber -= 1;
+ 	}
+ 
++	if (!iso && (WeekNumber == 1 && month == 12))
++		WeekNumber = 53;
++
+ 	return WeekNumber;
+ }
+ 
+diff -urN a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.cpp
+--- a/src/utility/encoder/b64Encoder.cpp	2008-10-12 15:39:42.000000000 +0200
++++ b/src/utility/encoder/b64Encoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/binaryEncoder.cpp b/src/utility/encoder/binaryEncoder.cpp
+--- a/src/utility/encoder/binaryEncoder.cpp	2008-10-12 15:28:06.000000000 +0200
++++ b/src/utility/encoder/binaryEncoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/defaultEncoder.cpp b/src/utility/encoder/defaultEncoder.cpp
+--- a/src/utility/encoder/defaultEncoder.cpp	2008-10-12 15:25:06.000000000 +0200
++++ b/src/utility/encoder/defaultEncoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/eightBitEncoder.cpp b/src/utility/encoder/eightBitEncoder.cpp
+--- a/src/utility/encoder/eightBitEncoder.cpp	2008-10-12 15:23:16.000000000 +0200
++++ b/src/utility/encoder/eightBitEncoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/encoder.cpp b/src/utility/encoder/encoder.cpp
+--- a/src/utility/encoder/encoder.cpp	2008-10-12 15:15:06.000000000 +0200
++++ b/src/utility/encoder/encoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoderFactory.cpp
+--- a/src/utility/encoder/encoderFactory.cpp	2008-10-12 15:38:01.000000000 +0200
++++ b/src/utility/encoder/encoderFactory.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp
+--- a/src/utility/encoder/qpEncoder.cpp	2008-10-12 15:32:35.000000000 +0200
++++ b/src/utility/encoder/qpEncoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/sevenBitEncoder.cpp b/src/utility/encoder/sevenBitEncoder.cpp
+--- a/src/utility/encoder/sevenBitEncoder.cpp	2008-10-12 15:48:20.000000000 +0200
++++ b/src/utility/encoder/sevenBitEncoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/encoder/uuEncoder.cpp b/src/utility/encoder/uuEncoder.cpp
+--- a/src/utility/encoder/uuEncoder.cpp	2008-10-12 15:36:45.000000000 +0200
++++ b/src/utility/encoder/uuEncoder.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/filteredStream.cpp b/src/utility/filteredStream.cpp
+--- a/src/utility/filteredStream.cpp	2008-10-12 11:09:18.000000000 +0200
++++ b/src/utility/filteredStream.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -30,6 +30,22 @@
+ namespace utility {
+ 
+ 
++// filteredInputStream
++
++stream::size_type filteredInputStream::getBlockSize()
++{
++	return std::min(inputStream::getBlockSize(), getPreviousInputStream().getBlockSize());
++}
++
++
++// filteredOutputStream
++
++stream::size_type filteredOutputStream::getBlockSize()
++{
++	return std::min(outputStream::getBlockSize(), getNextOutputStream().getBlockSize());
++}
++
++
+ // dotFilteredInputStream
+ 
+ dotFilteredInputStream::dotFilteredInputStream(inputStream& is)
+@@ -215,8 +231,8 @@
+ 
+ 		if (previousChar == '\r')
+ 		{
+-			if (pos != data)
+-				m_stream.write(start, pos - 1 - data);  // do not write \r
++			if (pos != start)
++				m_stream.write(start, pos - 1 - start);  // do not write \r
+ 
+ 			m_stream.write("\n", 1);
+ 
+diff -urN a/src/utility/path.cpp b/src/utility/path.cpp
+--- a/src/utility/path.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/path.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/progressListener.cpp b/src/utility/progressListener.cpp
+--- a/src/utility/progressListener.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/progressListener.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/random.cpp b/src/utility/random.cpp
+--- a/src/utility/random.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/random.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/smartPtr.cpp b/src/utility/smartPtr.cpp
+--- a/src/utility/smartPtr.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/smartPtr.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/smartPtrInt.cpp b/src/utility/smartPtrInt.cpp
+--- a/src/utility/smartPtrInt.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/smartPtrInt.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/stream.cpp b/src/utility/stream.cpp
+--- a/src/utility/stream.cpp	2008-10-12 11:10:12.000000000 +0200
++++ b/src/utility/stream.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -38,7 +38,7 @@
+ 
+ // stream
+ 
+-stream::size_type stream::getBlockSize() const
++stream::size_type stream::getBlockSize()
+ {
+ 	return 32768;  // 32 KB
+ }
+@@ -468,9 +468,9 @@
+ }
+ 
+ 
+-stream::size_type outputStreamSocketAdapter::getBlockSize() const
++stream::size_type outputStreamSocketAdapter::getBlockSize()
+ {
+-	return 16384;  // 16 KB
++	return m_socket.getBlockSize();
+ }
+ 
+ 
+@@ -511,9 +511,9 @@
+ }
+ 
+ 
+-stream::size_type inputStreamSocketAdapter::getBlockSize() const
++stream::size_type inputStreamSocketAdapter::getBlockSize()
+ {
+-	return 16384;  // 16 KB
++	return m_socket.getBlockSize();
+ }
+ 
+ 
+diff -urN a/src/utility/stringProxy.cpp b/src/utility/stringProxy.cpp
+--- a/src/utility/stringProxy.cpp	2008-10-12 11:10:31.000000000 +0200
++++ b/src/utility/stringProxy.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/stringUtils.cpp b/src/utility/stringUtils.cpp
+--- a/src/utility/stringUtils.cpp	2008-10-12 11:11:24.000000000 +0200
++++ b/src/utility/stringUtils.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -142,7 +142,7 @@
+ 	{
+ 		if (parserHelpers::isAscii(*i))
+ 		{
+-			if (*i != '=' || *(i + 1) != '?') // To avoid bad behaviour...
++			if (*i != '=' || ((i + 1) != end && *(i + 1) != '?')) // To avoid bad behaviour...
+ 				++count;
+ 		}
+ 	}
+diff -urN a/src/utility/url.cpp b/src/utility/url.cpp
+--- a/src/utility/url.cpp	2008-10-12 10:54:31.000000000 +0200
++++ b/src/utility/url.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/utility/urlUtils.cpp b/src/utility/urlUtils.cpp
+--- a/src/utility/urlUtils.cpp	2008-10-12 11:52:31.000000000 +0200
++++ b/src/utility/urlUtils.cpp	2010-02-09 14:34:52.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/src/word.cpp b/src/word.cpp
+--- a/src/word.cpp	2008-10-12 15:45:39.000000000 +0200
++++ b/src/word.cpp	2010-02-10 10:56:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -352,10 +352,23 @@
+ 		noEncoding = false;
+ 	}
+ 
+-	if (noEncoding)
++	// If possible and requested (with flag), quote the buffer (no folding is performed).
++	// Quoting is possible if and only if:
++	//  - the whole buffer is ASCII-only
++	//  - the buffer does not contain quoting character (")
++	//  - there is enough remaining space on the current line to hold the whole buffer
++	if (!noEncoding &&
++	    (flags & text::QUOTE_IF_POSSIBLE) &&
++	    asciiCount == m_buffer.length() &&
++	    m_buffer.find('"') == string::npos &&
++	    (curLineLength + 2 /* 2 x " */ + m_buffer.length()) < maxLineLength)
++	{
++		os << '"' << m_buffer << '"';
++		curLineLength += 2 + m_buffer.length();
++	}
++	// We will fold lines without encoding them.
++	else if (noEncoding)
+ 	{
+-		// We will fold lines without encoding them.
+-
+ 		string::const_iterator lastWSpos = m_buffer.end(); // last white-space position
+ 		string::const_iterator curLineStart = m_buffer.begin(); // current line start
+ 
+@@ -463,7 +476,7 @@
+ 
+ 				os << string(curLineStart, lastWSpos);
+ 
+-				if (lastWSpos > curLineStart && std::isspace(*(lastWSpos - 1)))
++				if (lastWSpos > curLineStart && parserHelpers::isSpace(*(lastWSpos - 1)))
+ 					state->lastCharIsSpace = true;
+ 				else
+ 					state->lastCharIsSpace = false;
+@@ -609,20 +622,6 @@
+ }
+ 
+ 
+-#if VMIME_WIDE_CHAR_SUPPORT
+-
+-const wstring word::getDecodedText() const
+-{
+-	wstring out;
+-
+-	charset::decode(m_buffer, out, m_charset);
+-
+-	return (out);
+-}
+-
+-#endif
+-
+-
+ word& word::operator=(const word& w)
+ {
+ 	m_buffer = w.m_buffer;
+@@ -699,6 +698,12 @@
+ }
+ 
+ 
++bool word::isEmpty() const
++{
++	return m_buffer.empty();
++}
++
++
+ void word::setBuffer(const string& buffer)
+ {
+ 	m_buffer = buffer;
+diff -urN a/src/wordEncoder.cpp b/src/wordEncoder.cpp
+--- a/src/wordEncoder.cpp	2008-10-12 15:47:14.000000000 +0200
++++ b/src/wordEncoder.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/charset/main.cpp b/tests/charset/main.cpp
+--- a/tests/charset/main.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/charset/main.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/misc/importanceHelperTest.cpp b/tests/misc/importanceHelperTest.cpp
+--- a/tests/misc/importanceHelperTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/misc/importanceHelperTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
+--- a/tests/net/maildir/maildirStoreTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/net/maildir/maildirStoreTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -322,12 +322,28 @@
+ 
+ 	void testRenameFolder_KMail()
+ 	{
+-		testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
++		try
++		{
++			testRenameFolderImpl(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
++		}
++		catch (vmime::exception& e)
++		{
++			std::cerr << e;
++			throw e;
++		}
+ 	}
+ 
+ 	void testRenameFolder_Courier()
+ 	{
+-		testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
++		try
++		{
++			testRenameFolderImpl(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
++		}
++		catch (vmime::exception& e)
++		{
++			std::cerr << e;
++			throw e;
++		}
+ 	}
+ 
+ 	void testRenameFolderImpl(const vmime::string* const dirs, const vmime::string* const files)
+@@ -485,7 +501,7 @@
+ 
+ 	const vmime::utility::url getStoreURL()
+ 	{
+-		vmime::utility::fileSystemFactory* fsf =
++		vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ 			vmime::platform::getHandler()->getFileSystemFactory();
+ 
+ 		vmime::utility::url url(std::string("maildir://localhost")
+@@ -496,7 +512,7 @@
+ 
+ 	void createMaildir(const vmime::string* const dirs, const vmime::string* const files)
+ 	{
+-		vmime::utility::fileSystemFactory* fsf =
++		vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ 			vmime::platform::getHandler()->getFileSystemFactory();
+ 
+ 		vmime::ref <vmime::utility::file> rootDir = fsf->create(m_tempPath);
+@@ -528,7 +544,7 @@
+ 
+ 	void destroyMaildir()
+ 	{
+-		vmime::utility::fileSystemFactory* fsf =
++		vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ 			vmime::platform::getHandler()->getFileSystemFactory();
+ 
+ 		recursiveDelete(fsf->create(m_tempPath));
+diff -urN a/tests/net/smtp/SMTPResponseTest.cpp b/tests/net/smtp/SMTPResponseTest.cpp
+--- a/tests/net/smtp/SMTPResponseTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/net/smtp/SMTPResponseTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp
+--- a/tests/net/smtp/SMTPTransportTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/net/smtp/SMTPTransportTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelperTest.cpp
+--- a/tests/parser/attachmentHelperTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/attachmentHelperTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp
+--- a/tests/parser/bodyPartTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/bodyPartTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/charsetTest.cpp b/tests/parser/charsetTest.cpp
+--- a/tests/parser/charsetTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/charsetTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/datetimeTest.cpp b/tests/parser/datetimeTest.cpp
+--- a/tests/parser/datetimeTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/datetimeTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/dispositionTest.cpp b/tests/parser/dispositionTest.cpp
+--- a/tests/parser/dispositionTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/dispositionTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/headerTest.cpp b/tests/parser/headerTest.cpp
+--- a/tests/parser/headerTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/headerTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/htmlTextPartTest.cpp b/tests/parser/htmlTextPartTest.cpp
+--- a/tests/parser/htmlTextPartTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/htmlTextPartTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
+--- a/tests/parser/mailboxTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/mailboxTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/mediaTypeTest.cpp b/tests/parser/mediaTypeTest.cpp
+--- a/tests/parser/mediaTypeTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/mediaTypeTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/messageIdSequenceTest.cpp b/tests/parser/messageIdSequenceTest.cpp
+--- a/tests/parser/messageIdSequenceTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/messageIdSequenceTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/messageIdTest.cpp b/tests/parser/messageIdTest.cpp
+--- a/tests/parser/messageIdTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/messageIdTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
+--- a/tests/parser/parameterTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/parameterTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -32,7 +32,9 @@
+ 
+ 	VMIME_TEST_LIST_BEGIN
+ 		VMIME_TEST(testParse)
++		VMIME_TEST(testParseRFC2231)
+ 		VMIME_TEST(testGenerate)
++		VMIME_TEST(testGenerateRFC2231)
+ 		VMIME_TEST(testNonStandardEncodedParam)
+ 	VMIME_TEST_LIST_END
+ 
+@@ -134,57 +136,60 @@
+ 		VASSERT_EQ("7.1", 1, p7.getParameterCount());
+ 		VASSERT_EQ("7.2", "param1", PARAM_NAME(p7, 0));
+ 		VASSERT_EQ("7.3", "this is a slash: \"\\\"", PARAM_VALUE(p7, 0));
++	}
+ 
++	void testParseRFC2231()
++	{
+ 		// Extended parameter with charset specified in more than one
+ 		// section (this is forbidden by RFC, but is should not fail)
+-		parameterizedHeaderField p8;
+-		p8.parse("X; param1*0*=charset1'language1'value1;\r\n"
+-			 "   param1*1*=charset2'language2'value2;");
+-
+-		VASSERT_EQ("8.1", 1, p8.getParameterCount());
+-		VASSERT_EQ("8.2", "param1", PARAM_NAME(p8, 0));
+-		VASSERT_EQ("8.3", "charset1", PARAM_CHARSET(p8, 0));
+-		VASSERT_EQ("8.4", "value1charset2'language2'value2", PARAM_BUFFER(p8, 0));
++		parameterizedHeaderField p1;
++		p1.parse("X; param1*0*=charset1'language1'value1;\r\n"
++			   "   param1*1*=charset2'language2'value2;");
++
++		VASSERT_EQ("1.1", 1, p1.getParameterCount());
++		VASSERT_EQ("1.2", "param1", PARAM_NAME(p1, 0));
++		VASSERT_EQ("1.3", "charset1", PARAM_CHARSET(p1, 0));
++		VASSERT_EQ("1.4", "value1charset2'language2'value2", PARAM_BUFFER(p1, 0));
+ 
+ 		// Charset not specified in the first section (that is not encoded),
+ 		// but specified in the second one (legal)
+-		parameterizedHeaderField p9;
+-		p9.parse("X; param1*0=value1;\r\n"
+-			 "   param1*1*=charset'language'value2;");
+-
+-		VASSERT_EQ("9.1", 1, p9.getParameterCount());
+-		VASSERT_EQ("9.2", "param1", PARAM_NAME(p9, 0));
+-		VASSERT_EQ("9.3", "charset", PARAM_CHARSET(p9, 0));
+-		VASSERT_EQ("9.4", "value1value2", PARAM_BUFFER(p9, 0));
++		parameterizedHeaderField p2;
++		p2.parse("X; param1*0=value1;\r\n"
++			   "   param1*1*=charset'language'value2;");
++
++		VASSERT_EQ("2.1", 1, p2.getParameterCount());
++		VASSERT_EQ("2.2", "param1", PARAM_NAME(p2, 0));
++		VASSERT_EQ("2.3", "charset", PARAM_CHARSET(p2, 0));
++		VASSERT_EQ("2.4", "value1value2", PARAM_BUFFER(p2, 0));
+ 
+ 		// Characters prefixed with '%' in a simple (not extended) section
+ 		// should not be decoded
+-		parameterizedHeaderField p10;
+-		p10.parse("X; param1=val%20ue1");
++		parameterizedHeaderField p3;
++		p3.parse("X; param1=val%20ue1");
+ 
+-		VASSERT_EQ("10.1", 1, p10.getParameterCount());
+-		VASSERT_EQ("10.2", "param1", PARAM_NAME(p10, 0));
+-		VASSERT_EQ("10.3", "val%20ue1", PARAM_VALUE(p10, 0));
++		VASSERT_EQ("3.1", 1, p3.getParameterCount());
++		VASSERT_EQ("3.2", "param1", PARAM_NAME(p3, 0));
++		VASSERT_EQ("3.3", "val%20ue1", PARAM_VALUE(p3, 0));
+ 
+ 		// Multiple sections + charset specified and encoding
+-		parameterizedHeaderField p11;
+-		p11.parse("X; param1*0*=charset'language'value1a%20;"
+-			  "   param1*1*=value1b%20;"
+-			  "   param1*2=value1c");
+-
+-		VASSERT_EQ("11.1", 1, p11.getParameterCount());
+-		VASSERT_EQ("11.2", "param1", PARAM_NAME(p11, 0));
+-		VASSERT_EQ("11.3", "charset", PARAM_CHARSET(p11, 0));
+-		VASSERT_EQ("11.4", "value1a value1b value1c", PARAM_BUFFER(p11, 0));
++		parameterizedHeaderField p4;
++		p4.parse("X; param1*0*=charset'language'value1a%20;"
++			   "   param1*1*=value1b%20;"
++			   "   param1*2=value1c");
++
++		VASSERT_EQ("4.1", 1, p4.getParameterCount());
++		VASSERT_EQ("4.2", "param1", PARAM_NAME(p4, 0));
++		VASSERT_EQ("4.3", "charset", PARAM_CHARSET(p4, 0));
++		VASSERT_EQ("4.4", "value1a value1b value1c", PARAM_BUFFER(p4, 0));
+ 
+ 		// No charset specified: defaults to US-ASCII
+-		parameterizedHeaderField p12;
+-		p12.parse("X; param1*='language'value1");
++		parameterizedHeaderField p5;
++		p5.parse("X; param1*='language'value1");
+ 
+-		VASSERT_EQ("12.1", 1, p12.getParameterCount());
+-		VASSERT_EQ("12.2", "param1", PARAM_NAME(p12, 0));
+-		VASSERT_EQ("12.3", "us-ascii", PARAM_CHARSET(p12, 0));
+-		VASSERT_EQ("12.4", "value1", PARAM_BUFFER(p12, 0));
++		VASSERT_EQ("5.1", 1, p5.getParameterCount());
++		VASSERT_EQ("5.2", "param1", PARAM_NAME(p5, 0));
++		VASSERT_EQ("5.3", "us-ascii", PARAM_CHARSET(p5, 0));
++		VASSERT_EQ("5.4", "value1", PARAM_BUFFER(p5, 0));
+ 	}
+ 
+ 	void testGenerate()
+@@ -206,21 +211,24 @@
+ 		p2b.appendParameter(vmime::create <vmime::parameter>("param1", "va\\lue\"1"));
+ 
+ 		VASSERT_EQ("2b", "F: X; param1=\"va\\\\lue\\\"1\"", p2b.generate());
++	}
+ 
++	void testGenerateRFC2231()
++	{
+ 		// Extended parameter with charset specifier
+-		parameterizedHeaderField p3;
+-		p3.appendParameter(vmime::create <vmime::parameter>("param1",
++		parameterizedHeaderField p1;
++		p1.appendParameter(vmime::create <vmime::parameter>("param1",
+ 			vmime::word("value 1\xe9", vmime::charset("charset"))));
+ 
+-		VASSERT_EQ("3", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p3.generate());
++		VASSERT_EQ("1", "F: X; param1=\"value 1\";param1*=charset''value%201%E9", p1.generate());
+ 
+ 		// Value that spans on multiple lines
+-		parameterizedHeaderField p4;
+-		p4.appendParameter(vmime::create <vmime::parameter>("param1",
++		parameterizedHeaderField p2;
++		p2.appendParameter(vmime::create <vmime::parameter>("param1",
+ 			vmime::word("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ 				    vmime::charset("charset"))));
+ 
+-		VASSERT_EQ("4", "F: X; \r\n "
++		VASSERT_EQ("2", "F: X; \r\n "
+ 			"param1=abcdefghijklm;\r\n "
+ 			"param1*0*=charset''abc;\r\n "
+ 			"param1*1*=defghijkl;\r\n "
+@@ -228,7 +236,23 @@
+ 			"param1*3*=vwxyzABCD;\r\n "
+ 			"param1*4*=EFGHIJKLM;\r\n "
+ 			"param1*5*=NOPQRSTUV;\r\n "
+-			"param1*6*=WXYZ", p4.generate(25));  // max line length = 25
++			"param1*6*=WXYZ", p2.generate(25));  // max line length = 25
++
++		// Non-ASCII parameter value
++		parameterizedHeaderField p3;
++		p3.appendParameter(vmime::create <vmime::parameter>("param1",
++			vmime::word("δσσσσσσσσσσσσσσσσσσσσδσδα δσαδσδσαδσαδασδασ δσαδασδσα δσαδασδσα δασδασδασ δασαχφδδσα 2008.doc",
++				vmime::charset("utf-8"))));
++
++		VASSERT_EQ("3", "F: X; \r\n "
++			"param1=\"      2008.doc\";param1*0*=utf-8''%CE%B4%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
++			"param1*1*=%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83%CF%83;\r\n "
++			"param1*2*=%CE%B4%CF%83%CE%B4%CE%B1%20%CE%B4%CF%83%CE%B1%CE%B4%CF%83%CE%B4%CF;\r\n "
++			"param1*3*=%83%CE%B1%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20;\r\n "
++			"param1*4*=%CE%B4%CF%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CF;\r\n "
++			"param1*5*=%83%CE%B1%CE%B4%CE%B1%CF%83%CE%B4%CF%83%CE%B1%20%CE%B4%CE%B1%CF%83;\r\n "
++			"param1*6*=%CE%B4%CE%B1%CF%83%CE%B4%CE%B1%CF%83%20%CE%B4%CE%B1%CF%83%CE%B1%CF;\r\n "
++			"param1*7*=%87%CF%86%CE%B4%CE%B4%CF%83%CE%B1%202008.doc", p3.generate(80));
+ 	}
+ 
+ 	void testNonStandardEncodedParam()
+diff -urN a/tests/parser/pathTest.cpp b/tests/parser/pathTest.cpp
+--- a/tests/parser/pathTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/pathTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
+--- a/tests/parser/textTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/parser/textTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/security/digest/md5Test.cpp b/tests/security/digest/md5Test.cpp
+--- a/tests/security/digest/md5Test.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/security/digest/md5Test.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/security/digest/sha1Test.cpp b/tests/security/digest/sha1Test.cpp
+--- a/tests/security/digest/sha1Test.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/security/digest/sha1Test.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/testRunner.cpp b/tests/testRunner.cpp
+--- a/tests/testRunner.cpp	2008-10-12 11:43:03.000000000 +0200
++++ b/tests/testRunner.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/testUtils.cpp b/tests/testUtils.cpp
+--- a/tests/testUtils.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/testUtils.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -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,
+@@ -51,6 +51,12 @@
+ }
+ 
+ 
++testSocket::size_type testSocket::getBlockSize() const
++{
++	return 16384;
++}
++
++
+ void testSocket::receive(vmime::string& buffer)
+ {
+ 	buffer = m_inBuffer;
+@@ -181,3 +187,61 @@
+ 	return vmime::create <testTimeoutHandler>();
+ }
+ 
++
++
++// Exception helper
++std::ostream& operator<<(std::ostream& os, const vmime::exception& e)
++{
++	os << "* vmime::exceptions::" << e.name() << std::endl;
++	os << "    what = " << e.what() << std::endl;
++
++	// More information for special exceptions
++	if (dynamic_cast <const vmime::exceptions::command_error*>(&e))
++	{
++		const vmime::exceptions::command_error& cee =
++			dynamic_cast <const vmime::exceptions::command_error&>(e);
++
++		os << "    command = " << cee.command() << std::endl;
++		os << "    response = " << cee.response() << std::endl;
++	}
++
++	if (dynamic_cast <const vmime::exceptions::invalid_response*>(&e))
++	{
++		const vmime::exceptions::invalid_response& ir =
++			dynamic_cast <const vmime::exceptions::invalid_response&>(e);
++
++		os << "    response = " << ir.response() << std::endl;
++	}
++
++	if (dynamic_cast <const vmime::exceptions::connection_greeting_error*>(&e))
++	{
++		const vmime::exceptions::connection_greeting_error& cgee =
++			dynamic_cast <const vmime::exceptions::connection_greeting_error&>(e);
++
++		os << "    response = " << cgee.response() << std::endl;
++	}
++
++	if (dynamic_cast <const vmime::exceptions::authentication_error*>(&e))
++	{
++		const vmime::exceptions::authentication_error& aee =
++			dynamic_cast <const vmime::exceptions::authentication_error&>(e);
++
++		os << "    response = " << aee.response() << std::endl;
++	}
++
++	if (dynamic_cast <const vmime::exceptions::filesystem_exception*>(&e))
++	{
++		const vmime::exceptions::filesystem_exception& fse =
++			dynamic_cast <const vmime::exceptions::filesystem_exception&>(e);
++
++		os << "    path = " << vmime::platform::getHandler()->
++			getFileSystemFactory()->pathToString(fse.path()) << std::endl;
++	}
++
++	if (e.other() != NULL)
++		os << *e.other();
++
++	return os;
++}
++
++
+diff -urN a/tests/testUtils.hpp b/tests/testUtils.hpp
+--- a/tests/testUtils.hpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/testUtils.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -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,
+@@ -216,6 +216,8 @@
+ 	int receiveRaw(char* buffer, const int count);
+ 	void sendRaw(const char* buffer, const int count);
+ 
++	size_type getBlockSize() const;
++
+ 	/** Send data to client.
+ 	  *
+ 	  * @buffer data to send
+@@ -303,3 +305,7 @@
+ 	vmime::ref <vmime::net::timeoutHandler> create();
+ };
+ 
++
++// Exception helper
++std::ostream& operator<<(std::ostream& os, const vmime::exception& e);
++
+diff -urN a/tests/utility/datetimeUtilsTest.cpp b/tests/utility/datetimeUtilsTest.cpp
+--- a/tests/utility/datetimeUtilsTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/datetimeUtilsTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -143,10 +143,11 @@
+ 	{
+ 		VASSERT_EQ("1.1", 52, datetimeUtils::getWeekOfYear(2003, 12, 27));
+ 		VASSERT_EQ("1.2", 52, datetimeUtils::getWeekOfYear(2003, 12, 28));
+-		VASSERT_EQ("1.3",  1, datetimeUtils::getWeekOfYear(2003, 12, 29));
+-		VASSERT_EQ("1.4",  1, datetimeUtils::getWeekOfYear(2004,  1,  4));
+-		VASSERT_EQ("1.5",  2, datetimeUtils::getWeekOfYear(2004,  1,  5));
+-		VASSERT_EQ("1.6",  2, datetimeUtils::getWeekOfYear(2004,  1, 11));
++		VASSERT_EQ("1.3",  1, datetimeUtils::getWeekOfYear(2003, 12, 29, true));
++		VASSERT_EQ("1.4", 53, datetimeUtils::getWeekOfYear(2003, 12, 29, false));
++		VASSERT_EQ("1.5",  1, datetimeUtils::getWeekOfYear(2004,  1,  4));
++		VASSERT_EQ("1.6",  2, datetimeUtils::getWeekOfYear(2004,  1,  5));
++		VASSERT_EQ("1.7",  2, datetimeUtils::getWeekOfYear(2004,  1, 11));
+ 
+ 		VASSERT_EQ("2.1", 52, datetimeUtils::getWeekOfYear(2004, 12, 26));
+ 		VASSERT_EQ("2.2", 53, datetimeUtils::getWeekOfYear(2004, 12, 27));
+diff -urN a/tests/utility/encoderTest.cpp b/tests/utility/encoderTest.cpp
+--- a/tests/utility/encoderTest.cpp	2008-10-12 15:54:01.000000000 +0200
++++ b/tests/utility/encoderTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/utility/filteredStreamTest.cpp b/tests/utility/filteredStreamTest.cpp
+--- a/tests/utility/filteredStreamTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/filteredStreamTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -175,6 +175,7 @@
+ 		testFilteredOutputStreamHelper<FILTER>("4", "foo\nbar", "foo", "\r\nbar");
+ 		testFilteredOutputStreamHelper<FILTER>("5", "foo\nbar", "foo", "\r", "\nbar");
+ 		testFilteredOutputStreamHelper<FILTER>("6", "foo\nbar", "foo", "\r", "\n", "bar");
++		testFilteredOutputStreamHelper<FILTER>("7", "foo\nba\nr", "foo\r", "\nba\r\nr");
+ 	}
+ 
+ 	// stopSequenceFilteredInputStream
+diff -urN a/tests/utility/pathTest.cpp b/tests/utility/pathTest.cpp
+--- a/tests/utility/pathTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/pathTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/utility/smartPtrTest.cpp b/tests/utility/smartPtrTest.cpp
+--- a/tests/utility/smartPtrTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/smartPtrTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/utility/stringProxyTest.cpp b/tests/utility/stringProxyTest.cpp
+--- a/tests/utility/stringProxyTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/stringProxyTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/utility/stringUtilsTest.cpp b/tests/utility/stringUtilsTest.cpp
+--- a/tests/utility/stringUtilsTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/stringUtilsTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/tests/utility/urlTest.cpp b/tests/utility/urlTest.cpp
+--- a/tests/utility/urlTest.cpp	2008-10-12 10:54:32.000000000 +0200
++++ b/tests/utility/urlTest.cpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/address.hpp b/vmime/address.hpp
+--- a/vmime/address.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/address.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/addressList.hpp b/vmime/addressList.hpp
+--- a/vmime/addressList.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/addressList.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/attachmentHelper.hpp b/vmime/attachmentHelper.hpp
+--- a/vmime/attachmentHelper.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/attachmentHelper.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/attachment.hpp b/vmime/attachment.hpp
+--- a/vmime/attachment.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/attachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/base.hpp b/vmime/base.hpp
+--- a/vmime/base.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/base.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -29,6 +29,7 @@
+ #include <vector>
+ #include <map>
+ #include <sstream>
++#include <cctype>
+ #include <locale>
+ 
+ #include "vmime/config.hpp"
+@@ -47,9 +48,6 @@
+ 
+ 	// "Null" strings
+ 	extern const string NULL_STRING;
+-#if VMIME_WIDE_CHAR_SUPPORT
+-	extern const wstring NULL_WSTRING;
+-#endif
+ 
+ 	extern const text NULL_TEXT;
+ 	extern const word NULL_WORD;
+diff -urN a/vmime/body.hpp b/vmime/body.hpp
+--- a/vmime/body.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/body.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/bodyPartAttachment.hpp b/vmime/bodyPartAttachment.hpp
+--- a/vmime/bodyPartAttachment.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/bodyPartAttachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
+--- a/vmime/bodyPart.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/bodyPart.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/charsetConverter.hpp b/vmime/charsetConverter.hpp
+--- a/vmime/charsetConverter.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/charsetConverter.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/charset.hpp b/vmime/charset.hpp
+--- a/vmime/charset.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/charset.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/component.hpp b/vmime/component.hpp
+--- a/vmime/component.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/component.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/constants.hpp b/vmime/constants.hpp
+--- a/vmime/constants.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/constants.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free SOFTWARE; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software FOUNDATION; either version 2 of
++// published by the Free Software FOUNDATION; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/contentDispositionField.hpp b/vmime/contentDispositionField.hpp
+--- a/vmime/contentDispositionField.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/contentDispositionField.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/contentDisposition.hpp b/vmime/contentDisposition.hpp
+--- a/vmime/contentDisposition.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/contentDisposition.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
+--- a/vmime/contentHandler.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/contentHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/contentTypeField.hpp b/vmime/contentTypeField.hpp
+--- a/vmime/contentTypeField.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/contentTypeField.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/dateTime.hpp b/vmime/dateTime.hpp
+--- a/vmime/dateTime.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/dateTime.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/defaultAttachment.hpp b/vmime/defaultAttachment.hpp
+--- a/vmime/defaultAttachment.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/defaultAttachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/disposition.hpp b/vmime/disposition.hpp
+--- a/vmime/disposition.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/disposition.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
+--- a/vmime/emptyContentHandler.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/emptyContentHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/encoding.hpp b/vmime/encoding.hpp
+--- a/vmime/encoding.hpp	2008-10-12 15:43:38.000000000 +0200
++++ b/vmime/encoding.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/exception.hpp b/vmime/exception.hpp
+--- a/vmime/exception.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/exception.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/fileAttachment.hpp b/vmime/fileAttachment.hpp
+--- a/vmime/fileAttachment.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/fileAttachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -41,9 +41,13 @@
+ {
+ public:
+ 
+-	fileAttachment(const string& filename, const mediaType& type);
+-	fileAttachment(const string& filename, const mediaType& type, const text& desc);
+-	fileAttachment(const string& filename, const mediaType& type, const text& desc, const encoding& enc);
++	fileAttachment(const string& filepath, const mediaType& type);
++	fileAttachment(const string& filepath, const mediaType& type, const text& desc);
++	fileAttachment(const string& filepath, const mediaType& type, const text& desc, const encoding& enc);
++
++	fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type);
++	fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type, const text& desc);
++	fileAttachment(ref <utility::inputStream> is, const word& filename, const mediaType& type, const text& desc, const encoding& enc);
+ 
+ 	/** Stores information about a file attachment.
+ 	  */
+@@ -65,7 +69,7 @@
+ 		  *
+ 		  * @return file name
+ 		  */
+-		const string& getFilename() const;
++		const word& getFilename() const;
+ 
+ 		/** Set the value of the 'filename' property.
+ 		  *
+@@ -73,6 +77,12 @@
+ 		  */
+ 		void setFilename(const string& name);
+ 
++		/** Set the value of the 'filename' property.
++		  *
++		  * @param name file name
++		  */
++		void setFilename(const word& name);
++
+ 		/** Check whether the 'creation-date' property is present.
+ 		  *
+ 		  * @return true if the 'creation-date' property is set,
+@@ -151,7 +161,7 @@
+ 
+ 	private:
+ 
+-		string* m_filename;
++		word* m_filename;
+ 		unsigned int* m_size;
+ 		datetime* m_creationDate;
+ 		datetime* m_modifDate;
+@@ -163,7 +173,8 @@
+ 
+ private:
+ 
+-	void setData(const string& filename);
++	void setData(const string& filepath);
++	void setData(ref <utility::inputStream> is);
+ 
+ 	fileInfo m_fileInfo;
+ 
+diff -urN a/vmime/generatedMessageAttachment.hpp b/vmime/generatedMessageAttachment.hpp
+--- a/vmime/generatedMessageAttachment.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/generatedMessageAttachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/headerFieldFactory.hpp b/vmime/headerFieldFactory.hpp
+--- a/vmime/headerFieldFactory.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/headerFieldFactory.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/headerField.hpp b/vmime/headerField.hpp
+--- a/vmime/headerField.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/headerField.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/headerFieldValue.hpp b/vmime/headerFieldValue.hpp
+--- a/vmime/headerFieldValue.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/headerFieldValue.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/header.hpp b/vmime/header.hpp
+--- a/vmime/header.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/header.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/htmlTextPart.hpp b/vmime/htmlTextPart.hpp
+--- a/vmime/htmlTextPart.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/htmlTextPart.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mailboxField.hpp b/vmime/mailboxField.hpp
+--- a/vmime/mailboxField.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/mailboxField.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mailboxGroup.hpp b/vmime/mailboxGroup.hpp
+--- a/vmime/mailboxGroup.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mailboxGroup.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mailbox.hpp b/vmime/mailbox.hpp
+--- a/vmime/mailbox.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/mailbox.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mailboxList.hpp b/vmime/mailboxList.hpp
+--- a/vmime/mailboxList.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mailboxList.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mdn/MDNHelper.hpp b/vmime/mdn/MDNHelper.hpp
+--- a/vmime/mdn/MDNHelper.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mdn/MDNHelper.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mdn/MDNInfos.hpp b/vmime/mdn/MDNInfos.hpp
+--- a/vmime/mdn/MDNInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mdn/MDNInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mdn/receivedMDNInfos.hpp b/vmime/mdn/receivedMDNInfos.hpp
+--- a/vmime/mdn/receivedMDNInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mdn/receivedMDNInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mdn/sendableMDNInfos.hpp b/vmime/mdn/sendableMDNInfos.hpp
+--- a/vmime/mdn/sendableMDNInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mdn/sendableMDNInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/mediaType.hpp b/vmime/mediaType.hpp
+--- a/vmime/mediaType.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/mediaType.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/messageAttachment.hpp b/vmime/messageAttachment.hpp
+--- a/vmime/messageAttachment.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/messageAttachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/messageBuilder.hpp b/vmime/messageBuilder.hpp
+--- a/vmime/messageBuilder.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/messageBuilder.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/message.hpp b/vmime/message.hpp
+--- a/vmime/message.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/message.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/messageId.hpp b/vmime/messageId.hpp
+--- a/vmime/messageId.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/messageId.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/messageIdSequence.hpp b/vmime/messageIdSequence.hpp
+--- a/vmime/messageIdSequence.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/messageIdSequence.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/messageParser.hpp b/vmime/messageParser.hpp
+--- a/vmime/messageParser.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/messageParser.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/misc/importanceHelper.hpp b/vmime/misc/importanceHelper.hpp
+--- a/vmime/misc/importanceHelper.hpp	2008-10-12 11:12:23.000000000 +0200
++++ b/vmime/misc/importanceHelper.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/connectionInfos.hpp b/vmime/net/connectionInfos.hpp
+--- a/vmime/net/connectionInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/connectionInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/defaultConnectionInfos.hpp b/vmime/net/defaultConnectionInfos.hpp
+--- a/vmime/net/defaultConnectionInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/defaultConnectionInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/events.hpp b/vmime/net/events.hpp
+--- a/vmime/net/events.hpp	2008-10-12 11:25:06.000000000 +0200
++++ b/vmime/net/events.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/folder.hpp b/vmime/net/folder.hpp
+--- a/vmime/net/folder.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/folder.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp
+--- a/vmime/net/imap/IMAPConnection.hpp	2008-10-12 11:28:12.000000000 +0200
++++ b/vmime/net/imap/IMAPConnection.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -96,6 +96,8 @@
+ 	bool isSecuredConnection() const;
+ 	ref <connectionInfos> getConnectionInfos() const;
+ 
++	ref <const socket> getSocket() const;
++
+ private:
+ 
+ 	void authenticate();
+diff -urN a/vmime/net/imap/IMAPFolder.hpp b/vmime/net/imap/IMAPFolder.hpp
+--- a/vmime/net/imap/IMAPFolder.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPFolder.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
+--- a/vmime/net/imap/IMAPMessage.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPMessage.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp
+--- a/vmime/net/imap/IMAPParser.hpp	2008-10-12 15:50:19.000000000 +0200
++++ b/vmime/net/imap/IMAPParser.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPServiceInfos.hpp b/vmime/net/imap/IMAPServiceInfos.hpp
+--- a/vmime/net/imap/IMAPServiceInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPServiceInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPSStore.hpp b/vmime/net/imap/IMAPSStore.hpp
+--- a/vmime/net/imap/IMAPSStore.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPSStore.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPStore.hpp b/vmime/net/imap/IMAPStore.hpp
+--- a/vmime/net/imap/IMAPStore.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPStore.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPTag.hpp b/vmime/net/imap/IMAPTag.hpp
+--- a/vmime/net/imap/IMAPTag.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPTag.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/imap/IMAPUtils.hpp b/vmime/net/imap/IMAPUtils.hpp
+--- a/vmime/net/imap/IMAPUtils.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/imap/IMAPUtils.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/format/courierMaildirFormat.hpp b/vmime/net/maildir/format/courierMaildirFormat.hpp
+--- a/vmime/net/maildir/format/courierMaildirFormat.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/format/courierMaildirFormat.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/format/kmailMaildirFormat.hpp b/vmime/net/maildir/format/kmailMaildirFormat.hpp
+--- a/vmime/net/maildir/format/kmailMaildirFormat.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/format/kmailMaildirFormat.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/maildirFolder.hpp b/vmime/net/maildir/maildirFolder.hpp
+--- a/vmime/net/maildir/maildirFolder.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/maildirFolder.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/maildirFormat.hpp b/vmime/net/maildir/maildirFormat.hpp
+--- a/vmime/net/maildir/maildirFormat.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/maildirFormat.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -55,7 +55,7 @@
+ 
+ 	private:
+ 
+-		ref <maildirStore> m_store;
++		weak_ref <maildirStore> m_store;
+ 	};
+ 
+ 
+diff -urN a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp
+--- a/vmime/net/maildir/maildirMessage.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/maildirMessage.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/maildirServiceInfos.hpp b/vmime/net/maildir/maildirServiceInfos.hpp
+--- a/vmime/net/maildir/maildirServiceInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/maildirServiceInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/maildirStore.hpp b/vmime/net/maildir/maildirStore.hpp
+--- a/vmime/net/maildir/maildirStore.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/maildirStore.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/maildir/maildirUtils.hpp b/vmime/net/maildir/maildirUtils.hpp
+--- a/vmime/net/maildir/maildirUtils.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/maildir/maildirUtils.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/message.hpp b/vmime/net/message.hpp
+--- a/vmime/net/message.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/message.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/pop3/POP3Folder.hpp b/vmime/net/pop3/POP3Folder.hpp
+--- a/vmime/net/pop3/POP3Folder.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/pop3/POP3Folder.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
+--- a/vmime/net/pop3/POP3Message.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/pop3/POP3Message.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/pop3/POP3ServiceInfos.hpp b/vmime/net/pop3/POP3ServiceInfos.hpp
+--- a/vmime/net/pop3/POP3ServiceInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/pop3/POP3ServiceInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/pop3/POP3SStore.hpp b/vmime/net/pop3/POP3SStore.hpp
+--- a/vmime/net/pop3/POP3SStore.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/pop3/POP3SStore.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/pop3/POP3Store.hpp b/vmime/net/pop3/POP3Store.hpp
+--- a/vmime/net/pop3/POP3Store.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/pop3/POP3Store.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/pop3/POP3Utils.hpp b/vmime/net/pop3/POP3Utils.hpp
+--- a/vmime/net/pop3/POP3Utils.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/pop3/POP3Utils.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/securedConnectionInfos.hpp b/vmime/net/securedConnectionInfos.hpp
+--- a/vmime/net/securedConnectionInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/securedConnectionInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/sendmail/sendmailServiceInfos.hpp b/vmime/net/sendmail/sendmailServiceInfos.hpp
+--- a/vmime/net/sendmail/sendmailServiceInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/sendmail/sendmailServiceInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/sendmail/sendmailTransport.hpp b/vmime/net/sendmail/sendmailTransport.hpp
+--- a/vmime/net/sendmail/sendmailTransport.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/sendmail/sendmailTransport.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/serviceFactory.hpp b/vmime/net/serviceFactory.hpp
+--- a/vmime/net/serviceFactory.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/serviceFactory.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/service.hpp b/vmime/net/service.hpp
+--- a/vmime/net/service.hpp	2008-10-12 10:58:53.000000000 +0200
++++ b/vmime/net/service.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/serviceInfos.hpp b/vmime/net/serviceInfos.hpp
+--- a/vmime/net/serviceInfos.hpp	2008-10-12 10:58:26.000000000 +0200
++++ b/vmime/net/serviceInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/session.hpp b/vmime/net/session.hpp
+--- a/vmime/net/session.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/session.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/smtp/SMTPResponse.hpp b/vmime/net/smtp/SMTPResponse.hpp
+--- a/vmime/net/smtp/SMTPResponse.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/smtp/SMTPResponse.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/smtp/SMTPServiceInfos.hpp b/vmime/net/smtp/SMTPServiceInfos.hpp
+--- a/vmime/net/smtp/SMTPServiceInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/smtp/SMTPServiceInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/smtp/SMTPSTransport.hpp b/vmime/net/smtp/SMTPSTransport.hpp
+--- a/vmime/net/smtp/SMTPSTransport.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/smtp/SMTPSTransport.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/smtp/SMTPTransport.hpp b/vmime/net/smtp/SMTPTransport.hpp
+--- a/vmime/net/smtp/SMTPTransport.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/smtp/SMTPTransport.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/socket.hpp b/vmime/net/socket.hpp
+--- a/vmime/net/socket.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/socket.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -41,6 +41,11 @@
+ 
+ 	virtual ~socket() { }
+ 
++	/** Type used for lengths in streams.
++	  */
++	typedef int size_type;
++
++
+ 	/** Connect to the specified address and port.
+ 	  *
+ 	  * @param address server address (this can be a full qualified domain name
+@@ -71,7 +76,7 @@
+ 	  * @param count maximum number of bytes to receive (size of buffer)
+ 	  * @return number of bytes received/written into output buffer
+ 	  */
+-	virtual int receiveRaw(char* buffer, const int count) = 0;
++	virtual int receiveRaw(char* buffer, const size_type count) = 0;
+ 
+ 	/** Send (text) data to the socket.
+ 	  *
+@@ -84,7 +89,14 @@
+ 	  * @param buffer data to send
+ 	  * @param count number of bytes to send (size of buffer)
+ 	  */
+-	virtual void sendRaw(const char* buffer, const int count) = 0;
++	virtual void sendRaw(const char* buffer, const size_type count) = 0;
++
++	/** Return the preferred maximum block size when reading
++	  * from or writing to this stream.
++	  *
++	  * @return block size, in bytes
++	  */
++	virtual size_type getBlockSize() const = 0;
+ 
+ protected:
+ 
+diff -urN a/vmime/net/store.hpp b/vmime/net/store.hpp
+--- a/vmime/net/store.hpp	2008-10-12 11:29:46.000000000 +0200
++++ b/vmime/net/store.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/timeoutHandler.hpp b/vmime/net/timeoutHandler.hpp
+--- a/vmime/net/timeoutHandler.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/timeoutHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
+--- a/vmime/net/tls/TLSSecuredConnectionInfos.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/tls/TLSSecuredConnectionInfos.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/tls/TLSSession.hpp b/vmime/net/tls/TLSSession.hpp
+--- a/vmime/net/tls/TLSSession.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/tls/TLSSession.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/net/tls/TLSSocket.hpp b/vmime/net/tls/TLSSocket.hpp
+--- a/vmime/net/tls/TLSSocket.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/net/tls/TLSSocket.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -84,10 +84,12 @@
+ 	bool isConnected() const;
+ 
+ 	void receive(string& buffer);
+-	int receiveRaw(char* buffer, const int count);
++	size_type receiveRaw(char* buffer, const size_type count);
+ 
+ 	void send(const string& buffer);
+-	void sendRaw(const char* buffer, const int count);
++	void sendRaw(const char* buffer, const size_type count);
++
++	size_type getBlockSize() const;
+ 
+ private:
+ 
+diff -urN a/vmime/net/transport.hpp b/vmime/net/transport.hpp
+--- a/vmime/net/transport.hpp	2008-10-12 11:29:56.000000000 +0200
++++ b/vmime/net/transport.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/object.hpp b/vmime/object.hpp
+--- a/vmime/object.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/object.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/options.hpp b/vmime/options.hpp
+--- a/vmime/options.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/options.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/parameter.hpp b/vmime/parameter.hpp
+--- a/vmime/parameter.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/parameter.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.hpp
+--- a/vmime/parameterizedHeaderField.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/parameterizedHeaderField.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/parsedMessageAttachment.hpp b/vmime/parsedMessageAttachment.hpp
+--- a/vmime/parsedMessageAttachment.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/parsedMessageAttachment.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/parserHelpers.hpp b/vmime/parserHelpers.hpp
+--- a/vmime/parserHelpers.hpp	2008-10-12 10:57:27.000000000 +0200
++++ b/vmime/parserHelpers.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/path.hpp b/vmime/path.hpp
+--- a/vmime/path.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/path.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/plainTextPart.hpp b/vmime/plainTextPart.hpp
+--- a/vmime/plainTextPart.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/plainTextPart.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/platform.hpp b/vmime/platform.hpp
+--- a/vmime/platform.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/platform.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -108,7 +108,7 @@
+ 		  *
+ 		  * @return socket factory
+ 		  */
+-		virtual ref <net::socketFactory> getSocketFactory() const = 0;
++		virtual ref <net::socketFactory> getSocketFactory() = 0;
+ #endif
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+@@ -116,14 +116,14 @@
+ 		  *
+ 		  * @return file-system factory
+ 		  */
+-		virtual utility::fileSystemFactory* getFileSystemFactory() const = 0;
++		virtual ref <utility::fileSystemFactory> getFileSystemFactory() = 0;
+ 
+ 		/** Return a pointer to a factory that creates child process objects,
+ 		  * which are used to spawn processes (run executable files).
+ 		  *
+ 		  * @return child process factory
+ 		  */
+-		virtual utility::childProcessFactory* getChildProcessFactory() const = 0;
++		virtual ref <utility::childProcessFactory> getChildProcessFactory() = 0;
+ #endif
+ 
+ 	};
+@@ -135,7 +135,7 @@
+ 		sm_handler = vmime::create <TYPE>();
+ 	}
+ 
+-	static ref <const handler> getHandler()
++	static ref <handler> getHandler()
+ 	{
+ 		if (!sm_handler)
+ 			throw exceptions::no_platform_handler();
+diff -urN a/vmime/platforms/posix/posixChildProcess.hpp b/vmime/platforms/posix/posixChildProcess.hpp
+--- a/vmime/platforms/posix/posixChildProcess.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/platforms/posix/posixChildProcess.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/platforms/posix/posixFile.hpp b/vmime/platforms/posix/posixFile.hpp
+--- a/vmime/platforms/posix/posixFile.hpp	2008-10-12 11:41:34.000000000 +0200
++++ b/vmime/platforms/posix/posixFile.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp
+--- a/vmime/platforms/posix/posixHandler.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/platforms/posix/posixHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -61,13 +61,13 @@
+ 	unsigned int getProcessId() const;
+ 
+ #if VMIME_HAVE_MESSAGING_FEATURES
+-	ref <vmime::net::socketFactory> getSocketFactory() const;
++	ref <vmime::net::socketFactory> getSocketFactory();
+ #endif
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+-	vmime::utility::fileSystemFactory* getFileSystemFactory() const;
++	ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
+ 
+-	vmime::utility::childProcessFactory* getChildProcessFactory() const;
++	ref <vmime::utility::childProcessFactory> getChildProcessFactory();
+ #endif
+ 
+ 	void wait() const;
+@@ -79,8 +79,8 @@
+ #endif
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+-	posixFileSystemFactory* m_fileSysFactory;
+-	posixChildProcessFactory* m_childProcFactory;
++	ref <posixFileSystemFactory> m_fileSysFactory;
++	ref <posixChildProcessFactory> m_childProcFactory;
+ #endif
+ };
+ 
+diff -urN a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixSocket.hpp
+--- a/vmime/platforms/posix/posixSocket.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/platforms/posix/posixSocket.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -48,10 +48,12 @@
+ 	void disconnect();
+ 
+ 	void receive(vmime::string& buffer);
+-	int receiveRaw(char* buffer, const int count);
++	size_type receiveRaw(char* buffer, const size_type count);
+ 
+ 	void send(const vmime::string& buffer);
+-	void sendRaw(const char* buffer, const int count);
++	void sendRaw(const char* buffer, const size_type count);
++
++	size_type getBlockSize() const;
+ 
+ protected:
+ 
+diff -urN a/vmime/platforms/windows/windowsFile.hpp b/vmime/platforms/windows/windowsFile.hpp
+--- a/vmime/platforms/windows/windowsFile.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/platforms/windows/windowsFile.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -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,
+@@ -73,7 +73,7 @@
+ 	bool canRead() const;
+ 	bool canWrite() const;
+ 
+-	const length_type getLength();
++	length_type getLength();
+ 
+ 	const path& getFullPath() const;
+ 
+diff -urN a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp
+--- a/vmime/platforms/windows/windowsHandler.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/platforms/windows/windowsHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -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,
+@@ -60,13 +60,13 @@
+ 	unsigned int getProcessId() const;
+ 
+ #if VMIME_HAVE_MESSAGING_FEATURES
+-	ref <vmime::net::socketFactory> getSocketFactory() const;
++	ref <vmime::net::socketFactory> getSocketFactory();
+ #endif
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+-	vmime::utility::fileSystemFactory* getFileSystemFactory() const;
++	ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
+ 
+-	vmime::utility::childProcessFactory* getChildProcessFactory() const;
++	ref <vmime::utility::childProcessFactory> getChildProcessFactory();
+ #endif
+ 
+ 	void wait() const;
+@@ -78,7 +78,7 @@
+ #endif
+ 
+ #if VMIME_HAVE_FILESYSTEM_FEATURES
+-	windowsFileSystemFactory* m_fileSysFactory;
++	ref <windowsFileSystemFactory> m_fileSysFactory;
+ #endif
+ };
+ 
+diff -urN a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/windowsSocket.hpp
+--- a/vmime/platforms/windows/windowsSocket.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/platforms/windows/windowsSocket.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -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,
+@@ -50,10 +50,12 @@
+ 	void disconnect();
+ 
+ 	void receive(vmime::string& buffer);
+-	int receiveRaw(char* buffer, const int count);
++	size_type receiveRaw(char* buffer, const size_type count);
+ 
+ 	void send(const vmime::string& buffer);
+-	void sendRaw(const char* buffer, const int count);
++	void sendRaw(const char* buffer, const size_type count);
++
++	size_type getBlockSize() const;
+ 
+ private:
+ 
+diff -urN a/vmime/propertySet.hpp b/vmime/propertySet.hpp
+--- a/vmime/propertySet.hpp	2008-10-12 10:58:07.000000000 +0200
++++ b/vmime/propertySet.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -432,7 +432,7 @@
+ 
+ #ifndef VMIME_INLINE_TEMPLATE_SPECIALIZATION
+ 
+-template <> void propertySet::property::setValue(const string& value);
++template <> void propertySet::property::setValue <string>(const string& value);
+ template <> void propertySet::property::setValue(const bool& value);
+ 
+ template <> string propertySet::property::getValue() const;
+diff -urN a/vmime/relay.hpp b/vmime/relay.hpp
+--- a/vmime/relay.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/relay.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/authenticator.hpp b/vmime/security/authenticator.hpp
+--- a/vmime/security/authenticator.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/authenticator.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/cert/certificateChain.hpp b/vmime/security/cert/certificateChain.hpp
+--- a/vmime/security/cert/certificateChain.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/cert/certificateChain.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/cert/certificate.hpp b/vmime/security/cert/certificate.hpp
+--- a/vmime/security/cert/certificate.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/cert/certificate.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/cert/certificateVerifier.hpp b/vmime/security/cert/certificateVerifier.hpp
+--- a/vmime/security/cert/certificateVerifier.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/cert/certificateVerifier.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/cert/defaultCertificateVerifier.hpp b/vmime/security/cert/defaultCertificateVerifier.hpp
+--- a/vmime/security/cert/defaultCertificateVerifier.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/cert/defaultCertificateVerifier.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/cert/X509Certificate.hpp b/vmime/security/cert/X509Certificate.hpp
+--- a/vmime/security/cert/X509Certificate.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/cert/X509Certificate.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/defaultAuthenticator.hpp b/vmime/security/defaultAuthenticator.hpp
+--- a/vmime/security/defaultAuthenticator.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/defaultAuthenticator.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/digest/md5/md5MessageDigest.hpp b/vmime/security/digest/md5/md5MessageDigest.hpp
+--- a/vmime/security/digest/md5/md5MessageDigest.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/digest/md5/md5MessageDigest.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/digest/messageDigestFactory.hpp b/vmime/security/digest/messageDigestFactory.hpp
+--- a/vmime/security/digest/messageDigestFactory.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/digest/messageDigestFactory.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/digest/messageDigest.hpp b/vmime/security/digest/messageDigest.hpp
+--- a/vmime/security/digest/messageDigest.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/digest/messageDigest.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/digest/sha1/sha1MessageDigest.hpp b/vmime/security/digest/sha1/sha1MessageDigest.hpp
+--- a/vmime/security/digest/sha1/sha1MessageDigest.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/digest/sha1/sha1MessageDigest.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/builtinSASLMechanism.hpp b/vmime/security/sasl/builtinSASLMechanism.hpp
+--- a/vmime/security/sasl/builtinSASLMechanism.hpp	2008-10-12 11:37:42.000000000 +0200
++++ b/vmime/security/sasl/builtinSASLMechanism.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sasl/defaultSASLAuthenticator.hpp
+--- a/vmime/security/sasl/defaultSASLAuthenticator.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/sasl/defaultSASLAuthenticator.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/SASLAuthenticator.hpp b/vmime/security/sasl/SASLAuthenticator.hpp
+--- a/vmime/security/sasl/SASLAuthenticator.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/sasl/SASLAuthenticator.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/SASLContext.hpp b/vmime/security/sasl/SASLContext.hpp
+--- a/vmime/security/sasl/SASLContext.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/sasl/SASLContext.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/SASLMechanismFactory.hpp b/vmime/security/sasl/SASLMechanismFactory.hpp
+--- a/vmime/security/sasl/SASLMechanismFactory.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/sasl/SASLMechanismFactory.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/SASLMechanism.hpp b/vmime/security/sasl/SASLMechanism.hpp
+--- a/vmime/security/sasl/SASLMechanism.hpp	2008-10-12 11:31:17.000000000 +0200
++++ b/vmime/security/sasl/SASLMechanism.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/SASLSession.hpp b/vmime/security/sasl/SASLSession.hpp
+--- a/vmime/security/sasl/SASLSession.hpp	2008-10-12 11:31:38.000000000 +0200
++++ b/vmime/security/sasl/SASLSession.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.hpp
+--- a/vmime/security/sasl/SASLSocket.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/security/sasl/SASLSocket.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -53,10 +53,12 @@
+ 	bool isConnected() const;
+ 
+ 	void receive(string& buffer);
+-	int receiveRaw(char* buffer, const int count);
++	size_type receiveRaw(char* buffer, const size_type count);
+ 
+ 	void send(const string& buffer);
+-	void sendRaw(const char* buffer, const int count);
++	void sendRaw(const char* buffer, const size_type count);
++
++	size_type getBlockSize() const;
+ 
+ private:
+ 
+diff -urN a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
+--- a/vmime/streamContentHandler.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/streamContentHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
+--- a/vmime/stringContentHandler.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/stringContentHandler.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/text.hpp b/vmime/text.hpp
+--- a/vmime/text.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/text.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -129,10 +129,6 @@
+ 	  */
+ 	const std::vector <ref <word> > getWordList();
+ 
+-	// Decoding
+-#if VMIME_WIDE_CHAR_SUPPORT
+-	const wstring getDecodedText() const;
+-#endif
+ 
+ 	/** Return the text converted into the specified charset.
+ 	  * The encoded-words are decoded and then converted in the
+@@ -197,7 +193,8 @@
+ 
+ 		FORCE_NO_ENCODING = (1 << 0),    /**< Just fold lines, don't encode them. */
+ 		FORCE_ENCODING = (1 << 1),       /**< Encode lines even if they are plain ASCII text. */
+-		NO_NEW_LINE_SEQUENCE = (1 << 2)  /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
++		NO_NEW_LINE_SEQUENCE = (1 << 2), /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
++		QUOTE_IF_POSSIBLE = (1 << 3)     /**< Use quoting instead of encoding when possible (even if FORCE_ENCODING is specified). */
+ 	};
+ 
+ 	/** Encode and fold text in respect to RFC-2047.
+diff -urN a/vmime/textPartFactory.hpp b/vmime/textPartFactory.hpp
+--- a/vmime/textPartFactory.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/textPartFactory.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/textPart.hpp b/vmime/textPart.hpp
+--- a/vmime/textPart.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/textPart.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/types.hpp b/vmime/types.hpp
+--- a/vmime/types.hpp	2008-10-12 10:54:34.000000000 +0200
++++ b/vmime/types.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -36,9 +36,6 @@
+ namespace vmime
+ {
+ 	typedef std::string string;
+-#if VMIME_WIDE_CHAR_SUPPORT
+-	typedef std::wstring wstring;
+-#endif
+ 
+ 	typedef unsigned short port_t;
+ 
+diff -urN a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp
+--- a/vmime/utility/childProcess.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/childProcess.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -85,7 +85,7 @@
+ /** Create 'childProcess' objects.
+   */
+ 
+-class childProcessFactory
++class childProcessFactory : public object
+ {
+ public:
+ 
+diff -urN a/vmime/utility/datetimeUtils.hpp b/vmime/utility/datetimeUtils.hpp
+--- a/vmime/utility/datetimeUtils.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/datetimeUtils.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -84,9 +84,11 @@
+ 	  * @param year year in 4-digit format
+ 	  * @param month month (1-12), January is 1, December is 12 (see datetime::Months enum)
+ 	  * @param day month day (1-31)
++	  * @param iso if TRUE, use ISO week-numbering year (default is to use calendar year).
++	  * For more information, read here: http://en.wikipedia.org/wiki/ISO_8601#Week_dates
+ 	  * @return the week number (1 is the first week of the year)
+ 	  */
+-	static int getWeekOfYear(const int year, const int month, const int day);
++	static int getWeekOfYear(const int year, const int month, const int day, const bool iso = false);
+ };
+ 
+ 
+diff -urN a/vmime/utility/encoder/b64Encoder.hpp b/vmime/utility/encoder/b64Encoder.hpp
+--- a/vmime/utility/encoder/b64Encoder.hpp	2008-10-12 15:39:13.000000000 +0200
++++ b/vmime/utility/encoder/b64Encoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/binaryEncoder.hpp b/vmime/utility/encoder/binaryEncoder.hpp
+--- a/vmime/utility/encoder/binaryEncoder.hpp	2008-10-12 15:27:36.000000000 +0200
++++ b/vmime/utility/encoder/binaryEncoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/defaultEncoder.hpp b/vmime/utility/encoder/defaultEncoder.hpp
+--- a/vmime/utility/encoder/defaultEncoder.hpp	2008-10-12 15:48:42.000000000 +0200
++++ b/vmime/utility/encoder/defaultEncoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/eightBitEncoder.hpp b/vmime/utility/encoder/eightBitEncoder.hpp
+--- a/vmime/utility/encoder/eightBitEncoder.hpp	2008-10-12 15:22:29.000000000 +0200
++++ b/vmime/utility/encoder/eightBitEncoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/encoderFactory.hpp b/vmime/utility/encoder/encoderFactory.hpp
+--- a/vmime/utility/encoder/encoderFactory.hpp	2008-10-12 15:11:07.000000000 +0200
++++ b/vmime/utility/encoder/encoderFactory.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/encoder.hpp b/vmime/utility/encoder/encoder.hpp
+--- a/vmime/utility/encoder/encoder.hpp	2008-10-12 15:12:28.000000000 +0200
++++ b/vmime/utility/encoder/encoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/qpEncoder.hpp b/vmime/utility/encoder/qpEncoder.hpp
+--- a/vmime/utility/encoder/qpEncoder.hpp	2008-10-12 15:32:02.000000000 +0200
++++ b/vmime/utility/encoder/qpEncoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/sevenBitEncoder.hpp b/vmime/utility/encoder/sevenBitEncoder.hpp
+--- a/vmime/utility/encoder/sevenBitEncoder.hpp	2008-10-12 15:22:12.000000000 +0200
++++ b/vmime/utility/encoder/sevenBitEncoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/encoder/uuEncoder.hpp b/vmime/utility/encoder/uuEncoder.hpp
+--- a/vmime/utility/encoder/uuEncoder.hpp	2008-10-12 15:36:17.000000000 +0200
++++ b/vmime/utility/encoder/uuEncoder.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/file.hpp b/vmime/utility/file.hpp
+--- a/vmime/utility/file.hpp	2008-10-12 11:00:26.000000000 +0200
++++ b/vmime/utility/file.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -214,7 +214,7 @@
+ /** Constructs 'file' objects.
+   */
+ 
+-class fileSystemFactory
++class fileSystemFactory : public object
+ {
+ public:
+ 
+diff -urN a/vmime/utility/filteredStream.hpp b/vmime/utility/filteredStream.hpp
+--- a/vmime/utility/filteredStream.hpp	2008-10-12 10:59:33.000000000 +0200
++++ b/vmime/utility/filteredStream.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -41,6 +41,8 @@
+ {
+ public:
+ 
++	virtual size_type getBlockSize();
++
+ 	/** Return a reference to the stream being filtered.
+ 	  *
+ 	  * @return stream being filtered
+@@ -56,6 +58,8 @@
+ {
+ public:
+ 
++	virtual size_type getBlockSize();
++
+ 	/** Return a reference to the stream being filtered.
+ 	  *
+ 	  * @return destination stream for filtered data
+diff -urN a/vmime/utility/path.hpp b/vmime/utility/path.hpp
+--- a/vmime/utility/path.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/path.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/progressListener.hpp b/vmime/utility/progressListener.hpp
+--- a/vmime/utility/progressListener.hpp	2008-10-12 10:54:32.000000000 +0200
++++ b/vmime/utility/progressListener.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/random.hpp b/vmime/utility/random.hpp
+--- a/vmime/utility/random.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/random.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/smartPtr.hpp b/vmime/utility/smartPtr.hpp
+--- a/vmime/utility/smartPtr.hpp	2008-10-12 10:55:33.000000000 +0200
++++ b/vmime/utility/smartPtr.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/smartPtrInt.hpp b/vmime/utility/smartPtrInt.hpp
+--- a/vmime/utility/smartPtrInt.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/smartPtrInt.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/stream.hpp b/vmime/utility/stream.hpp
+--- a/vmime/utility/stream.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/stream.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -77,7 +77,7 @@
+ 	  *
+ 	  * @return block size, in bytes
+ 	  */
+-	virtual size_type getBlockSize() const;
++	virtual size_type getBlockSize();
+ };
+ 
+ 
+@@ -239,6 +239,7 @@
+ 	void write(const value_type* const data, const size_type count);
+ 	void flush();
+ 
++size_type getBlockSize(){return 8192;}
+ private:
+ 
+ 	string& m_buffer;
+@@ -402,7 +403,7 @@
+ 	void write(const value_type* const data, const size_type count);
+ 	void flush();
+ 
+-	size_type getBlockSize() const;
++	size_type getBlockSize();
+ 
+ private:
+ 
+@@ -426,7 +427,7 @@
+ 	size_type read(value_type* const data, const size_type count);
+ 	size_type skip(const size_type count);
+ 
+-	size_type getBlockSize() const;
++	size_type getBlockSize();
+ 
+ private:
+ 
+diff -urN a/vmime/utility/stringProxy.hpp b/vmime/utility/stringProxy.hpp
+--- a/vmime/utility/stringProxy.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/stringProxy.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/stringUtils.hpp b/vmime/utility/stringUtils.hpp
+--- a/vmime/utility/stringUtils.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/stringUtils.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/url.hpp b/vmime/utility/url.hpp
+--- a/vmime/utility/url.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/url.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/utility/urlUtils.hpp b/vmime/utility/urlUtils.hpp
+--- a/vmime/utility/urlUtils.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/utility/urlUtils.hpp	2010-02-09 14:34:53.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/vmime.hpp b/vmime/vmime.hpp
+--- a/vmime/vmime.hpp	2008-10-12 15:14:17.000000000 +0200
++++ b/vmime/vmime.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
+--- a/vmime/wordEncoder.hpp	2008-10-12 15:46:34.000000000 +0200
++++ b/vmime/wordEncoder.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+diff -urN a/vmime/word.hpp b/vmime/word.hpp
+--- a/vmime/word.hpp	2008-10-12 10:54:33.000000000 +0200
++++ b/vmime/word.hpp	2010-02-09 14:34:54.000000000 +0100
+@@ -1,10 +1,10 @@
+ //
+ // VMime library (http://www.vmime.org)
+-// Copyright (C) 2002-2008 Vincent Richard <vincent@vincent-richard.net>
++// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
+ //
+ // This program is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License as
+-// published by the Free Software Foundation; either version 2 of
++// published by the Free Software Foundation; either version 3 of
+ // the License, or (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+@@ -60,6 +60,12 @@
+ 	  */
+ 	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
+@@ -85,10 +91,6 @@
+ 	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
+diff -urN a/vmime.vcproj b/vmime.vcproj
+--- a/vmime.vcproj	2008-10-19 14:36:21.000000000 +0200
++++ b/vmime.vcproj	2010-02-10 11:06:52.000000000 +0100
+@@ -287,6 +287,7 @@
+ </Filter>
+ </Filter>
+ <File RelativePath=".\vmime\parameterizedHeaderField.hpp"/>
++<File RelativePath=".\vmime\word.hpp"/>
+ <Filter Name="misc">
+ <File RelativePath=".\vmime\misc\importanceHelper.hpp"/>
+ </Filter>
+@@ -463,7 +464,6 @@
+ <File RelativePath=".\vmime\parameter.hpp"/>
+ <File RelativePath=".\vmime\constants.hpp"/>
+ <File RelativePath=".\vmime\component.hpp"/>
+-<File RelativePath=".\vmime\word.hpp"/>
+ <Filter Name="mdn">
+ <File RelativePath=".\vmime\mdn\sendableMDNInfos.hpp"/>
+ <File RelativePath=".\vmime\mdn\receivedMDNInfos.hpp"/>
--- a/src/vmime-win32.patch	Thu Feb 11 23:55:39 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,485 +0,0 @@
-This file is part of mingw-cross-env.
-See doc/index.html for further information.
-
-diff -urN a/configure.in c/configure.in
---- libvmime-0.9.0.orig/configure.in	2008-10-19 14:36:08.000000000 +0200
-+++ libvmime-0.9.0/configure.in	2009-12-04 14:55:17.000000000 +0100
-@@ -125,7 +125,7 @@
- $CXX -c $CFLAGS $CPPFLAGS mytest.$ac_ext >&5
- sh libtool --mode=link $CXX -o mytest mytest.o libtest.la >&5 2>/dev/null
- 
--if test -x mytest; then
-+if test -x mytest -a "$cross_compiling" != yes; then
- 	myresult=`./mytest`
- 	if test "X$myresult" = "XPASS"; then
- 		AC_MSG_RESULT(yes)
-@@ -369,7 +369,7 @@
- 
- if test "x$conf_tls" = "xyes"; then
- 	# -- GNU TLS Library (http://www.gnu.org/software/gnutls/)
--	AM_PATH_LIBGNUTLS(1.2.0, have_gnutls=yes, have_gnutls=no)
-+	PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0], have_gnutls=yes, have_gnutls=no)
- 
- 	if test "x$have_gnutls" = "xyes"; then
- 		AM_CONDITIONAL(VMIME_HAVE_TLS_SUPPORT, true)
-@@ -524,7 +524,7 @@
- 
- # -- pthreads (POSIX)
- 
--ACX_PTHREAD([VMIME_ADDITIONAL_DEFINES="$VMIME_ADDITIONAL_DEFINES HAVE_PTHREAD"])
-+AX_PTHREAD([VMIME_ADDITIONAL_DEFINES="$VMIME_ADDITIONAL_DEFINES HAVE_PTHREAD"])
- 
- 
- if test "x$VMIME_DETECT_PLATFORM" = "xwindows"; then
-@@ -654,10 +654,10 @@
- AC_TRY_COMPILE(,,echo yes,echo no; EXTRA_CFLAGS="$OLD_EXTRA_CFLAGS")
- 
- # -ansi
--OLD_EXTRA_CFLAGS="$EXTRA_CFLAGS"
--EXTRA_CFLAGS="$EXTRA_CFLAGS -ansi"
--AC_MSG_CHECKING(whether cc accepts -ansi)
--AC_TRY_COMPILE(,,echo yes,echo no; EXTRA_CFLAGS="$OLD_EXTRA_CFLAGS")
-+#OLD_EXTRA_CFLAGS="$EXTRA_CFLAGS"
-+#EXTRA_CFLAGS="$EXTRA_CFLAGS -ansi"
-+#AC_MSG_CHECKING(whether cc accepts -ansi)
-+#AC_TRY_COMPILE(,,echo yes,echo no; EXTRA_CFLAGS="$OLD_EXTRA_CFLAGS")
- 
- # -pedantic
- OLD_EXTRA_CFLAGS="$EXTRA_CFLAGS"
-diff -urN a/m4/m4_ax_pthread.m4 c/m4/m4_ax_pthread.m4
---- libvmime-0.9.0.orig/m4/m4_ax_pthread.m4	1970-01-01 01:00:00.000000000 +0100
-+++ libvmime-0.9.0/m4/m4_ax_pthread.m4	2009-12-04 14:55:17.000000000 +0100
-@@ -0,0 +1,272 @@
-+# ===========================================================================
-+#           http://www.nongnu.org/autoconf-archive/ax_pthread.html
-+# ===========================================================================
-+#
-+# SYNOPSIS
-+#
-+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-+#
-+# DESCRIPTION
-+#
-+#   This macro figures out how to build C programs using POSIX threads. It
-+#   sets the PTHREAD_LIBS output variable to the threads library and linker
-+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
-+#   flags that are needed. (The user can also force certain compiler
-+#   flags/libs to be tested by setting these environment variables.)
-+#
-+#   Also sets PTHREAD_CC to any special C compiler that is needed for
-+#   multi-threaded programs (defaults to the value of CC otherwise). (This
-+#   is necessary on AIX to use the special cc_r compiler alias.)
-+#
-+#   NOTE: You are assumed to not only compile your program with these flags,
-+#   but also link it with them as well. e.g. you should link with
-+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
-+#
-+#   If you are only building threads programs, you may wish to use these
-+#   variables in your default LIBS, CFLAGS, and CC:
-+#
-+#          LIBS="$PTHREAD_LIBS $LIBS"
-+#          CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-+#          CC="$PTHREAD_CC"
-+#
-+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
-+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
-+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-+#
-+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
-+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
-+#   is not found. If ACTION-IF-FOUND is not specified, the default action
-+#   will define HAVE_PTHREAD.
-+#
-+#   Please let the authors know if this macro fails on any platform, or if
-+#   you have any other suggestions or comments. This macro was based on work
-+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
-+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
-+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
-+#   grateful for the helpful feedback of numerous users.
-+#
-+# LICENSE
-+#
-+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
-+#
-+#   This program is free software: you can 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, see <http://www.gnu.org/licenses/>.
-+#
-+#   As a special exception, the respective Autoconf Macro's copyright owner
-+#   gives unlimited permission to copy, distribute and modify the configure
-+#   scripts that are the output of Autoconf when processing the Macro. You
-+#   need not follow the terms of the GNU General Public License when using
-+#   or distributing such scripts, even though portions of the text of the
-+#   Macro appear in them. The GNU General Public License (GPL) does govern
-+#   all other use of the material that constitutes the Autoconf Macro.
-+#
-+#   This special exception to the GPL applies to versions of the Autoconf
-+#   Macro released by the Autoconf Archive. When you make and distribute a
-+#   modified version of the Autoconf Macro, you may extend this special
-+#   exception to the GPL to apply to your modified version as well.
-+
-+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
-+AC_DEFUN([AX_PTHREAD], [
-+AC_REQUIRE([AC_CANONICAL_HOST])
-+AC_LANG_SAVE
-+AC_LANG_C
-+ax_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, ax_pthread_ok=yes)
-+        AC_MSG_RESULT($ax_pthread_ok)
-+        if test x"$ax_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.
-+
-+ax_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)
-+#      ... -mt is also the pthreads flag for HP/aCC
-+# 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 -pthreads/-mt/
-+        # -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:
-+
-+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
-+        ;;
-+esac
-+
-+if test x"$ax_pthread_ok" = xno; then
-+for flag in $ax_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(ax_pthread_config, pthread-config, yes, no)
-+		if test x"$ax_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); ],
-+                    [ax_pthread_ok=yes])
-+
-+        LIBS="$save_LIBS"
-+        CFLAGS="$save_CFLAGS"
-+
-+        AC_MSG_RESULT($ax_pthread_ok)
-+        if test "x$ax_pthread_ok" = xyes; then
-+                break;
-+        fi
-+
-+        PTHREAD_LIBS=""
-+        PTHREAD_CFLAGS=""
-+done
-+fi
-+
-+# Various other checks:
-+if test "x$ax_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; return 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 xlc_r or cc_r
-+	if test x"$GCC" != xyes; then
-+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
-+        else
-+          PTHREAD_CC=$CC
-+	fi
-+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"$ax_pthread_ok" = xyes; then
-+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
-+        :
-+else
-+        ax_pthread_ok=no
-+        $2
-+fi
-+AC_LANG_RESTORE
-+])dnl AX_PTHREAD
-diff -urN a/SConstruct c/SConstruct
---- libvmime-0.9.0.orig/SConstruct	2008-10-19 14:27:32.000000000 +0200
-+++ libvmime-0.9.0/SConstruct	2009-12-04 14:55:17.000000000 +0100
-@@ -1620,7 +1620,7 @@
- 
- if test "x$conf_tls" = "xyes"; then
- 	# -- GNU TLS Library (http://www.gnu.org/software/gnutls/)
--	AM_PATH_LIBGNUTLS(1.2.0, have_gnutls=yes, have_gnutls=no)
-+	PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0], have_gnutls=yes, have_gnutls=no)
- 
- 	if test "x$have_gnutls" = "xyes"; then
- 		AM_CONDITIONAL(VMIME_HAVE_TLS_SUPPORT, true)
-diff -urN a/src/mailbox.cpp c/src/mailbox.cpp
---- libvmime-0.9.0.orig/src/mailbox.cpp	2008-10-12 11:03:13.000000000 +0200
-+++ libvmime-0.9.0/src/mailbox.cpp	2009-12-04 14:56:38.000000000 +0100
-@@ -415,7 +415,7 @@
- 		bool newLine = true;
- 
- 		m_name.encodeAndFold(os, maxLineLength, pos, &pos,
--			forceEncode ? text::FORCE_ENCODING : 0);
-+			text::QUOTE_IF_POSSIBLE | (forceEncode ? text::FORCE_ENCODING : 0));
- 
- 		if (pos + m_email.length() + 3 > maxLineLength)
- 		{
-diff -urN a/src/platforms/posix/posixFile.cpp c/src/platforms/posix/posixFile.cpp
---- libvmime-0.9.0.orig/src/platforms/posix/posixFile.cpp	2008-10-12 11:42:23.000000000 +0200
-+++ libvmime-0.9.0/src/platforms/posix/posixFile.cpp	2009-12-04 16:00:23.000000000 +0100
-@@ -120,6 +120,8 @@
- {
- 	if (::write(m_fd, data, count) == -1)
- 		posixFileSystemFactory::reportError(m_path, errno);
-+
-+	m_eof = false;
- }
- 
- 
-@@ -166,7 +168,7 @@
- 	if ((c = ::read(m_fd, data, count)) == -1)
- 		posixFileSystemFactory::reportError(m_path, errno);
- 
--	if (c == 0)
-+	if (c == 0 && count != 0)
- 		m_eof = true;
- 
- 	return static_cast <size_type>(c);
-diff -urN a/src/platforms/windows/windowsFile.cpp c/src/platforms/windows/windowsFile.cpp
---- libvmime-0.9.0.orig/src/platforms/windows/windowsFile.cpp	2008-10-12 10:54:31.000000000 +0200
-+++ libvmime-0.9.0/src/platforms/windows/windowsFile.cpp	2009-12-04 14:55:17.000000000 +0100
-@@ -268,7 +268,7 @@
- 	return true;
- }
- 
--const windowsFile::length_type windowsFile::getLength()
-+windowsFile::length_type windowsFile::getLength()
- {
- 	HANDLE hFile = CreateFile(
- 		m_nativePath.c_str(),
-@@ -464,7 +464,7 @@
- 	SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
- }
- 
--const vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
-+vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
- {
- 	DWORD dwBytesRead;
- 	if (!ReadFile(m_hFile, (LPVOID)data, (DWORD)count, &dwBytesRead, NULL))
-@@ -472,7 +472,7 @@
- 	return dwBytesRead;
- }
- 
--const vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
-+vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
- {
- 	DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
- 	DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)count, NULL, FILE_CURRENT);
-diff -urN a/src/utility/stringUtils.cpp c/src/utility/stringUtils.cpp
---- libvmime-0.9.0.orig/src/utility/stringUtils.cpp	2008-10-12 11:11:24.000000000 +0200
-+++ libvmime-0.9.0/src/utility/stringUtils.cpp	2009-12-04 16:03:36.000000000 +0100
-@@ -142,7 +142,7 @@
- 	{
- 		if (parserHelpers::isAscii(*i))
- 		{
--			if (*i != '=' || *(i + 1) != '?') // To avoid bad behaviour...
-+			if (*i != '=' || ((i + 1) != end && *(i + 1) != '?')) // To avoid bad behaviour...
- 				++count;
- 		}
- 	}
-diff -urN a/src/word.cpp c/src/word.cpp
---- libvmime-0.9.0.orig/src/word.cpp	2008-10-12 15:45:39.000000000 +0200
-+++ libvmime-0.9.0/src/word.cpp	2009-12-04 14:56:38.000000000 +0100
-@@ -352,10 +352,22 @@
- 		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 -urN a/vmime/platforms/windows/windowsFile.hpp c/vmime/platforms/windows/windowsFile.hpp
---- libvmime-0.9.0.orig/vmime/platforms/windows/windowsFile.hpp	2008-10-12 10:54:33.000000000 +0200
-+++ libvmime-0.9.0/vmime/platforms/windows/windowsFile.hpp	2009-12-04 14:55:17.000000000 +0100
-@@ -73,7 +73,7 @@
- 	bool canRead() const;
- 	bool canWrite() const;
- 
--	const length_type getLength();
-+	length_type getLength();
- 
- 	const path& getFullPath() const;
- 
-diff -urN a/vmime/text.hpp c/vmime/text.hpp
---- libvmime-0.9.0.orig/vmime/text.hpp	2008-10-12 10:54:34.000000000 +0200
-+++ libvmime-0.9.0/vmime/text.hpp	2009-12-04 14:56:38.000000000 +0100
-@@ -197,7 +197,8 @@
- 
- 		FORCE_NO_ENCODING = (1 << 0),    /**< Just fold lines, don't encode them. */
- 		FORCE_ENCODING = (1 << 1),       /**< Encode lines even if they are plain ASCII text. */
--		NO_NEW_LINE_SEQUENCE = (1 << 2)  /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
-+		NO_NEW_LINE_SEQUENCE = (1 << 2), /**< Use CRLF instead of new-line sequence (CRLF + TAB). */
-+		QUOTE_IF_POSSIBLE = (1 << 3)     /**< Use quoting instead of encoding when possible (even if FORCE_ENCODING is specified). */
- 	};
- 
- 	/** Encode and fold text in respect to RFC-2047.
---- libvmime-0.9.0.orig/src/messageBuilder.cpp	2009-11-12 11:27:52.000000000 +0100
-+++ libvmime-0.9.0/src/messageBuilder.cpp	2009-12-11 14:21:31.000000000 +0100
-@@ -54,11 +54,15 @@
- 	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);
--- a/src/vmime.mk	Thu Feb 11 23:55:39 2010 +0100
+++ b/src/vmime.mk	Wed Feb 10 12:58:41 2010 +0100
@@ -19,6 +19,13 @@
 endef
 
 define $(PKG)_BUILD
+    # ansi and pedantic are too strict for mingw
+    # http://sourceforge.net/tracker/index.php?func=detail&aid=2373234&group_id=2435&atid=102435
+    $(SED) "s/'-ansi', //;" -i '$(1)/SConstruct'
+    $(SED) "s/'-pedantic', //;" -i '$(1)/SConstruct'
+
+    cd '$(1)' && scons autotools sendmail_path=/sbin/sendmail
+
     $(SED) 's,libtoolize ,$(LIBTOOLIZE) ,' -i '$(1)'/bootstrap
     cd '$(1)' && ./bootstrap
     cd '$(1)' && ./configure \