Sfoglia il codice sorgente

add deltachat-core sources to libraries folder

Jonas Reinsch 7 anni fa
parent
commit
f47067702f
100 ha cambiato i file con 23974 aggiunte e 0 eliminazioni
  1. 624 0
      deltachat-ios/libraries/deltachat-core/LICENSE
  2. 94 0
      deltachat-ios/libraries/deltachat-core/README.md
  3. 531 0
      deltachat-ios/libraries/deltachat-core/deltachat-core.cbp
  4. 16 0
      deltachat-ios/libraries/deltachat-core/libs/README.md
  5. 0 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/AUTHORS
  6. 31 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/COPYRIGHT
  7. 5202 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/ChangeLog
  8. 284 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/NEWS
  9. 62 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/README.md
  10. 165 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/acl.h
  11. 169 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/acl_types.h
  12. 103 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/annotatemore.h
  13. 268 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/annotatemore_types.h
  14. 149 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/carray.h
  15. 84 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/charconv.h
  16. 191 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/chash.h
  17. 146 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/clist.h
  18. 101 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/condstore.h
  19. 97 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/condstore_types.h
  20. 180 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/config.h
  21. 60 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/data_message_driver.h
  22. 53 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbdriver.h
  23. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbdriver_message.h
  24. 71 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbdriver_types.h
  25. 62 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbstorage.h
  26. 56 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/enable.h
  27. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feeddriver.h
  28. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feeddriver_message.h
  29. 68 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feeddriver_types.h
  30. 72 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feedstorage.h
  31. 56 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/generic_cache_types.h
  32. 57 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/hotmailstorage.h
  33. 64 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/idle.h
  34. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver.h
  35. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_cached.h
  36. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_cached_message.h
  37. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_message.h
  38. 88 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_tools.h
  39. 62 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_tools_private.h
  40. 165 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_types.h
  41. 120 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapstorage.h
  42. 26 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/libetpan-config.h
  43. 128 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/libetpan.h
  44. 66 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/libetpan_version.h
  45. 56 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mail.h
  46. 67 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildir.h
  47. 93 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildir_types.h
  48. 53 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver.h
  49. 53 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_cached.h
  50. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_cached_message.h
  51. 52 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_message.h
  52. 96 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_types.h
  53. 70 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirstorage.h
  54. 607 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver.h
  55. 103 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver_errors.h
  56. 822 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver_types.h
  57. 99 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver_types_helper.h
  58. 190 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailengine.h
  59. 80 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailfolder.h
  60. 914 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap.h
  61. 68 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_compress.h
  62. 111 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_extension.h
  63. 114 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_extension_types.h
  64. 71 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_helper.h
  65. 64 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_id.h
  66. 72 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_id_types.h
  67. 102 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_oauth2.h
  68. 67 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_socket.h
  69. 102 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_sort.h
  70. 121 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_sort_types.h
  71. 68 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_ssl.h
  72. 3604 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_types.h
  73. 849 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_types_helper.h
  74. 368 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf.h
  75. 864 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_types.h
  76. 394 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_types_helper.h
  77. 180 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_write_file.h
  78. 150 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_write_generic.h
  79. 143 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_write_mem.h
  80. 53 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maillock.h
  81. 144 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmbox.h
  82. 143 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmbox_types.h
  83. 379 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmessage.h
  84. 50 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmessage_types.h
  85. 147 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmh.h
  86. 118 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime.h
  87. 173 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_content.h
  88. 62 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_decode.h
  89. 62 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_disposition.h
  90. 503 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_types.h
  91. 204 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_types_helper.h
  92. 118 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_write_file.h
  93. 73 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_write_generic.h
  94. 80 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_write_mem.h
  95. 146 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3.h
  96. 64 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_helper.h
  97. 64 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_socket.h
  98. 61 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_ssl.h
  99. 131 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_types.h
  100. 145 0
      deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailprivacy.h

+ 624 - 0
deltachat-ios/libraries/deltachat-core/LICENSE

@@ -0,0 +1,624 @@
+
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ 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
+
+  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
+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 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.
+
+                       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.
+
+  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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies 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
+
+

+ 94 - 0
deltachat-ios/libraries/deltachat-core/README.md

@@ -0,0 +1,94 @@
+Delta Chat Core Library
+================================================================================
+
+You can use the _Delta Chat Core Library_ to build **your own messenger** or
+plugin, that is completely **compatible** to the existing email infrastructure.
+
+![Logo](https://delta.chat/assets/features/start-img4.png)
+
+The library is used eg. in the [Delta Chat Android Frontend](https://github.com/deltachat/deltachat-android).
+
+Using this library in your app, you get the **ease** of well-known messengers
+with the **reach** of e-mail. Moreover, you're **independent** from other companies or
+services - as your data is not relayed to Delta Chat, you won't even add new
+dependencies here.
+
+Some features at a glance
+
+- **Secure** with automatic end-to-end-encryption, supporting the new
+  [Autocrypt](https://autocrypt.readthedocs.io/en/latest/) standard
+- **Fast** by the use of Push-IMAP
+- **Read receipts**
+- **Largest userbase** - receivers _not_ using Delta Chat can be reached as well
+- **Compatible** - not only to itself
+- **Elegant** and **simple** user interface
+- **Distributed** system
+- **No Spam** - only messages of known users are shown by default
+- **Reliable** - safe for professional use
+- **Trustworthy** - can even be used for business messages
+- **Libre software** and [standards-based](https://delta.chat/en/standards)
+
+
+Build
+--------------------------------------------------------------------------------
+
+The Delta Chat Core Library relies on the following external libs:
+
+- [LibEtPan](https://github.com/dinhviethoa/libetpan), [OpenSSL](https://www.openssl.org/); for
+  compilation, use eg. the following commands: `./autogen.sh; make;
+  sudo make install prefix=/usr`
+  To link against LibEtPan, add `libetpan-config --libs` in backticks to your
+  project. This should also add the needed OpenSSL libraries.
+
+- [SQLite](http://sqlite.org/) is available on most systems, however, you
+  will also need the headers, please look for packages as `libsqlite3-dev`.
+  To link against SQLite, add `-lsqlite3` to your project.
+
+Alternatively, use the ready-to-use files from the libs-directory which are
+suitable for common system.  You'll also find a fork of the needed Netpgp
+library there.
+
+
+Coding
+--------------------------------------------------------------------------------
+
+If you are a developer and have an idea for another crazy chat, social or messaging
+app you are encouraged to take this source code as a base. We would love to see
+_many_ different messengers out there, based on existing, distributed
+infrastructure. But we hate to see the user's data hidden on some companies
+servers with undefined backgrounds.
+
+Some hints:
+
+- Regard the header files in the `src`-directory as a documentation;
+  `mrmailbox.h` is a good starting point
+
+- Headers may cointain headlines as "library-private" - stull following there
+  is not meant to be used by the library user.
+
+- Two underscores at the end of a function-name may be a _hint_, that this
+  function does no resource locking.
+
+- For objects, C-structures are used.  If not mentioned otherwise, you can
+  read the members here directly.
+
+- For `get`-functions, you have to unref the return value in some way.
+
+- Strings in function arguments or return values are usually UTF-8 encoded
+
+- Threads are implemented using POSIX threads (pthread_* functions)
+
+- For indentation, use tabs.  Alignments that are not placed at the beginning
+  of a line should be done with spaces.
+
+- For padding between functions, classes etc. use 2 empty lines
+
+- Source files are encoded as UTF-8 with Unix line endings (a simple `LF`, `0x0A` or
+  `\n`)
+
+Please keep in mind, that your derived work must be released under a
+GPL-compatible licence.  For details, please have a look at the [LICENSE file](https://github.com/deltachat/deltachat-core/blob/master/LICENSE) accompanying the source code.
+
+---
+
+Copyright © 2017 Delta Chat contributors

+ 531 - 0
deltachat-ios/libraries/deltachat-core/deltachat-core.cbp

@@ -0,0 +1,531 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="deltachat-core" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Debug">
+				<Option output="bin/Debug/deltachat-core" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Debug/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Option parameters="/home/bpetersen/messy/mailboxes/messenger.db" />
+				<Compiler>
+					<Add option="-g" />
+				</Compiler>
+				<Linker>
+					<Add option="-lz -lssl -lcrypto -pthread -lsasl2" />
+				</Linker>
+			</Target>
+			<Target title="Release">
+				<Option output="bin/Release/deltachat-core" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+			<Add option="-fexceptions" />
+			<Add option="-DHAVE_CONFIG_H" />
+			<Add option="-DMR_USE_MIME_DEBUG" />
+			<Add option="-DHAVE_ICONV" />
+			<Add option="-DSQLITE_OMIT_LOAD_EXTENSION" />
+			<Add option="-DMR_E2EE_DEFAULT_ENABLED=1" />
+			<Add directory="libs/libetpan/src" />
+			<Add directory="libs/libetpan/src/data-types" />
+			<Add directory="libs/libetpan/src/low-level" />
+			<Add directory="libs/libetpan/src/low-level/imap" />
+			<Add directory="libs/libetpan/src/low-level/imf" />
+			<Add directory="libs/libetpan/src/low-level/mime" />
+			<Add directory="libs/libetpan/src/low-level/nntp" />
+			<Add directory="libs/libetpan/src/low-level/smtp" />
+			<Add directory="libs/libetpan/src/main" />
+			<Add directory="libs/libetpan/src/driver/implementation/data-message" />
+			<Add directory="libs/libetpan/src/driver/interface" />
+			<Add directory="libs/libetpan/include" />
+			<Add directory="libs/libetpan/include/libetpan" />
+			<Add directory="libs/sqlite" />
+			<Add directory="libs/netpgp/include" />
+		</Compiler>
+		<Unit filename="README.md" />
+		<Unit filename="libs/libetpan/src/data-types/base64.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/carray.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/charconv.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/chash.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/clist.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/connect.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mail_cache_db.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/maillock.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailsasl.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailsem.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_cancel.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_cfstream.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_compress.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_low.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_socket.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mailstream_ssl.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/md5.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/mmapstring.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/data-types/timeutils.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/implementation/data-message/data_message_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/implementation/mime-message/mime_message_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/maildriver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/maildriver_tools.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/maildriver_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/maildriver_types_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/mailfolder.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/mailmessage.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/mailmessage_tools.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/mailmessage_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/mailstorage.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/driver/interface/mailstorage_tools.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/engine/mailprivacy.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/engine/mailprivacy_tools.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/acl.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/acl_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/acl_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/acl_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/annotatemore.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/annotatemore_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/annotatemore_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/annotatemore_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/condstore.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/condstore_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/enable.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/idle.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_compress.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_extension.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_id.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_id_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_id_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_id_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_keywords.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_oauth2.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_print.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_socket.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_sort.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_sort_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_ssl.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/mailimap_types_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/namespace.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/namespace_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/namespace_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/namespace_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/qresync.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/qresync_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/quota.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/quota_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/quota_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/quota_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/uidplus.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/uidplus_parser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/uidplus_sender.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/uidplus_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/xgmlabels.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/xgmmsgid.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/xgmthrid.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imap/xlist.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imf/mailimf.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imf/mailimf_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imf/mailimf_types_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imf/mailimf_write_file.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imf/mailimf_write_generic.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/imf/mailimf_write_mem.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_content.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_decode.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_disposition.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_types.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_types_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_write_file.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_write_generic.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/mime/mailmime_write_mem.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/nntp/newsnntp.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/nntp/newsnntp_socket.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/nntp/newsnntp_ssl.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/smtp/mailsmtp.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/smtp/mailsmtp_helper.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/smtp/mailsmtp_oauth2.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/smtp/mailsmtp_socket.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/low-level/smtp/mailsmtp_ssl.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/libetpan/src/main/libetpan_version.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/compress.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/create.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/crypto.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/keyring.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/misc.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/openssl_crypto.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/packet-parse.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/packet-show.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/reader.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/signature.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/symmetric.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/validate.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/netpgp/src/writer.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="libs/sqlite/sqlite3.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/main.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mraheader.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrapeerstate.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrchat.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrchatlist.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrcmdline.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrcontact.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrdehtml.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrimap.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrjob.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrkey.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrkeyring.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrloginparam.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmailbox.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmailbox_configure.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmailbox_e2ee.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmailbox_imex.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmailbox_log.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmailbox_tools.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmimefactory.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmimeparser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrmsg.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrosnative.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrparam.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrpgp.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrpoortext.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrsaxparser.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrsimplify.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrsmtp.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrsqlite3.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrstock.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/mrtools.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="src/stress.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Extensions>
+			<envvars />
+			<code_completion />
+			<debugger />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>

+ 16 - 0
deltachat-ios/libraries/deltachat-core/libs/README.md

@@ -0,0 +1,16 @@
+This directory contains some libraries needed by the Delta Chat core library.
+
+While it is also possible, to use the corresponding system libraries, it may
+be easier on some OS to use the source from here which compiles fine under
+"normal" circumstances.
+
+Moreover, using the libraries from this directory may make fixing errors easier
+(as we use the same code under different Delta Chat implementations).  The
+disadvantage to the system libraries may be that the system may react faster
+on security fixes than Delta Chat - I think this is true only for Linux.  For
+the same reason, packages using non-sytem libraries may be rejected from some
+Linux repositories.
+
+Moreover, we've fixed some bugs here and there; these lines are marked by
+`EDIT BY MR` then (as soon as we find the time, we should check if such changes
+could form a pull request to the used library).

+ 0 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/AUTHORS


+ 31 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/COPYRIGHT

@@ -0,0 +1,31 @@
+libEtPan! -- a mail stuff library
+
+Copyright (C) 2001 - 2005 - DINH Viet Hoa
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. Neither the name of the libEtPan! project nor the names of its
+   contributors may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+This project contains code from sendmail, NetBSD,
+RSA Data Security MD5 Message-Digest Algorithm, Cyrus IMAP.

+ 5202 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/ChangeLog

@@ -0,0 +1,5202 @@
+2011-07-13 - libetpan-1.1cvs2 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   enable a private API to workaround for Zarafa server in etPanKit.
+
+2011-07-12 - libetpan-1.1cvs1 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+
+2011-07-12 - libetpan-1.1b - hoa
+
+	* src/low-level/imap/namespace_parser.c
+	   fixed build.
+
+2011-07-12 - libetpan-1.1 - hoa
+
+	* release 1.1
+	   features:
+	   implemented IMAP NAMESPACE,
+	   implemented SMTP SIZE,
+	   support for Content-Location,
+	   improved progress report API for IMAP and SMTP.
+	   
+	   fixes:
+	   workaround for various IMAP servers,
+	   fixes for IMAP parser,
+	   fixed generation of quoted printable,
+	   fixed memory leaks.
+
+2011-07-11 - libetpan-1.0cvs74 - hoa
+
+	* src/low-level/imap/mailimap.c
+	   reduce memory usage.
+
+2011-07-01 - libetpan-1.0cvs73 - hoa
+
+	* src/low-level/imap/mailimap.c
+	   fixed memory leak.
+
+2011-06-29 - libetpan-1.0cvs72 - hoa
+
+	* src/low-level/mime/mailmime_content.c
+	   interpret message/rfc822 as single part if it's encoded in base64 or quoted-printable.
+
+2011-06-25 - libetpan-1.0cvs71 - hoa
+
+	* src/low-level/mime/mailmime_write_generic.c
+	   fixed generation of quoted printable
+
+2011-06-21 - libetpan-1.0cvs70 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	   fixed error handling.
+
+2011-06-21 - libetpan-1.0cvs69 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for Lotus Domino, parse empty body and parse broken param value.
+
+2011-06-21 - libetpan-1.0cvs68 - hoa
+
+	* src/low-level/imf/mailimf.c
+	   workaround for MBox mail: twice opening angle bracket generated by MBox mail.
+
+2011-06-20 - libetpan-1.0cvs67 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	   fixed error handling.
+
+2011-06-13 - libetpan-1.0cvs66 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+   	   fixed parser for SIZE extension.
+
+2011-06-04 - libetpan-1.0cvs65 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	   fixed parse error from non-compliant servers.
+
+2011-05-29 - libetpan-1.0cvs64 - hoa
+
+	* src/low-level/imap/mailimap_keywords.c
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for mail.maximedia.nl server.
+
+2011-05-23 - libetpan-1.0cvs63 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for Citadel IMAP.
+
+2011-05-21 - libetpan-1.0cvs62 - hoa
+
+    * src/low-level/imap/mailimap_helper.c
+       fixed fetch_rfc822, fetch_rfc822_header
+
+2011-05-19 - libetpan-1.0cvs62 - hoa
+
+	* src/low-level/imap/xlist.h
+	   fixed build for C++.
+
+2011-05-09 - libetpan-1.0cvs61 - hoa
+
+	* src/data-types/clist.h
+	   fixed macro.
+
+2011-05-09 - libetpan-1.0cvs60 - hoa
+
+	* src/low-level/imap/mailimap.c
+	   fixed crash.
+
+2011-05-09 - libetpan-1.0cvs59 - hoa
+
+	* src/low-level/imap/mailimap.c
+	   fixed memory leak when fetch fails.
+
+2011-05-04 - libetpan-1.0cvs58 - hoa
+
+	* src/data-types/mailstream_low.c
+	* src/data-types/mailstream_low.h
+	   fixed API. Consistent ownership.
+
+2011-05-03 - libetpan-1.0cvs57 - hoa
+
+	* src/low-level/imap/namespace_parser.c
+	   fixed clang reports.
+
+2011-05-03 - libetpan-1.0cvs56 - hoa
+
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	* src/low-level/imap/acl_parser.c
+	* src/low-level/mime/mailmime_content.c
+	* src/low-level/mime/mailmime_disposition.c
+	   fixed clang reports.
+
+2011-04-30 - libetpan-1.0cvs55 - hoa
+
+	* src/low-level/mime/mailmime_types_helper.c
+	   don't use Content-Transfer-Encoding for MIME multipart.
+
+2011-04-28 - libetpan-1.0cvs54 - hoa
+
+	* src/low-level/imap/namespace_parser.c
+	   fixed namespace parser failure.
+	   workaround for Courier-IMAP.
+
+2011-04-27 - libetpan-1.0cvs53 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for Yandex IMAP servers.
+
+2011-04-19 - libetpan-1.0cvs52 - hoa
+
+	* src/data-types/mailstream_low.[ch]
+	* src/data-types/mailstream_types.h
+	   identifier for stream connection (useful for logging).
+
+2011-04-15 - libetpan-1.0cvs51 - hoa
+
+	* configure.ac
+	   build for debian.
+
+2011-04-15 - libetpan-1.0cvs50 - hoa
+
+	* src/data-types/mailstream_socket.[ch]
+	   fixed function name.
+
+2011-04-15 - libetpan-1.0cvs49 - hoa
+
+	* src/data-types/mailstream_socket.[ch]
+	   can be configure to use read() for debugging purpose.
+
+2011-04-15 - libetpan-1.0cvs48 - hoa
+
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	   fixed error handling of select().
+
+2011-04-11 - libetpan-1.0cvs47 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+   	   workaround for Zoho Mail IMAP implementation.
+
+2011-04-06 - libetpan-1.0cvs46 - hoa
+
+	* src/low-level/imf/mailimf.c
+	   fallback when parsing Content-ID of Message-ID.
+
+2011-04-02 - libetpan-1.0cvs45 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   fixed a crash.
+
+2011-03-30 - libetpan-1.0cvs44 - hoa
+
+	* src/low-level/imap/mailimap_extension.c
+	* src/low-level/imap/mailimap_extension_types.h
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/xlist.[ch]
+	   fixed XLIST implementation.
+
+2011-03-30 - libetpan-1.0cvs43 - hoa
+
+	* src/low-level/imap/Makefile.am
+	* src/low-level/imap/xlist.c
+  	   implemented XLIST (available on Gmail and Zimbra).
+
+2011-03-29 - libetpan-1.0cvs42 - hoa
+
+	* src/data-types/charconv.c
+  	    korean charset workaround.
+
+2011-03-25 - libetpan-1.0cvs41 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for Mbox Mail for Mac.
+
+2011-03-25 - libetpan-1.0cvs40 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for Exchange (blank lines between response).
+
+2011-03-24 - libetpan-1.0cvs39 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   improved workaround for Exchange servers.
+
+2011-03-24 - libetpan-1.0cvs38 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround for Exchange servers that fails providing conformance in regards to Content-Disposition.
+
+2011-03-16 - libetpan-1.0cvs37 - hoa
+
+	* src/low-level/imap/mailimap.c
+	* src/low-level/imap/mailimap_types.c
+	   fixed memory leaks.
+
+2011-03-15 - libetpan-1.0cvs36 - hoa
+
+	* src/data-types/charconv.c
+	   fixed charset conversation for hebrew (iso-8859-8-i and iso-8859-8-e)
+
+2011-03-14 - libetpan-1.0cvs35 - hoa
+
+	* src/data-types/mmapstring.c
+	   fixed a possible crash.
+
+2011-03-12 - libetpan-1.0cvs34 - hoa
+
+	* src/low-level/imf/mailimf.c
+	   fixed MIME Content-ID and Message-ID parser.
+
+2011-03-11 - libetpan-1.0cvs33 - hoa
+
+	* src/data-types/mailstream_low.c
+	   revert libetpan-1.0cvs32.
+
+2011-03-11 - libetpan-1.0cvs32 - hoa
+
+	* src/data-types/mailstream_low.c
+	   private log identifier is 3.
+
+2011-03-11 - libetpan-1.0cvs31 - hoa
+
+	* src/data-types/mailstream.[ch]
+	* src/data-types/mailstream_low.[ch]
+	* src/data-types/mailstream_types.h
+	* src/low-level/imap/mailimap.c
+	* src/low-level/nntp/newsnntp.c
+	* src/low-level/pop3/mailpop3.c
+	* src/low-level/smtp/mailsmtp.c
+	   authentication privacy.
+
+2011-03-10 - libetpan-1.0cvs30 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	   support for broken AUTH advertisement.
+
+2011-03-07 - libetpan-1.0cvs29 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	   handle SMTP error code for authentication error.
+
+2011-03-06 - libetpan-1.0cvs28 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   implemented workaround for exchange IMAP server (for multipart/signed).
+
+2011-03-04 - libetpan-1.0cvs27 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   implemented workaround for exchange IMAP server.
+
+2011-03-03 - libetpan-1.0cvs26 - hoa
+
+	* src/low-level/imap/namespace_types.c
+	   fixed memory leak.
+
+2011-02-28 - libetpan-1.0cvs25 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	* src/low-level/smtp/mailsmtp_types.h
+	   implements SMTP authentication availability.
+
+2011-02-27 - libetpan-1.0cvs24 - hoa
+
+	* src/data-types/connect.c
+	* src/data-types/mailstream_ssl.c
+	   fixed build for win32.
+
+2011-02-27 - libetpan-1.0cvs23 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	   fixed error check for SMTP.
+	
+2011-02-20 - libetpan-1.0cvs22 - hoa
+
+	* src/low-level/imap/namespace_parser.c
+	   fixed build.
+
+2011-02-20 - libetpan-1.0cvs21 - hoa
+
+	* src/low-level/imap/namespace_parser.c
+	   workaround Yahoo IMAP server.
+
+2011-02-20 - libetpan-1.0cvs20 - hoa
+
+	* src/low-level/imap/namespace.c
+	* src/low-level/imap/namespace_parser.c
+	   fixed parser.
+	   fixed crash.
+
+2011-02-19 - libetpan-1.0cvs19 - hoa
+
+	* configure.ac
+	* build-mac/libetpan.xcodeproj/project.pbxproj
+	* src/low-level/imap/Makefile.am
+	* src/low-level/imap/acl.h
+	* src/low-level/imap/annotatemore.h
+	* src/low-level/imap/mailimap.h
+	* src/low-level/imap/mailimap_extension.c
+	* src/low-level/imap/mailimap_extension_types.h
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/quota.[ch]
+	* src/low-level/imap/quota_sender.h
+	* src/low-level/nntp/newsnntp.c
+	* src/low-level/imap/namespace.[ch]
+	* src/low-level/imap/namespace_parser.[ch]
+	* src/low-level/imap/namespace_sender.[ch]
+	* src/low-level/imap/namespace_types.[ch]
+	   implemented namespace.
+	   fixed build system.
+	   fixed some warnings.
+
+2011-01-06 - libetpan-1.0cvs18 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/engine/mailprivacy_tools.c
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/imap/mailimap_types.[ch]
+	* src/low-level/mime/mailmime.[ch]
+	* src/low-level/mime/mailmime_types.[ch]
+	* src/low-level/mime/mailmime_types_helper.c
+	   support for Content-Location. breaks binary compatibility.
+
+2010-12-15 - libetpan-1.0cvs17 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   fixed memory leak.
+
+2010-12-05 - libetpan-1.0cvs16 - hoa
+
+	* src/data-types/charconv.c
+	   use GBK instead of GB2312 and GB_2312-80
+
+2010-11-30 - libetpan-1.0cvs15 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   fixed IMAP parser
+
+2010-11-28 - libetpan-1.0cvs14 - hoa
+
+	* src/data-types/mailstream_helper.[ch]
+	* src/data-types/mailstream_types.h
+	* src/low-level/imap/mailimap.[ch]
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/mailimap_sender.[ch]
+	* src/low-level/imap/mailimap_types.h
+	* src/low-level/smtp/mailsmtp.[ch]
+	* src/low-level/smtp/mailsmtp_helper.[ch]
+	   improved progress report support for SMTP and IMAP.
+
+2010-11-16 - libetpan-1.0cvs13 - hoa
+
+	* src/low-level/mime/mailmime_decode.c
+	   backport a fix from etPanKit.
+
+2010-11-16 - libetpan-1.0cvs12 - hoa
+
+ 	* build-windows/libetpan.sln
+	* build-windows/libetpan/libetpan.vcproj
+	* build-windows/readmsg/readmsg.vcproj
+	* build-windows/smtpsend/smtpsend.vcproj
+	* src/data-types/carray.h
+	* src/data-types/chash.h
+	* src/data-types/mailstream_ssl.c
+	* src/windows/win_etpan.h
+	* tests/option-parser.c
+	   improved port for win32.
+
+2010-11-10 - libetpan-1.0cvs11 - hoa
+
+	* src/low-level/mime/mailmime_decode.c
+	   fixed decode of MIME header.
+
+2010-11-04 - libetpan-1.0cvs10 - hoa
+
+	* src/low-level/mime/mailmime_decode.c
+	   fixed parsing of MIME header encoding of headers.
+
+2010-10-21 - libetpan-1.0cvs9 - hoa
+
+	* src/low-level/imap/idle.c
+	   fixed function name. Thanks Michael Rasmussen.
+
+2010-09-15 - libetpan-1.0cvs8 - hoa
+
+	* src/low-level/imap/mailimap_types_helper.c
+	   fixed search.
+
+2010-09-05 - libetpan-1.0cvs7 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   create an empty list in case of empty multipart.
+
+2010-09-04 - libetpan-1.0cvs6 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	   workaround Gmail IMAP bug: zero bodies in multipart.
+
+2010-09-03 - libetpan-1.0cvs5 - hoa
+
+	* build-windows/libetpan_version.h
+		update version.
+	* src/data-types/mailstream.[ch]
+	* src/data-types/mailstream_low.[ch]
+	* src/low-level/imap/mailimap_parser.c
+		report parse error.
+	* build-mac/update.sh
+		fixed mac update.
+	* src/data-types/connect.c
+		fixed memory leak.
+
+2010-07-27 - libetpan-1.0cvs4 - hoa
+
+	* src/low-level/smtp/mailsmtp_helper.c
+	    fixed size verification for RFC 1870.
+
+2010-07-27 - libetpan-1.0cvs3 - hoa
+
+	* src/low-level/smtp/mailsmtp.[ch]
+	* src/low-level/smtp/mailsmtp_helper.c
+	* src/low-level/smtp/mailsmtp_types.h
+	    implements RFC 1870 (SMTP SIZE).
+
+2010-07-22 - libetpan-1.0cvs2 - hoa
+
+	* src/low-level/imap/mailimap_sender.c
+	* src/low-level/imap/mailimap_types.c
+	    fixed date when appending.
+
+2010-05-30 - libetpan-1.0cvs1 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    IMAP parser issue in case quoted string contains a CRLF.
+
+2010-04-09 - libetpan-1.0 - hoa
+
+	* release 1.0
+
+2010-04-08 - libetpan-0.58cvs27 - hoa
+
+	* configure.ac
+	    Fixed --enable-debug flag in configure script.
+	    Support of Berkeley DB 4.8.
+	    Thanks to Tim Harder.
+
+2010-04-05 - libetpan-0.58cvs26 - hoa
+
+	* build-mac/update.sh
+	    fixed script.
+
+2010-04-05 - libetpan-0.58cvs25 - hoa
+
+	* src/engine/mailprivacy_tools.c
+	    fixed integration of patch (libetpan-0.58cvs22).
+	* src/low-level/imap/idle.c
+	    fixed error code.
+
+2010-04-05 - libetpan-0.58cvs24 - hoa
+
+	* src/low-level/imap/mailimap_sender.c
+	    fixed OR condition in IMAP SEARCH command.
+
+2010-04-05 - libetpan-0.58cvs23 - hoa
+
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_tools.c
+	* src/engine/mailprivacy_tools.c
+	* src/low-level/imap/mailimap.c
+	* src/low-level/pop3/mailpop3.c
+	* tests/readmsg-simple.c
+	* tests/readmsg-uid.c
+	    fixed some other warnings.
+
+2010-04-05 - libetpan-0.58cvs22 - hoa
+
+	* src/data-types/maillock.c
+	* src/data-types/mailstream_cancel.c
+	* src/data-types/mailstream_low.c
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/engine/mailprivacy.c
+	* src/engine/mailprivacy_tools.c
+	* src/low-level/feed/newsfeed.c
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/nntp/newsnntp.c
+	* src/low-level/pop3/mailpop3.c
+	* src/low-level/smtp/mailsmtp.c
+	* tests/decrypt.c
+	* tests/readmsg-simple.c
+	* tests/readmsg-uid.c
+	* tests/smime.c
+	    fixed some warnings. Thanks to Didier Barvaux.
+
+2010-04-05 - libetpan-0.58cvs21 - hoa
+
+	* src/driver/implementation/imap/imapdriver.c
+	    fixed memory leak (2941557). Thanks to Juha Paananen.
+	
+	* src/low-level/imap/mailimap_types_helper.c
+	    fixed IMAP search (2941559). Thanks to Juha Paananen.
+
+2010-04-05 - libetpan-0.58cvs20 - hoa
+
+	* configure.ac
+	* src/driver/interface/mailstorage_tools.c
+	* tests/smtpsend.c
+	    improved support of Solaris 2.8 (2786623). Thanks to Thomas Wiegner.
+
+2010-04-05 - libetpan-0.58cvs19 - hoa
+
+	* build-mac/update.sh
+	    import of OpenSSL (prepare build for iPhone including OpenSSL)
+
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_tools.c
+	* src/low-level/pop3/mailpop3.[ch]
+	    better error checking (2888850). Thanks to Alexander Shlemin.
+		API change.
+
+2010-03-21 - libetpan-0.58cvs18 - hoa
+
+	* src/data-types/mailstream.h
+	* src/data-types/mailstream_low.c
+	    log protocol by stream
+
+2010-01-17 - libetpan-0.58cvs17 - hoa
+
+	* build-mac/update.sh
+	* build-mac/libetpan.xcodeproj/project.pbxproj
+	    build mac with quota
+
+2010-01-14 - libetpan-0.58cvs16 - hoa
+
+	* src/low-level/imap/Makefile.am
+	    build with quota.
+
+2010-01-04 - libetpan-0.58cvs15 - hoa
+
+	* src/low-level/imap/mailimap_extension.c
+	    fixed error code in extension parser (2918352). Thanks to Chris Head.
+
+2010-01-04 - libetpan-0.58cvs14 - hoa
+
+	* src/low-level/imap/acl_parser.c
+	* src/low-level/imap/annotatemore_parser.c
+	    fixed malloc allocation check (2918372). Thanks to Chris Head.
+
+2010-01-03 - libetpan-0.58cvs13 - hoa
+
+	* src/low-level/imap/mailimap_extension.c
+	* src/low-level/imap/mailimap_extension_types.h
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/quota.[ch]				** NEW FILE **
+	* src/low-level/imap/quota_parser.[ch]		** NEW FILE **
+	* src/low-level/imap/quota_sender.[ch]		** NEW FILE **
+	* src/low-level/imap/quota_types.[ch]		** NEW FILE **
+	    added QUOTA support (RFC 2087, patch 2918500). Thanks to Chris Head.
+
+2009-12-19 - libetpan-0.58cvs12 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+		better handling for errors.
+
+2009-12-19 - libetpan-0.58cvs11 - hoa
+
+	* src/low-level/imf/mailimf_types_helper.c
+		fixed crash on Win32 (2892730).
+
+2009-12-19 - libetpan-0.58cvs10 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/low-level/imap/mailimap_socket.c
+	* src/low-level/imap/mailimap_ssl.c
+	* src/low-level/nntp/newsnntp_socket.c
+	* src/low-level/nntp/newsnntp_ssl.c
+	* src/low-level/pop3/mailpop3_socket.c
+	* src/low-level/pop3/mailpop3_ssl.c
+	* src/low-level/smtp/mailsmtp_socket.c
+		fixed socket use on Win32 (2897095).
+
+2009-12-19 - libetpan-0.58cvs9 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+		fixed crash (Thanks Gabor for discovering the bug).
+
+2009-12-19 - libetpan-0.58cvs8 - hoa
+
+	* mailimap_parser.[ch]
+		fixed build.
+		workaround in parser for imap.gmx.com (Thanks Matt Ronge for reproducible case).
+
+2009-11-05 - libetpan-0.58cvs7 - hoa
+
+	* src/low-level/imap/idle.c
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/imap/mailimap_parser.h
+		fixed IMAP IDLE parser (made public API for the IMAP parser).
+
+2009-09-07 - libetpan-0.58cvs6 - hoa
+
+	* build-mac/Info.plist
+	* build-mac/update.sh
+	* build-mac/libetpan.xcodeproj/project.pbxproj
+	    added build for Mac OS X (within Xcode).
+
+2009-09-07 - libetpan-0.58cvs5 - hoa
+
+	* src/engine/mailprivacy_tools.c
+	* src/low-level/feed/parser.c
+	* src/low-level/imap/mailimap_types.c
+	    fixed errors detected by clang static analyzer.
+
+2009-09-06 - libetpan-0.58cvs4 - hoa
+
+	* src/low-level/mime/mailmime_disposition.c
+	    fixed warning.
+
+2009-08-29 - libetpan-0.58cvs3 - hoa
+
+    * src/driver/implementation/imap/imapdriver_tools.c
+    * src/low-level/imf/mailimf_types_helper.c
+        fixed some crash (and workaround of MailCore).
+        Thanks to Gabor Cselle.
+
+2009-08-29 - libetpan-0.58cvs2 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	    fixed memory leaks.
+	    Thanks to Pawel Pekala.
+
+2009-07-23 - libetpan-0.58cvs1 - hoa
+
+	* configure.ac
+	    fixed build for Mac OS X
+	
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    fix a crash.
+	    Thanks to Gabor Cselle, Stefano Barbato
+	
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3storage.c
+	* src/driver/tools/imfcache.c
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/imap/mailimap_types.c
+	    fix memory leaks.
+	    bugfixes.
+	    Thanks to Pawel Pekala.
+
+2009-06-16 - libetpan-0.58 - hoa
+
+	* release 0.58
+	   Improvements on SSL implementation.
+
+2009-06-16 - libetpan-0.57cvs4 - hoa
+
+	* configure.ac
+	   prepare for 0.58
+
+2009-06-12 - libetpan-0.57cvs3 - colin
+
+	* src/data-types/mailstream_ssl.c
+	   Gnutls: Better fix (API-compatible with libgnutls13)
+
+2009-06-12 - libetpan-0.57cvs2 - colin
+
+	* src/data-types/mailstream_ssl.c
+	   Gnutls: Use compatibility mode to avoid being unable to 
+	   connect to some servers. (see Claws Mail's bug #1930)
+	* configure.ac
+	   Fix error with automake 1.10.2 
+
+
+2008-11-21 - libetpan-0.57cvs1 - colin
+
+	* src/data-types/mailstream_ssl.c
+	   Rehandshake if server asks to.
+
+2008-10-08 - libetpan-0.57 - hoa
+
+	* release 0.57
+	    - fixed an issue with GnuTLS.
+
+2008-10-05 - libetpan-0.56cvs2 - colin
+
+	* src/data-types/mailstream_ssl.c
+	   fixed return value when setting GnuTLS client cert.
+
+2008-09-14 - libetpan-0.56cvs1 - hoa
+
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	    fixed a bug with cached IMAP bodystructure.
+
+2008-09-02 - libetpan-0.56 - hoa
+
+	* release 0.56
+	    - fixed a crash
+
+2008-09-01 - libetpan-0.55cvs2 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Check ssl_context to see if it's NULL (fixes crash)
+
+2008-08-30 - libetpan-0.55cvs1 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Fix NULL frees introduced in 0.54cvs15
+	    (Made SSL connections with no callback for client
+	     certificates crash)
+
+2008-08-26 - libetpan-0.55 - hoa
+
+	* release 0.55
+	    - better support for client certificate.
+	    - bug fixes
+
+2008-08-26 - libetpan-0.54cvs17 - hoa
+
+	* configure.ac
+	    support for db 4.7
+
+2008-07-04 - libetpan-0.54cvs16 - hoa
+	
+	* src/data-types/mailstream_ssl.c
+	    fixed wait_read() in ssl stream implementation.
+
+2008-07-03 - libetpan-0.54cvs15 - colin
+	
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mailstream_ssl.h
+	    Add API to be able to set a client X509 certificate
+	    and private key:
+	    mailstream_ssl_set_client_certificate_data()
+	    mailstream_ssl_set_client_private_key_data()
+	    To be called from the callback set in 
+	    mailstream_ssl_open_with_callback() for example.
+
+2008-06-16 - libetpan-0.54cvs14 - hoa
+	
+	* src/low-level/imf/mailimf_types_helper.c
+	    Fixed timezone calculation.
+
+2008-06-15 - libetpan-0.54cvs13 - hoa
+	
+	* src/low-level/mime/mailmime_write_generic.c
+	    Fixed MIME generator, MIME headers of message/rfc822
+	    are no more moved to sub-part, except "MIME-Version".
+	    Thanks to James Smith.
+
+2008-05-27 - libetpan-0.54cvs12 - hoa
+	
+	* src/low-level/imf/mailimf.h
+	    (re-)fixed 1909672: Date fields parsed as optional field on 64 bit OS.
+	    mailimf_token_case_insensitive_parse() is fixed.
+	    Thanks to James Smith.
+
+	* src/low-level/imap/mailimap_parser.c
+	    workarounded bug on lavabit.com server.
+
+2008-05-26 - libetpan-0.54cvs11 - hoa
+
+	* configure.ac
+	* tests/option-parser.c
+	    fixed build of tests where getopt_long is not present.
+
+2008-05-26 - libetpan-0.54cvs10 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    workarounded bug on quoted string output on
+	    lavabit.com IMAP server.
+
+2008-05-23 - libetpan-0.54cvs9 - hoa
+
+	* libetpan-config.h.in
+	    fixed mingw32 build.
+	    Thanks to Marcus Brinkmann.
+
+2008-05-23 - libetpan-0.54cvs8 - hoa
+
+	* src/low-level/imf/mailimf.c
+	    Fixed crash in parser.
+	    Thanks to James Smith.
+
+2008-05-22 - libetpan-0.54cvs7 - hoa
+
+	* build-windows/libetpan_version.h
+	    updated version of win32 build
+	
+	* src/low-level/imf/mailimf.h
+	    fixed 1909672: Date fields parsed as optional field on 64 bit OS.
+	    mailimf_token_case_insensitive_parse() is fixed.
+	    Thanks to James Smith.
+
+2008-04-19 - libetpan-0.54cvs6 - hoa
+
+	* rules.mk
+	    fixed 'ln' usage.
+	
+	* src/driver/interface/maildriver_types.h
+	    fixed headers documentation.
+
+2008-04-11 - libetpan-0.54cvs5 - hoa
+
+	* src/driver/implementation/feed/feeddriver.c
+	    fixed charset handling in RSS driver.
+	
+2008-04-11 - libetpan-0.54cvs4 - hoa
+
+	* src/low-level/feed/parser.c
+	    fixed charset handling in RSS parser.
+
+2008-03-16 - libetpan-0.54cvs3 - colin
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    fixed collection of IMAP message envelope.
+
+2008-02-28 - libetpan-0.54cvs2 - colin
+
+	* src/data-types/mmapstring.c
+	* src/data-types/mmapstring.h
+	    Export mmap_string_set_tmpdir
+	    Export mmap_string_set_ceil
+	    Fix mmap_string_set_tmpdir prototype
+
+2008-02-21 - libetpan-0.54cvs1 - hoa
+
+	* tests/option-parser.c
+	    fixed reference to indx.
+
+2008-02-20 - libetpan-0.54 - hoa
+
+	* release 0.54 - Synergy bis
+	   - fixed regression on IMAP APPEND
+	   - cleanup
+	   - version fixes
+
+2008-02-20 - libetpan-0.53cvs6 - hoa
+	
+	* configure.ac
+	    prepare for 0.54
+
+2008-02-20 - libetpan-0.53cvs5 - hoa
+
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/tools/mailthread.c
+	* src/low-level/imap/mailimap.c
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/mbox/mailmbox_types.c
+	* tests/readmsg.c
+	    additional cleanup.
+
+2008-02-20 - libetpan-0.53cvs4 - hoa
+
+	* src/data-types/Makefile.am
+	* src/data-types/carray.[ch]
+	* src/data-types/cinthash.[ch]    *** REMOVED FILES ***
+	* src/data-types/clist.[ch]
+	* src/data-types/mailstream_helper.c
+	* src/data-types/md5.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/driver/implementation/imap/imapdriver_tools_private.h
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_tools.[ch]
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_tools.[ch]
+	* src/driver/implementation/nntp/nntpdriver_tools.[ch]
+	* src/driver/implementation/pop3/pop3driver_tools.[ch]
+	* src/driver/interface/maildriver_tools.c
+	* src/driver/interface/mailmessage.h
+	* src/driver/interface/mailstorage.c
+	* src/driver/tools/generic_cache.[ch]
+	* src/driver/tools/imfcache.[ch]
+	* src/low-level/imap/acl_parser.[ch]
+	* src/low-level/imap/annotatemore_parser.[ch]
+	* src/low-level/imap/idle.c
+	* src/low-level/imap/mailimap.c
+	* src/low-level/imap/mailimap_extension.[ch]
+	* src/low-level/imap/mailimap_extension_types.h
+	* src/low-level/imap/mailimap_keywords.[ch]
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/mailimap_types_helper.[ch]
+	* src/low-level/imap/uidplus_parser.[ch]
+	* src/low-level/imf/mailimf.[ch]
+	* src/low-level/mbox/mailmbox_parse.[ch]
+	* src/low-level/mbox/mailmbox_types.c
+	* src/low-level/mh/mailmh.[ch]
+	* src/low-level/mime/mailmime.[ch]
+	* src/low-level/mime/mailmime_content.[ch]
+	* src/low-level/mime/mailmime_decode.[ch]
+	* src/low-level/mime/mailmime_disposition.[ch]
+	* src/low-level/nntp/newsnntp.[ch]
+	* src/low-level/pop3/mailpop3.[ch]
+	* src/low-level/pop3/mailpop3_helper.[ch]
+	* tests/option-parser.c
+	* tests/smtpsend.c
+	    cleanup. Thanks to Daniel Richard G.
+	    removed deprecated cinthash.
+
+2008-02-17 - libetpan-0.53cvs3 - hoa
+
+	* configure.ac
+	* libetpan-config.h.in
+	* build-windows/libetpan_version.h
+	* src/data-types/connect.c
+	* src/data-types/maillock.c
+	* src/data-types/mailstream.c
+	* src/data-types/mailstream_ssl.c
+	* src/driver/implementation/data-message/data_message_driver.c
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/db/dbdriver_message.c
+	* src/driver/implementation/db/dbstorage.c
+	* src/driver/implementation/feed/feeddriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/imap/imapdriver_message.c
+	* src/driver/implementation/imap/imapstorage.c
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/maildir/maildirstorage.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached_message.c
+	* src/driver/implementation/mbox/mboxdriver_message.c
+	* src/driver/implementation/mbox/mboxstorage.c
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached_message.c
+	* src/driver/implementation/mh/mhdriver_message.c
+	* src/driver/implementation/mh/mhstorage.c
+	* src/driver/implementation/mime-message/mime_message_driver.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_cached_message.c
+	* src/driver/implementation/nntp/nntpdriver_message.c
+	* src/driver/implementation/nntp/nntpstorage.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_cached_message.c
+	* src/driver/implementation/pop3/pop3driver_message.c
+	* src/driver/implementation/pop3/pop3driver_tools.c
+	* src/driver/implementation/pop3/pop3storage.c
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	* src/engine/mailprivacy_tools.c
+	* src/engine/mailprivacy_tools_private.h
+	* src/low-level/feed/date.c
+	* src/low-level/feed/newsfeed.c
+	* src/low-level/feed/parser.c
+	* src/low-level/imap/acl.c
+	* src/low-level/imap/acl_types.h
+	* src/low-level/imap/annotatemore.c
+	* src/low-level/imap/annotatemore_types.c
+	* src/low-level/imap/annotatemore_types.h
+	* src/low-level/imap/mailimap_extension_types.h
+	* src/low-level/imap/mailimap_print.c
+	* src/low-level/imap/uidplus.c
+	* src/low-level/imap/uidplus_types.h
+	* src/low-level/imf/mailimf.c
+	* src/low-level/imf/mailimf_types_helper.c
+	* src/low-level/maildir/maildir.c
+	* src/low-level/mbox/mailmbox.c
+	* tests/option-parser.h
+	* tests/readmsg-common.h
+	* tests/smtpsend.c
+	    cleanup. Thanks to Daniel Richard G.
+
+2008-02-17 - libetpan-0.53cvs2 - hoa
+
+	* src/low-level/imap/idle.[ch]
+	    removing mailimap_check_idle() API.
+	    This API was incorrectly implemented and not useful.
+
+2008-02-17 - libetpan-0.53cvs1 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    fixed parse issue when appending message.
+	    (continue-req rule)
+
+2008-02-10 - libetpan-0.53 - hoa
+
+	* release 0.53 - Synergy
+	   - IPv6 issue
+	   - gmail issues
+	   - mingw32 build
+
+2008-02-10 - libetpan-0.52cvs37 - hoa
+
+	* src/data-types/mailstream_socket.c
+	* src/low-level/imap/mailimap_parser.c
+	    workaround for gmail IMAP bug.
+
+2008-01-29 - libetpan-0.52cvs36 - colin
+
+	* src/data-types/mailstream.c
+	    Make sure to fail on any negative return value from 
+	    mailstream_low_{write,read}, not only on -1.
+
+2008-01-25 - libetpan-0.52cvs35 - colin
+
+	* src/data-types/connect.c
+	    Fix connection failures when client and server are ipv4 
+	    and ipv6 capable, but no ip6 route exists to the server.
+
+2008-01-20 - libetpan-0.52cvs34 - hoa
+
+	* src/windows/win_init.cpp
+	    fix build for mingw32.
+	    Thanks to Marcus Brinkmann.
+
+2008-01-14 - libetpan-0.52cvs33 - hoa
+
+	* src/low-level/mime/mailmime_types_helper.c
+	* src/low-level/mime/mailmime_types_helper.h
+	* src/low-level/mime/mailmime_write_generic.c
+	    fixed cache of MIME parts when no boundary is specified.
+
+2008-01-01 - libetpan-0.52cvs32 - hoa
+
+	* rules.mk
+	    Fixed build on Solaris.
+
+2007-12-15 - libetpan-0.52cvs31 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mailstream_ssl_private.h  ** NEW FILE **
+	* src/data-types/mmapstring.c
+	* src/data-types/mmapstring_private.h      ** NEW FILE **
+	* src/windows/Makefile.am
+	* src/windows/win_init.cpp                 ** NEW FILE **
+	* src/windows/wsocket.cpp ** REMOVED FILE **
+	    Fixed lock initialization on Windows.
+	    Thanks to Sebastien Marinier and Marcus Brinkmann.
+	
+	* tests/readmsg.c
+	    Fixed build on Windows.
+
+2007-12-14 - libetpan-0.52cvs30 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Allow "too short" certificates (512 bits < len < 1024bits)
+
+2007-12-13 - libetpan-0.52cvs29 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    progress function is now called properly on IMAP.
+	
+	* tests/decrypt.c
+	* tests/fetch-attachment.c
+	* tests/pgp.c
+	* tests/smime.c
+	    Fixed build on Mac OS X.
+
+2007-12-10 - libetpan-0.52cvs28 - Marcus Brinkmann
+
+	* configure.ac
+           Do not define LIBETPAN_DLL on mingw32 targets for now.
+	
+	* libetpan-config.h.in
+           Define MMAP_UNAVAILABLE on all windows targets.
+	
+	* src/driver/implementation/data-message/data_message_driver.h
+	* src/driver/tools/mailthread.h
+	* src/engine/mailprivacy.h
+	* src/engine/mailprivacy_tools.h
+	* src/low-level/imf/mailimf_types_helper.h
+	* src/low-level/imf/mailimf_write_generic.h
+	   Add missing LIBETPAN_EXPORT declarations.
+	
+	* tests/decrypt.c
+	* tests/pgp.c
+	* tests/smime.c
+           Use read instead mmap to get file content.
+
+2007-11-25 - libetpan-0.52cvs27 - hoa
+
+	* src/low-level/mime/mailmime_content.c
+	* src/low-level/mime/mailmime_write_generic.c
+	    fixed memory leak.
+	    Thanks to astavtsev.
+
+2007-11-15 - libetpan-0.52cvs26 - hoa
+
+	* src/low-level/mime/mailmime_disposition.c
+	    fixed MIME parser for Content-Disposition.
+
+2007-11-15 - libetpan-0.52cvs25 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    fixed uninitialized variable.
+
+2007-11-14 - libetpan-0.52cvs24 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    fixed IMAP driver.
+	
+	* m4/README      *** ADDED FILE ***
+	* m4/libtool.m4  *** REMOVED FILE ***
+	    fixed build.
+
+2007-11-10 - libetpan-0.52cvs23 - hoa
+
+	* src/low-level/mime/mailmime_write_generic.c
+	    fixed quoted-printable when the given text did not finish with LF.
+
+2007-11-08 - libetpan-0.52cvs22 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    fixed IMAP parser.
+
+2007-11-07 - libetpan-0.52cvs21 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    fixed IMAP parser.
+
+2007-11-03 - libetpan-0.52cvs20 - hoa
+
+	* src/low-level/mime/mailmime_content.c
+	    fixed MIME parser. Thanks to woolshum for reporting.
+
+2007-11-01 - libetpan-0.52cvs19 - hoa
+
+	* Makefile.am
+	    fixed build.
+
+2007-10-30 - libetpan-0.52cvs18 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    support for gmail broken IMAP server.
+
+2007-10-30 - libetpan-0.52cvs18 - Marcus Brinkmann
+
+       * configure.ac
+           Substitute API_CURRENT, API_COMPATIBILITY, API_REVISION.
+           Add new variables BUILD_REVISION, BUILD_TIMESTAMP,
+           BUILD_FILEVERSION and substitute them.  Call
+           AC_LIBTOOL_WIN32_DLL and AC_LIBTOOL_RC.  Add config file
+           src/versioninfo.rc.
+       * src/dummy.cpp          *** NEW FILE ***
+       * src/versioninfo.rc.in  *** NEW FILE ***
+       * src/Makefile.am
+           (SUFFIXES, .rc.lo): New rules.
+           (EXTRA_DIST, LTRCCOMPILE, libetpan_res, libetpan_deps,
+           no_undefined, arch_sources): New variables.
+	   (libetpan@LIBSUFFIX@_la_SOURCES): Add $(arch_sources).
+	   (libetpan@LIBSUFFIX@_la_LDFLAGS): Add $(no_undefined).
+	   (libetpan@LIBSUFFIX@_la_LIBADD): Add $(libetpan_res).
+       * tests/Makefile.am
+           (CFLAGS): Add -ULIBETPAN_DLL.
+       * src/engine/mailprivacy.h
+       * src/engine/mailprivacy_gnupg.h
+       * src/engine/mailprivacy_smime.h
+           Add export declarations.
+       * src/engine/Makefile.am
+           (libengine_la_SOURCES): Add mailprivacy_tools_private.h.
+
+2007-10-30 - libetpan-0.52cvs17 - hoa
+
+	* configure.ac
+	    fixed configure.ac
+
+	* src/low-level/imf/mailimf_write.c     *** REMOVED FILE ***
+	* src/low-level/mime/mailmime_write.c   *** REMOVED FILE ***
+	    removed unused files.
+
+2007-10-27 - libetpan-0.52cvs16 - hoa
+
+	* mailprivacy_gnupg.c
+	* mailprivacy_smime.c
+	* mailprivacy_tools.c
+	* mailprivacy_tools_private.h *** NEW FILE ***
+	    spawn_and_wait() is now in mailprivacy_tools.c
+
+2007-10-27 - libetpan-0.52cvs15 - Marcus Brinkmann
+
+       * autogen.sh
+	   (libtoolize): Add -I m4 to aclocal invocation.
+	
+       * Makefile.am
+	   (EXTRA_DIST): Add COPYRIGHT.
+	   Add dependency for libetpan-config.h to
+	   $(top_builddir)/stamp-prepare.
+	   (libetpan-config.h): Fix VPATH build.
+
+       * src/driver/implementation/imap/Makefile.am:
+	   (libimap_la_SOURCES): Add imapdriver_tools_private.h.
+
+2007-10-27 - libetpan-0.52cvs14 - Marcus Brinkmann
+
+	* configure.ac
+	    Add -I${top_srcdir}/src/windows and LIBETPAN_DLL to CFLAGS
+	    on mingw32 architectures.  Also, check for arpa/inet.h and
+	    winsock2.h.  Save LIBS during iconv test.
+	* src/Makefile.am
+	    Add windows to SUBDIRS only if HAVE_MINGW32_SYSTEM.  In this
+	    case, add windows/libarch.la to libetpan.la.
+	* src/data-types/Makefile.am
+	    Remove mapping.h and mapping.c from libdata_types_la_SOURCES.
+	* src/data-types/mapping.h  *** REMOVED FILE ***
+	* src/data-types/mapping.c  *** REMOVED FILE ***
+	* src/data-types/mailstream.c
+	* src/data-types/md5.c
+	* src/low-level/imap/idle.c
+	    Include config.h and win_etpan.h conditionally.
+	* src/data-types/mailstream_cancel.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	* src/low-level/smtp/mailsmtp.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mh/mhdriver.c
+	    Include win_etpan.h conditionally.  Use WIN32 instead of _MSC_VER.
+	* src/data-types/mailstream_low.c
+	* src/windows/time_r.c
+	    Include config.h conditionally.  Use WIN32 instead of _MSC_VER.
+	* src/data-types/connect.c
+	* src/data-types/maillock.c
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_tools.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/interfaces/maildriver_tools.c
+	* src/driver/interfaces/mailstorage_tools.c
+	* src/driver/tools/mailthread.c
+	* src/driver/tools/generic_cache.c
+	* src/low-level/maildir/maildir.c
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/mh/mailmh.c
+	* src/low-level/mime/mailmime_write_generic.c
+	* src/low-level/nntp/newsnntp.c
+	* tests/readmsg-common.c
+	* src/low-level/imf/mailimf_types_helper.c
+	* src/low-level/mime/mailmime_types_helper.c
+	    Use WIN32 instead of _MSC_VER.
+	* src/data-types/mmapstring.c
+	    Include win_etpan.h for WIN32 instead of just _MSC_VER.
+	    Do not use pthread only for _MSC_VER instead all WIN32.
+	* src/driver/implementation/db/dbdriver_message.c
+	    Include win_etpan.h instead of sys/mman.h on Windows.
+	* src/engine/mailprivacy.c
+	    Include win_etpan.h instead of sys/mman.h on Windows.
+	    Use WIN32 instead of _MSC_VER.  Do not check UID on windows.
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	    Include win_etpan.h instead of sys/mman.h and sys/wait.h
+	    on Windows.  Rewrite command passphrase handling for Windows.
+	* src/engine/mailprivacy_tools.c
+	    Include win_etpan.h instead of sys/mman.h and libgen.h.
+	* src/low-level/pop3/mailpop3_socket.c
+	* src/low-level/pop3/mailpop3_ssl.c
+	    Include stdlib.h.
+	* src/windows/Makefile.am
+	    Build libarch.la.
+	* src/windows/win_etpan.h
+	    Include time.h, dirent.h and winsock2.h on HAVE_MINGW32_SYSTEM
+	    targets, and define EINPROGRESS, but not stat and dirent
+	    replacements.
+	* src/windows/wsocket.cpp
+	    Include config.h conditionally, and always include winsock2.h.
+	* tests/decrypt.c
+	* tests/pgp.c
+	* tests/smime.c
+	    Include win_etpan.h instead of sys/mman.h on Windows.
+	    Use WIN32 instead of _MSC_VER.
+	* tests/smtpsend.c
+	    Include win_etpan.h instead of sys/mman.h on Windows.  Do
+	    not define STDIN_FILENO but use standard getopt on
+	    HAVE_MINGW32_SYSTEM.  Use WIN32 instead of _MSC_VER where
+	    appropriate.
+
+2007-10-23 - libetpan-0.52cvs13 - hoa
+
+	* m4/libtool.m4  *** NEW FILE ***
+	    fixed autoreconf.
+	
+        * configure.ac
+	    Add check for mingw32 platform.  Auto-detect IPv6
+            support.  Check for pthreads-w32.
+	    Thanks to Marcus Brinkmann.
+
+2007-10-22 - libetpan-0.52cvs12 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	    Fixed memory leak in GnuTLS related code.
+	    Thanks to Colin Leroy.
+
+2007-10-20 - libetpan-0.52cvs11 - hoa
+
+	* src/driver/implementation/pop3/pop3storage.c
+	    fixed false SASL auth type for try apop.
+	    Thanks to Vasily Osadchuk.
+
+2007-10-19 - libetpan-0.52cvs10 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	    lower limits on server key length restriction
+	    on GnuTLS implementation.
+	    Thanks to Colin Leroy.
+
+2007-10-11 - libetpan-0.52cvs9 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    fixed a typo in MIME media content type.
+	    Thanks to Simon Banks.
+	
+2007-10-10 - libetpan-0.52cvs8 - hoa
+
+	* src/data-types/mailsasl.c
+	    workaround a bug of libsasl when using SASL and SSL.
+
+2007-09-22 - libetpan-0.52cvs7 - hoa
+
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached_message.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached_message.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_cached_message.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_cached_message.c
+	    changed error code when opening cache file does not work.
+
+2007-09-18 - libetpan-0.52cvs6 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    workaround Exchange authentication response.
+	    Thanks to Horia Olaru.
+
+2007-09-15 - libetpan-0.52cvs5 - hoa
+
+	* src/data-types/mailstream_socket.c
+	* src/low-level/mime/mailmime_decode.c
+	* tests/fetch-attachment.c
+	    fixed cancellation of socket write on Win32.
+	    MIME decoding of unknown charset is improved.
+	    fetch attachment will write binary files.
+
+2007-08-23 - libetpan-0.52cvs4 - hoa
+
+	* src/low-level/pop3/mailpop3.c
+	    Fixed POP3 SASL authentication.
+	    Thanks to Horia Olaru.
+
+2007-08-13 - libetpan-0.52cvs3 - hoa
+
+	* src/main/Makefile.am
+	    install libetpan.h in includedir/libetpan.h for
+	    compatibility purpose.
+
+2007-08-12 - libetpan-0.52cvs2 - hoa
+
+	* configure.ac
+	    added detection of db 4.5
+
+2007-08-08 - libetpan-0.52cvs1 - hoa
+
+	* autogen.sh
+	* configure.ac
+	    do not build doc in autogen.sh since Makefile won't exist yet.
+	    cleaned up configure.ac so that version numbers are not duplicated.
+
+	* src/driver/implementation/imap/Makefile.am
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/imap/imapdriver_message.c
+	* src/driver/implementation/imap/imapdriver_tools.[ch]
+	    - made imapdriver_tools.h public.
+	    - As requested per Matt Ronge, imap_uid_list_to_env_list()
+	      and imap_flags_to_flags() were made public.
+	    - prefixed properly external symbols.
+
+2007-08-06 - libetpan-0.52 - hoa
+
+	* release 0.52 - Plaintive Rumba
+	    fixes:
+		build when IPv6 is not supported.
+		advertised version.
+
+2007-08-06 - libetpan-0.51cvs1 - hoa
+
+	* src/data-types/connect.c
+	    build problem when IPv6 is not supported.
+
+2007-08-03 - libetpan-0.51 - alfie
+
+	* release 0.51 - Sex & Religion
+	    fixes:
+		SASL enabled build fixed
+		GnuTLS build fixed
+		BIOs handling fix for openSSL
+
+2007-07-30 - libetpan-0.50cvs6 - colin
+
+	* src/data-types/connect.c
+	    put back the (ai == NULL) test - it was alright
+	    but a break was missing in the for loop
+	* src/data-types/mailstream_ssl.c
+	    rename wait_connect to wait_SSL_connect for
+	    clarity
+
+2007-07-30 - libetpan-0.50cvs5 - colin
+
+	* src/data-types/connect.c
+	    fix non-blocking connection (select()ing for
+	    connect is on writability)
+	* src/data-types/mailstream_ssl.c
+	    fix handling of non-blocking underlying BIOs for
+	    openSSL; fix build with GnuTLS.
+
+2007-07-28 - libetpan-0.50cvs4 - hoa
+
+	* src/data-types/connect.c
+	    connection to server has timeout using
+	    mailstream_network_delay.
+
+2007-07-27 - libetpan-0.50cvs3 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    workaround broken behavior of www.safe-mail.net server.
+
+2007-07-27 - libetpan-0.50cvs2 - hoa
+
+	* src/low-level/smtp/mailsmtp.[ch]
+	    cleanup: mapped MAILSMTP_AUTH_LOGIN authentication type
+	    on SASL LOGIN mechanism.
+	
+2007-07-25 - libetpan-0.50cvs1 - hoa
+
+	* src/low-level/smtp/mailsmtp.c
+	    fixed build when SASL is enabled.
+	
+2007-07-25 - libetpan-0.50 - alfie
+
+	* release 0.50 - Used to be alright
+	    feature enhancements:
+		RSS/ATOM feed implemented
+		switched to automake build system
+		IMAP IDLE implemented
+		fetching by Message-Id implemented
+	    fixes:
+		several build fixes for Windows
+		documentation build fixed
+
+2007-07-21 - libetpan-0.49cvs32 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	    revert previous change. this was not correct.
+
+2007-07-21 - libetpan-0.49cvs31 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	    set timeout also on SSL sessions.
+
+2007-07-21 - libetpan-0.49cvs30 - hoa
+
+	* src/low-level/pop3/mailpop3.c
+	* src/low-level/smtp/mailsmtp.c
+	    As per request of libsasl debian maintainer,
+	    call to sasl_decode64() has been cleaned up.
+
+2007-07-16 - libetpan-0.49cvs29 - hoa
+
+	* doc/Makefile.am
+	    fixed build of documentation.
+
+2007-07-16 - libetpan-0.49cvs28 - hoa
+
+	* autogen.sh
+	    avoid automatic copy of GPL licence.
+
+2007-07-16 - libetpan-0.49cvs27 - hoa
+
+	* COPYRIGHT  *** ADDED FILE ***
+	    reimported COPYRIGHT file since automake will always
+	    overwrite COPYING file.
+
+2007-07-16 - libetpan-0.49cvs26 - hoa
+
+	* COPYRIGHT  *** REMOVED FILE ***
+	    changed the name of the copyright file since automake will
+	    force creation of 'COPYING' file.
+
+2007-07-16 - libetpan-0.49cvs25 - hoa
+
+	* build-windows/libetpan_version.h
+	* src/main/libetpan_version.h.in
+	* AUTHORS                                         *** NEW FILES ***
+	* Makefile.am                                     *** NEW FILES ***
+	* README                                          *** NEW FILES ***
+	* autogen.sh
+	* configure.ac                                    *** NEW FILES ***
+	* rules.mk                                        *** NEW FILES ***
+	* build-windows/Makefile.am                       *** NEW FILES ***
+	* doc/Makefile.am                                 *** NEW FILES ***
+	* doc/README.rules                                *** NEW FILES ***
+	* include/Makefile.am                             *** NEW FILES ***
+	* src/Makefile.am                                 *** NEW FILES ***
+	* src/bsd/Makefile.am                             *** NEW FILES ***
+	* src/data-types/Makefile.am                      *** NEW FILES ***
+	* src/driver/Makefile.am                          *** NEW FILES ***
+	* src/driver/implementation/Makefile.am           *** NEW FILES ***
+	* src/driver/implementation/data-message/Makefile.am *** NEW FILES ***
+	* src/driver/implementation/db/Makefile.am        *** NEW FILES ***
+	* src/driver/implementation/feed/Makefile.am      *** NEW FILES ***
+	* src/driver/implementation/hotmail/Makefile.am   *** NEW FILES ***
+	* src/driver/implementation/imap/Makefile.am      *** NEW FILES ***
+	* src/driver/implementation/maildir/Makefile.am   *** NEW FILES ***
+	* src/driver/implementation/mbox/Makefile.am      *** NEW FILES ***
+	* src/driver/implementation/mh/Makefile.am        *** NEW FILES ***
+	* src/driver/implementation/mime-message/Makefile.am *** NEW FILES ***
+	* src/driver/implementation/nntp/Makefile.am      *** NEW FILES ***
+	* src/driver/implementation/pop3/Makefile.am      *** NEW FILES ***
+	* src/driver/interface/Makefile.am                *** NEW FILES ***
+	* src/driver/tools/Makefile.am                    *** NEW FILES ***
+	* src/engine/Makefile.am                          *** NEW FILES ***
+	* src/low-level/Makefile.am                       *** NEW FILES ***
+	* src/low-level/feed/Makefile.am                  *** NEW FILES ***
+	* src/low-level/imap/Makefile.am                  *** NEW FILES ***
+	* src/low-level/imf/Makefile.am                   *** NEW FILES ***
+	* src/low-level/maildir/Makefile.am               *** NEW FILES ***
+	* src/low-level/mbox/Makefile.am                  *** NEW FILES ***
+	* src/low-level/mh/Makefile.am                    *** NEW FILES ***
+	* src/low-level/mime/Makefile.am                  *** NEW FILES ***
+	* src/low-level/nntp/Makefile.am                  *** NEW FILES ***
+	* src/low-level/pop3/Makefile.am                  *** NEW FILES ***
+	* src/low-level/smtp/Makefile.am                  *** NEW FILES ***
+	* src/main/Makefile.am                            *** NEW FILES ***
+	* src/windows/Makefile.am                         *** NEW FILES ***
+	* tests/Makefile.am                               *** NEW FILES ***
+	* INSTALL                                         *** REMOVED FILE ***
+	* Makefile.in                                     *** REMOVED FILE ***
+	* Rules.in                                        *** REMOVED FILE ***
+	* TODO                                            *** REMOVED FILE ***
+	* configure.in                                    *** REMOVED FILE ***
+	* install-sh                                      *** REMOVED FILE ***
+	* doc/Makefile                                    *** REMOVED FILE ***
+	* src/Makefile.in                                 *** REMOVED FILE ***
+	* src/data-types/Makefile                         *** REMOVED FILE ***
+	* src/driver/Makefile                             *** REMOVED FILE ***
+	* src/driver/implementation/Makefile              *** REMOVED FILE ***
+	* src/driver/implementation/data-message/Makefile *** REMOVED FILE ***
+	* src/driver/implementation/db/Makefile           *** REMOVED FILE ***
+	* src/driver/implementation/feed/Makefile         *** REMOVED FILE ***
+	* src/driver/implementation/hotmail/Makefile      *** REMOVED FILE ***
+	* src/driver/implementation/imap/Makefile         *** REMOVED FILE ***
+	* src/driver/implementation/maildir/Makefile      *** REMOVED FILE ***
+	* src/driver/implementation/mbox/Makefile         *** REMOVED FILE ***
+	* src/driver/implementation/mh/Makefile           *** REMOVED FILE ***
+	* src/driver/implementation/mime-message/Makefile *** REMOVED FILE ***
+	* src/driver/implementation/nntp/Makefile         *** REMOVED FILE ***
+	* src/driver/implementation/pop3/Makefile         *** REMOVED FILE ***
+	* src/driver/interface/Makefile                   *** REMOVED FILE ***
+	* src/driver/tools/Makefile                       *** REMOVED FILE ***
+	* src/engine/Makefile                             *** REMOVED FILE ***
+	* src/low-level/Makefile                          *** REMOVED FILE ***
+	* src/low-level/feed/Makefile                     *** REMOVED FILE ***
+	* src/low-level/imap/Makefile                     *** REMOVED FILE ***
+	* src/low-level/imf/Makefile                      *** REMOVED FILE ***
+	* src/low-level/maildir/Makefile                  *** REMOVED FILE ***
+	* src/low-level/mbox/Makefile                     *** REMOVED FILE ***
+	* src/low-level/mh/Makefile                       *** REMOVED FILE ***
+	* src/low-level/mime/Makefile                     *** REMOVED FILE ***
+	* src/low-level/nntp/Makefile                     *** REMOVED FILE ***
+	* src/low-level/pop3/Makefile                     *** REMOVED FILE ***
+	* src/low-level/smtp/Makefile                     *** REMOVED FILE ***
+	* src/main/Makefile                               *** REMOVED FILE ***
+	* tests/Makefile                                  *** REMOVED FILE ***
+	    new build system using automake so that build
+	    outside of the source folder is possible.
+	    Thanks to Marcus Brinkmann.
+
+2007-07-15 - libetpan-0.49cvs24 - hoa
+
+	* src/data-types/connect.c
+	    fixed integer sign. (bis)
+
+2007-07-14 - libetpan-0.49cvs24 - hoa
+
+	* src/data-types/connect.c
+	    fixed integer sign.
+
+2007-07-12 - libetpan-0.49cvs23 - smarinier
+
+	* build-windows/README.txt
+	* build-windows/build_headers.list
+	* build-windows/libetpan-config.h 
+	* build-windows/libetpan_version.h
+	* build-windows/libetpan/libetpan.vcproj
+		2 new projects : debug_ssl and release_ssl		
+	
+	* src/data-types/mailstream_cancel.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+		mutex, ssl for windows
+
+	* src/data-types/maillock.c
+	* src/low-level/mime/mailmime_write_mem.c
+	* src/data-types/connect.c
+			warning
+
+	* src/windows/inet_aton.c
+	* src/windows/win_etpan.h
+		inet_aton for Windows
+
+2007-07-01 - libetpan-0.49cvs22 - hoa
+
+	* src/driver/implementation/nntp/nntpstorage.c
+	* src/driver/implementation/pop3/pop3storage.c
+	    local bind feature fixed.
+
+2007-06-30 - libetpan-0.49cvs21 - hoa
+
+	* src/data-types/connect.[ch]
+	* src/driver/implementation/imap/imapdriver_types.h
+	* src/driver/implementation/imap/imapstorage.[ch]
+	* src/driver/implementation/nntp/nntpdriver_types.h
+	* src/driver/implementation/nntp/nntpstorage.[ch]
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_types.h
+	* src/driver/implementation/pop3/pop3storage.[ch]
+	* src/driver/interface/mailstorage_tools.[ch]
+	    local bind feature has been implemented.
+	    Thanks to Johannes Schlumberger.
+
+2007-06-30 - libetpan-0.49cvs20 - hoa
+
+	* src/low-level/nntp/newsnntp.c
+	    improved API to fetch article by Message ID.
+
+2007-06-29 - libetpan-0.49cvs19 - hoa
+
+	* src/low-level/nntp/newsnntp.c
+	* src/low-level/nntp/newsnntp.h
+	    allows fetch article by Message-ID.
+	    Thanks to Thomas Glanzmann.
+
+2007-05-26 - libetpan-0.49cvs18 - hoa
+
+	* src/low-level/imap/idle.c
+	* src/low-level/imap/mailimap.h
+	    fixed IMAP IDLE.
+
+2007-05-25 - libetpan-0.49cvs17 - hoa
+
+	* src/low-level/imap/Makefile
+	* src/low-level/imap/idle.[ch]     *** NEW FILES ***
+	    implemented IMAP IDLE.
+
+2007-05-25 - libetpan-0.49cvs16 - hoa
+
+	* src/data-types/mailstream_cancel.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	    fixed cancel on win32. Thanks to Andrei N. Balabohin.
+
+	* src/low-level/feed/date.c
+	    fixed include for win32.
+
+	* src/low-level/imap/mailimap.c
+	* src/low-level/imap/mailimap_types.h
+	    prepare for IMAP IDLE.
+
+2007-05-24 - libetpan-0.49cvs15 - hoa
+
+	* src/low-level/imap/acl.c
+	* src/low-level/imap/annotatemore.c
+	* src/low-level/imap/mailimap.[ch]
+	* src/low-level/imap/uidplus.c
+	    prefixed properly global symbols.
+
+2007-05-19 - libetpan-0.49cvs14 - hoa
+
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    fixed comparison.
+
+2007-05-02 - libetpan-0.49cvs13 - hoa
+
+	* src/driver/implementation/pop3/pop3driver.c
+	    get message by UID is implemented.
+
+2007-04-26 - libetpan-0.49cvs12 - hoa
+
+	* src/low-level/feed/newsfeed_item.c
+	    fixed build problem.
+
+2007-04-24 - libetpan-0.49cvs11 - hoa
+
+	* src/low-level/feed/parser.c
+	    fixed build problem.
+
+2007-04-07 - libetpan-0.49cvs10 - hoa
+
+	* src/driver/implementation/feed/feeddriver_message.c
+	    fallback on summary if no content for the given article.
+
+2007-04-07 - libetpan-0.49cvs9 - hoa
+
+	* src/low-level/feed/Makefile
+	* src/low-level/feed/newsfeed.c
+	* src/low-level/feed/parser.c
+	* src/low-level/feed/parser_atom10.h
+	* src/low-level/feed/parser_atom03.[ch]      *** NEW FILES ***
+	    fixed build. Added parser for atom 0.3
+
+2007-04-07 - libetpan-0.49cvs8 - hoa
+
+	* src/low-level/feed/Makefile
+	* src/low-level/feed/newsfeed.c
+	* src/low-level/feed/newsfeed.h
+	* src/low-level/feed/newsfeed_item.c
+	* src/low-level/feed/newsfeed_item.h
+	* src/low-level/feed/newsfeed_item_enclosure.[ch]   *** NEW FILES ***
+	* src/low-level/feed/newsfeed_types.h
+	* src/low-level/feed/parser.c
+	* src/low-level/feed/parser_rdf.c
+	* src/low-level/feed/parser_rss20.c
+	    Added a feed item enclosure, sync with rssyl-ng.
+	    Implementation of unknown charset handler for expat.
+
+2007-04-03 - libetpan-0.49cvs7 - hoa
+
+	* src/low-level/imap/mailimap.c
+	    Fixed a crash in IMAP when greeting message is empty.
+	    Thanks to ruskie for the report.
+
+2007-04-03 - libetpan-0.49cvs6 - hoa
+
+	* configure.in
+	    use of liblockfile can be disabled.
+	    Thanks to Thomas de Grenier de Latour.
+
+2007-04-03 - libetpan-0.49cvs5 - hoa
+
+	* src/low-level/mime/mailmime_decode.c
+	    fixed behavior of mailmime_encoded_phrase_parse().
+	    Thanks to Laurent Birtz.
+
+2007-01-28 - libetpan-0.49cvs4 - hoa
+
+	* build-windows/build_headers.list
+	* build-windows/libetpan/libetpan.vcproj
+	    fixed build for Windows. Thanks to Andrei N. Balabohin.
+	
+	* src/data-types/mailstream.h
+	* src/data-types/mailstream_cancel.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.[ch]
+	    Implemented stream cancel on Windows.
+	    Fixed build when SSL is not compiled in.
+	    Thanks to Andrei N. Balabohin.
+
+2007-01-28 - libetpan-0.49cvs3 - hoa
+
+	* src/driver/implementation/data-message/data_message_driver.c
+	    fill msg_fields field in mailmessage structure
+	    for data message driver.
+
+2007-01-28 - libetpan-0.49cvs2 - hoa
+
+	* configure.in
+	* build-windows/libetpan_version.h
+	* src/low-level/feed/newsfeed.c
+	* src/low-level/feed/newsfeed_private.[ch]
+	* src/low-level/feed/newsfeed_types.h
+	* src/low-level/feed/parser.c
+	* src/low-level/feed/parser_atom10.c
+	* src/low-level/feed/parser_rdf.c
+	* src/low-level/feed/parser_rss20.c
+	* src/low-level/imap/uidplus_parser.c
+	    detection for curl and expat.
+
+2007-01-18 - libetpan-0.49cvs1 - hoa
+
+	* src/driver/implementation/Makefile
+	* src/driver/implementation/feed/Makefile                ** NEW FILES **
+	* src/driver/implementation/feed/feeddriver.[ch]         ** NEW FILES **
+	* src/driver/implementation/feed/feeddriver_message.[ch] ** NEW FILES **
+	* src/driver/implementation/feed/feeddriver_types.h      ** NEW FILES **
+	* src/driver/implementation/feed/feedstorage.[ch]        ** NEW FILES **
+	* src/driver/tools/mailthread.c
+	* src/low-level/Makefile
+	* src/low-level/feed/Makefile               ** NEW FILES **
+	* src/low-level/feed/date.[ch]              ** NEW FILES **
+	* src/low-level/feed/newsfeed.[ch]          ** NEW FILES **
+	* src/low-level/feed/newsfeed_item.[ch]     ** NEW FILES **
+	* src/low-level/feed/newsfeed_private.[ch]  ** NEW FILES **
+	* src/low-level/feed/newsfeed_types.h       ** NEW FILES **
+	* src/low-level/feed/parser.[ch]            ** NEW FILES **
+	* src/low-level/feed/parser_atom10.[ch]     ** NEW FILES **
+	* src/low-level/feed/parser_rdf.[ch]        ** NEW FILES **
+	* src/low-level/feed/parser_rss20.[ch]      ** NEW FILES **
+	* src/main/libetpan.h
+	* tests/option-parser.c
+	* tests/option-parser.h
+	    implementation of RSS/ATOM feed.
+	    Still needs to write autodetection for needed libraries.
+
+2007-01-08 - libetpan-0.49 - alfie
+
+	* release 0.49 - Drive
+	    feature enhancements:
+		stream cancellation
+		better handling of ssl error
+		improved imap cache
+	    fixes:
+		various bugfixes
+
+2007-01-07 - libetpan-0.48cvs15 - hoa
+
+	* src/data-types/mailstream_ssl.[ch]
+	    remove unnecessary casts, fixed properly header.
+
+2007-01-06 - libetpan-0.48cvs14 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Cleaner type fix -- Changes mailstream_ssl_get_certificate
+	    return type to ssize_t
+
+2007-01-06 - libetpan-0.48cvs13 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Fixed size_t/int problem.
+
+2007-01-06 - libetpan-0.48cvs12 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Fixed GNUTLS build.
+
+2006-12-29 - libetpan-0.48cvs11 - hoa
+
+	* src/data-types/mailstream_cancel.c
+	* src/data-types/mailstream_ssl.c
+	    simplified code. Fixed build.
+
+2006-12-29 - libetpan-0.48cvs10 - colin
+
+	* src/data-types/mailstream_cancel.c
+	    Fix allocations
+
+2006-12-29 - libetpan-0.48cvs9 - hoa
+
+	* src/data-types/timeutils.c
+	    merged Cyrus IMAPD changes.
+	    This fixes the crash in mkgmtime().
+
+2006-12-26 - libetpan-0.48cvs8 - hoa
+
+	* src/data-types/timeutils.[ch]          ** NEW FILES **
+	* src/data-types/Makefile
+	* src/driver/tools/mailthread.c
+	* src/low-level/imf/mailimf_types_helper.[ch]
+	    avoid code duplication.
+	
+	* build-windows/build_headers.list
+	* build-windows/libetpan/libetpan.vcproj
+	    build for Windows.
+	
+	* src/data-types/mailstream_ssl.[ch]
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_types.h
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_types.h
+	* src/low-level/imap/mailimap_socket.[ch]
+	* src/low-level/imap/mailimap_ssl.[ch]
+	* src/low-level/nntp/newsnntp_ssl.[ch]
+	* src/low-level/pop3/mailpop3_socket.[ch]
+	* src/low-level/pop3/mailpop3_ssl.[ch]
+	* src/low-level/smtp/mailsmtp_socket.[ch]
+	* src/low-level/smtp/mailsmtp_ssl.[ch]
+	    added SSL callback.
+	
+	* src/driver/interface/maildriver_types.h
+	    cleanup.
+
+2006-12-23 - libetpan-0.48cvs7 - hoa
+
+	* src/data-types/mailstream_ssl.[ch]
+	    callback for SSL implemented. Thanks to Andrei N. Balabohin.
+
+2006-12-22 - libetpan-0.48cvs6 - hoa
+
+	* src/data-types/mailstream_cancel.[ch]      ** NEW FILES **
+	* src/data-types/mailstream_cancel_types.h   ** NEW FILES **
+	    cancel implemented.
+
+2006-12-22 - libetpan-0.48cvs5 - hoa
+
+	* src/data-types/Makefile
+	* src/data-types/mailstream.c
+	* src/data-types/mailstream.h
+	* src/data-types/mailstream_low.c
+	* src/data-types/mailstream_low.h
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_socket.h
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mailstream_types.h
+	    cancel implemented. breaks binary compatibility.
+	
+	* src/low-level/mime/mailmime_content.c
+	    fixed MIME parser. Thanks to Laurent Birtz.
+
+2006-12-13 - libetpan-0.48cvs4 - hoa
+
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.[ch]
+	    removed C99 structure style. Use a unique code for Unix/Windows.
+	    make a function really internal.
+	
+	* src/data-types/clist.h
+	* src/data-types/mailstream_low.c
+	* src/low-level/pop3/mailpop3.h
+	* src/low-level/pop3/mailpop3_socket.h
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_tools.c
+	* src/driver/interface/maildriver_errors.h
+	* src/low-level/imap/mailimap_ssl.[ch]
+	* src/low-level/imap/mailimap_types.h
+	* src/low-level/nntp/newsnntp_ssl.[ch]
+	* src/low-level/nntp/newsnntp_types.h
+	* src/low-level/pop3/mailpop3_ssl.[ch]
+	* src/low-level/pop3/mailpop3_types.h
+	* src/low-level/smtp/mailsmtp.c
+	* src/low-level/smtp/mailsmtp_socket.c
+	* src/low-level/smtp/mailsmtp_ssl.[ch]
+	* src/low-level/smtp/mailsmtp_types.h
+	    SSL error management.
+	    exports some functions for Windows.
+	    Thanks to Andrei N. Balabohin.
+	
+	* src/driver/implementation/mh/mhdriver.c
+	    removed warning.
+	
+	* src/low-level/imap/uidplus_types.h
+	    compilation fix for Windows.
+	    Thanks to Andrei N. Balabohin.
+
+2006-12-12 - libetpan-0.48cvs3 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/imap/mailimap_types.h
+	    Fixed code documentation.
+	
+	* src/low-level/imap/uidplus_parser.c
+	    Fixed warning. Thanks to anosek.
+	
+	* src/low-level/mime/mailmime_decode.c
+	    Interpret 'UTF8' as 'UTF-8'.
+
+2006-12-10 - libetpan-0.48cvs2 - colin
+
+	* src/low-level/imap/mailimap.c
+	    fix crash when server answers " * BYE"
+	    Fixes debian bug #398382
+
+2006-11-12 - libetpan-0.48cvs1 - hoa
+
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/imap/imapdriver_tools.c
+	    cache of bodystructure for IMAP driver.
+
+2006-10-26 - libetpan-0.48 - alfie
+
+	* release 0.48 - Hypergeek
+	    feature enhancements:
+		UIDPLUS implemented
+	    fixes:
+		various smaller code fixes
+
+2006-10-26 - libetpan-0.47cvs6 - hoa
+
+	* src/low-level/imap/mailimap_types.c
+	    fixed the code of response_info_free().
+
+2006-10-25 - libetpan-0.47cvs5 - hoa
+
+	* src/driver/implementation/db/dbdriver.c
+	    fixed the code of db_get_next_validity().
+
+2006-10-22 - libetpan-0.47cvs4 - hoa
+
+	* src/low-level/imf/mailimf_types_helper.c
+	    fixed handling of Bcc.
+
+2006-10-20 - libetpan-0.47cvs3 - hoa
+
+	* src/low-level/imap/uidplus.h
+	    fixed extern declaration.
+
+2006-10-20 - libetpan-0.47cvs2 - hoa
+
+	* src/low-level/imap/acl.[ch]
+	* src/low-level/imap/annotatemore.[ch]
+	* src/low-level/imap/mailimap_extension.[ch]
+	* src/low-level/imap/uidplus.[ch]
+	    added an API to check the capabilities.
+	    fixed UIDPLUS copy.
+
+2006-10-20 - libetpan-0.47cvs1 - hoa
+
+	* configure.in
+	* src/low-level/imap/Makefile
+	* src/low-level/imap/acl.[ch]
+	* src/low-level/imap/acl_types.c
+	* src/low-level/imap/annotatemore.[ch]
+	* src/low-level/imap/annotatemore_types.c
+	* src/low-level/imap/mailimap.[ch]
+	* src/low-level/imap/mailimap_extension.c
+	* src/low-level/imap/mailimap_extension_types.h
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/mailimap_sender.[ch]
+	* src/low-level/imap/mailimap_types.[ch]
+	    Fixed API of extension. Exported some functions.
+	
+	* src/low-level/imap/uidplus.[ch]          ** NEW FILES **
+	* src/low-level/imap/uidplus_parser.[ch]   ** NEW FILES **
+	* src/low-level/imap/uidplus_sender.[ch]   ** NEW FILES **
+	* src/low-level/imap/uidplus_types.[ch]    ** NEW FILES **
+	    implementation of UIDPLUS.
+
+2006-10-13 - libetpan-0.47 - alfie
+
+	* release 0.47 - Son Et Lumiere
+	    feature enhancements:
+		IPv6 Support
+	    fixes:
+		various leaks and crashes
+		MIME decoding fix
+		gnutls fix
+		SASL fix
+		AUTH parser fix
+
+2006-10-13 - libetpan-0.46cvs13 - alfie
+
+	* src/low-level/smtp/mailsmtp_types.h
+	    order it backward compatible.
+
+2006-10-12 - libetpan-0.46cvs12 - hoa
+
+	* src/low-level/imap/mailimap.c
+	    fixed crash.
+
+2006-10-12 - libetpan-0.46cvs11 - hoa
+
+	* src/low-level/maildir/maildir.c
+	    fixed memory leaks.
+
+2006-10-07 - libetpan-0.46cvs10 - hoa
+
+	* src/low-level/mime/mailmime_decode.c
+	    fixed MIME header decoding.
+
+2006-09-25 - libetpan-0.46cvs9 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Really fix gnutls' init.
+
+2006-09-24 - libetpan-0.46cvs8 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Fix a typo that made gnutls crash on some servers
+	    (mail.hp.com:993 for example). Sorry :-/
+
+2006-09-05 - libetpan-0.46cvs7 - hoa
+
+	* src/low-level/imap/mailimap_parser.c
+	    implemented workaround for Binc IMAP.
+	    FLAGS response can be sent with "\*" on Binc IMAP.
+	    That's not conformant to IMAP RFC.
+
+2006-08-30 - libetpan-0.46cvs6 - hoa
+
+	* src/engine/mailprivacy_smime.c
+	    improved performance of certificates collector.
+	
+	* src/low-level/imap/mailimap.c
+	* src/low-level/pop3/mailpop3.c
+	* src/low-level/smtp/mailsmtp.c
+	    fixed use of SASL.
+	    Thanks to Andrei N. Balabohin.
+
+2006-08-05 - libetpan-0.46cvs5 - hoa
+
+	* src/data-types/Makefile
+	* src/data-types/maillock.c
+	* src/main/libetpan.h
+	    exports maillock.h
+	    file descriptor is now optional.
+	
+	* src/data-types/mailstream_ssl.c
+	    disable fcntl() call on win32.
+	
+	* src/driver/implementation/imap/imapdriver_cached.c
+	    fixed a leak.
+	
+	* src/driver/implementation/nntp/nntpdriver_tools.c
+	    fixed error code.
+	
+	* src/low-level/imf/mailimf.c
+	    fixed a leak.
+	
+	* src/low-level/mime/mailmime_decode.c
+	    'unknown' character set is considered as 'iso-8859-1'.
+	
+	* src/low-level/pop3/mailpop3.c
+	    fixed AUTH parser.
+	    Thanks to Andrei N. Balabohin.
+	
+	* src/low-level/smtp/mailsmtp.c
+	* src/low-level/smtp/mailsmtp_types.h
+	    improved error management.
+	    Thanks to Andrei N. Balabohin.
+
+2006-07-15 - libetpan-0.46cvs4 - hoa
+
+	* configure.in
+	    IPv6 is enabled by default.
+
+2006-07-15 - libetpan-0.46cvs3 - hoa
+
+	* configure.in
+	* src/data-types/connect.c
+	* src/driver/interface/mailstorage_tools.c
+	    IPv6 implementation. Thanks to Didier Barvaux.
+
+2006-07-15 - libetpan-0.46cvs2 - hoa
+
+	* build-windows/libetpan_version.h
+	    fixed libetpan version for Windows.
+	    
+	* src/driver/implementation/imap/imapdriver_cached.c
+	    fixed function prototype.
+
+2006-07-14 - libetpan-0.46cvs1 - hoa
+
+	* src/low-level/imf/mailimf.c
+	    fixed a crash in case of parse error on Bcc field.
+
+2006-07-12 - libetpan-0.46 - alfie
+
+	* release 0.46 - Drawing Circles
+	    feature enhancements:
+		imap extension api
+		imap annotate
+		C89 conformance
+	    fixes:
+		fixed crash when using gnutls
+		various other (small) fixes
+
+2006-07-03 - libetpan-0.45cvs17 - skunk
+
+	* Rules.in
+	    new "prepare" rule to prevent redundant header copying
+	* install-sh
+	    updated to latest version from autoconf-2.60 package
+	* src/data-types/charconv.c
+	    moved variable declarations up to avoid having declarations 
+	    after statements, plus some minor syntax fixes
+
+2006-06-29 - libetpan-0.45cvs16 - hoa
+
+	* configure.in
+	    temporary fix for install.
+
+2006-06-28 - libetpan-0.45cvs15 - skunk
+
+	* src/data-types/mailstream.c
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/pop3/pop3driver.c
+	    checked in the remaining bits of the last patch
+
+2006-06-26 - libetpan-0.45cvs14 - hoa
+
+	* Rules.in
+	* configure.in
+	* build-windows/libetpan_version.h
+	* src/Makefile.in
+	* src/data-types/charconv.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mapping.c
+	* src/data-types/mmapstring.c
+	* src/driver/Makefile
+	* src/driver/implementation/Makefile
+	* src/driver/implementation/data-message/Makefile
+	* src/driver/implementation/data-message/data_message_driver.c
+	* src/driver/implementation/db/Makefile
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/db/dbdriver_message.c
+	* src/driver/implementation/db/dbstorage.c
+	* src/driver/implementation/hotmail/Makefile
+	* src/driver/implementation/imap/Makefile
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/imap/imapdriver_message.c
+	* src/driver/implementation/imap/imapstorage.c
+	* src/driver/implementation/maildir/Makefile
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/maildir/maildirstorage.c
+	* src/driver/implementation/mbox/Makefile
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached_message.c
+	* src/driver/implementation/mbox/mboxdriver_message.c
+	* src/driver/implementation/mbox/mboxstorage.c
+	* src/driver/implementation/mh/Makefile
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached_message.c
+	* src/driver/implementation/mh/mhdriver_message.c
+	* src/driver/implementation/mh/mhdriver_tools.c
+	* src/driver/implementation/mh/mhstorage.c
+	* src/driver/implementation/mime-message/Makefile
+	* src/driver/implementation/mime-message/mime_message_driver.c
+	* src/driver/implementation/nntp/Makefile
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_cached_message.c
+	* src/driver/implementation/nntp/nntpdriver_message.c
+	* src/driver/implementation/nntp/nntpstorage.c
+	* src/driver/implementation/pop3/Makefile
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_cached_message.c
+	* src/driver/implementation/pop3/pop3driver_message.c
+	* src/driver/implementation/pop3/pop3storage.c
+	* src/driver/interface/Makefile
+	* src/driver/interface/maildriver_types.h
+	* src/driver/tools/Makefile
+	* src/driver/tools/generic_cache.c
+	* src/engine/Makefile
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	* src/engine/mailprivacy_tools.c
+	* src/low-level/Makefile
+	* src/low-level/imap/Makefile
+	* src/low-level/imap/acl.c
+	* src/low-level/imap/acl_parser.c
+	* src/low-level/imap/acl_sender.c
+	* src/low-level/imap/acl_types.c
+	* src/low-level/imap/annotatemore.c
+	* src/low-level/imap/annotatemore_parser.c
+	* src/low-level/imap/annotatemore_sender.c
+	* src/low-level/imap/annotatemore_types.c
+	* src/low-level/imap/mailimap_extension.c
+	* src/low-level/imap/mailimap_helper.c
+	* src/low-level/imap/mailimap_keywords.c
+	* src/low-level/imap/mailimap_socket.c
+	* src/low-level/imap/mailimap_ssl.c
+	* src/low-level/imap/mailimap_types.c
+	* src/low-level/imap/mailimap_types_helper.c
+	* src/low-level/maildir/maildir.c
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/mh/mailmh.c
+	* src/low-level/mime/mailmime.c
+	* src/low-level/mime/mailmime_decode.c
+	* src/low-level/mime/mailmime_disposition.c
+	* src/low-level/mime/mailmime_types.c
+	* src/low-level/mime/mailmime_types_helper.c
+	* src/low-level/mime/mailmime_write.c
+	* src/low-level/mime/mailmime_write_file.c
+	* src/low-level/mime/mailmime_write_generic.c
+	* src/low-level/mime/mailmime_write_mem.c
+	* src/low-level/nntp/newsnntp.c
+	* src/low-level/nntp/newsnntp_socket.c
+	* src/low-level/nntp/newsnntp_ssl.c
+	* src/low-level/smtp/mailsmtp_helper.c
+	* src/low-level/smtp/mailsmtp_socket.c
+	* src/low-level/smtp/mailsmtp_ssl.c
+	* tests/readmsg-common.c
+	    conformance patch by Daniel Richard G.
+
+2006-06-16 - libetpan-0.45cvs13 - smarinier
+
+	* src/data-types/charconv.[ch]
+	    extended_charconv might be used if you don't have iconv
+	    or if you want to handle some conversions by yourself
+
+	* src//driver/interface/maildriver_types.[ch]
+	    libetpan_malloc and libetpan_freei should be used to
+	    allocate/free data freed/allocated by libetpan
+
+2006-06-07 - libetpan-0.45cvs12 - smarinier
+
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_tools.[ch]
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/interface/maildriver.[ch]
+	* src/driver/interface/maildriver_tools.[ch]
+	* src/driver/interface/maildriver_types.h
+	* src/low-level/imap/mailimap_helper.[ch]
+	* src/low-level/mime/mailmime_write_mem.c
+	* src/low-level/pop3/mailpop3_helper.[ch]
+	* tests/option-parser.[ch]
+	    use const char* when char* is not necessary (2)
+
+2006-06-06 - libetpan-0.45cvs11 - smarinier
+
+	* src/driver/implementation/imap/imapdriver.c
+	    add (slow) remove_message to imap_driver
+
+2006-06-02 - libetpan-0.45cvs10 - smarinier
+
+	* src/driver/implementation/nntp/nntpstorage.c
+	    minor bug on nn_command deletion
+
+	* src/driver/implementation/imap/imapstorage.[ch]
+	* src/driver/implementation/maildir/maildirstorage.[ch]
+	* src/driver/implementation/nntp/nntpstorage.[ch]
+	* src/driver/interface/mailstorage.[ch]
+	* src/data-types/md5.[ch]
+	* src/data-types/md5global.h
+	* src/driver/implementation/mbox/mboxstorage.[ch]
+	* src/driver/implementation/mh/mhstorage.[ch]
+	* src/driver/implementation/pop3/pop3storage.[ch]
+	    use const char* when char* is not necessary
+	
+2006-06-02 - libetpan-0.45cvs9 - hoa
+
+	* src/driver/interface/maildriver.c
+	    fixed copy-paste bug. Thanks to Sebastien Marinier.
+
+2006-05-30 - libetpan-0.45cvs8 - hoa
+
+	* configure.in
+	    support for newer version of Debian Berkeley DB.
+
+2006-05-22 - libetpan-0.45cvs7 - hoa
+
+	* autogen.sh
+	* configure.in
+	* src/data-types/carray.c
+	* src/data-types/charconv.[ch]
+	* src/data-types/chash.c
+	* src/data-types/cinthash.c
+	* src/data-types/clist.[ch]
+	* src/data-types/connect.[ch]
+	* src/data-types/mail_cache_db.c
+	* src/data-types/maillock.c
+	* src/data-types/mailsasl.c
+	* src/data-types/mailsem.c
+	* src/data-types/mailstream_helper.c
+	* src/data-types/mailstream_low.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/md5.h
+	* src/data-types/md5global.h
+	* src/data-types/mmapstring.c
+	* src/driver/implementation/data-message/data_message_driver.c
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/db/dbdriver_message.c
+	* src/driver/implementation/db/dbstorage.c
+	* src/driver/implementation/hotmail/hotmailstorage.c
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/imap/imapdriver_message.c
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/driver/implementation/imap/imapdriver_types.h
+	* src/driver/implementation/imap/imapstorage.c
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/maildir/maildirdriver_tools.c
+	* src/driver/implementation/maildir/maildirdriver_types.h
+	* src/driver/implementation/maildir/maildirstorage.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached_message.c
+	* src/driver/implementation/mbox/mboxdriver_message.c
+	* src/driver/implementation/mbox/mboxdriver_tools.c
+	* src/driver/implementation/mbox/mboxdriver_types.h
+	* src/driver/implementation/mbox/mboxstorage.c
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached_message.c
+	* src/driver/implementation/mh/mhdriver_message.c
+	* src/driver/implementation/mh/mhdriver_tools.c
+	* src/driver/implementation/mh/mhdriver_types.h
+	* src/driver/implementation/mh/mhstorage.c
+	* src/driver/implementation/mime-message/mime_message_driver.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_cached_message.c
+	* src/driver/implementation/nntp/nntpdriver_message.c
+	* src/driver/implementation/nntp/nntpdriver_tools.c
+	* src/driver/implementation/nntp/nntpdriver_types.h
+	* src/driver/implementation/nntp/nntpstorage.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_cached_message.c
+	* src/driver/implementation/pop3/pop3driver_message.c
+	* src/driver/implementation/pop3/pop3driver_tools.c
+	* src/driver/implementation/pop3/pop3driver_types.h
+	* src/driver/implementation/pop3/pop3storage.c
+	* src/driver/interface/maildriver.c
+	* src/driver/interface/maildriver_errors.h
+	* src/driver/interface/maildriver_tools.c
+	* src/driver/interface/maildriver_types.[ch]
+	* src/driver/interface/maildriver_types_helper.c
+	* src/driver/interface/mailfolder.c
+	* src/driver/interface/mailmessage.c
+	* src/driver/interface/mailmessage_tools.[ch]
+	* src/driver/interface/mailmessage_types.[ch]
+	* src/driver/interface/mailstorage.c
+	* src/driver/tools/generic_cache.c
+	* src/driver/tools/imfcache.c
+	* src/driver/tools/mailthread.c
+	* src/driver/tools/mailthread_types.[ch]
+	* src/engine/mailengine.c
+	* src/engine/mailprivacy.c
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	* src/engine/mailprivacy_tools.c
+	* src/low-level/imap/mailimap.c
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/imap/mailimap_sender.c
+	* src/low-level/imap/mailimap_socket.[ch]
+	* src/low-level/imap/mailimap_ssl.[ch]
+	* src/low-level/imap/mailimap_types.h
+	* src/low-level/imf/mailimf.c
+	* src/low-level/imf/mailimf.h
+	* src/low-level/imf/mailimf_types.h
+	* src/low-level/imf/mailimf_types_helper.[ch]
+	* src/low-level/imf/mailimf_write_generic.c
+	* src/low-level/maildir/maildir.c
+	* src/low-level/maildir/maildir_types.h
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/mbox/mailmbox_parse.c
+	* src/low-level/mbox/mailmbox_types.[ch]
+	* src/low-level/mh/mailmh.[ch]
+	* src/low-level/mime/mailmime_content.c
+	* src/low-level/mime/mailmime_decode.c
+	* src/low-level/mime/mailmime_types.h
+	* src/low-level/mime/mailmime_types_helper.c
+	* src/low-level/mime/mailmime_write_file.c
+	* src/low-level/mime/mailmime_write_generic.c
+	* src/low-level/mime/mailmime_write_mem.c
+	* src/low-level/nntp/newsnntp.h
+	* src/low-level/nntp/newsnntp_socket.[ch]
+	* src/low-level/nntp/newsnntp_ssl.[ch]
+	* src/low-level/nntp/newsnntp_types.h
+	* src/low-level/pop3/mailpop3.c
+	* src/low-level/pop3/mailpop3_helper.c
+	* src/low-level/pop3/mailpop3_socket.[ch]
+	* src/low-level/pop3/mailpop3_ssl.[ch]
+	* src/low-level/pop3/mailpop3_types.h
+	* src/low-level/smtp/mailsmtp.c
+	* src/low-level/smtp/mailsmtp_helper.[ch]
+	* src/low-level/smtp/mailsmtp_socket.c
+	* src/low-level/smtp/mailsmtp_ssl.[ch]
+	* src/low-level/smtp/mailsmtp_types.h
+	* src/main/libetpan_version.c
+	* tests/readmsg.c
+	    cleanup of libetpan.
+	    Thanks to Daniel Richard G.
+
+2006-05-17 - libetpan-0.45cvs6 - hoa
+
+	* src/data-types/charconv.c
+	    fixed UTF-8 character maximum size.
+	
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_types.h
+	    message list cache.
+	
+	* src/driver/implementation/mh/mhdriver_tools.c
+	    fixed 'From ' skipper.
+
+2006-04-16 - libetpan-0.45cvs5 - colin
+
+	* src/low-level/imap/annotatemore_types.c
+		Fix missing mailimap_annotatemore_entry_list_new
+
+2006-04-16 - libetpan-0.45cvs4 - colin
+	
+	* src/data-types/mailstream_ssl.c
+	    Fix crash on closed connection with gnutls (and make sure
+	    it won't happen with openssl), by returning -1 instead of
+	    GNUTLS_ERROR_*: mailstream_read() error return value is -1
+	    everywhere in mailstream.c
+	    Fixes debian bugs: 356325, 358882, maybe 362747
+
+2006-04-15 - libetpan-0.45cvs3 - hoa
+	
+	* src/low-level/imap/annotatemore_parser.c
+	* src/low-level/imap/annotatemore_types.c
+	* src/low-level/imap/annotatemore_types.h
+	    prefixed defines
+
+2006-04-15 - libetpan-0.45cvs2 - hoa
+	
+	* src/low-level/imap/annotatemore.[ch]            * NEW FILES *
+	* src/low-level/imap/annotatemore_parser.[ch]     * NEW FILES *
+	* src/low-level/imap/annotatemore_sender.[ch]     * NEW FILES *
+	* src/low-level/imap/annotatemore_types.[ch]      * NEW FILES *
+	* src/low-level/imap/mailimap_extension.[ch]      * NEW FILES *
+	* src/low-level/imap/mailimap_extension_types.h   * NEW FILE *
+	* src/low-level/imap/Makefile
+	* src/low-level/imap/mailimap.[ch]
+	* src/low-level/imap/mailimap_parser.[ch]
+	* src/low-level/imap/mailimap_sender.[ch]
+	* src/low-level/imap/mailimap_socket.[ch]
+	* src/low-level/imap/mailimap_types.[ch]
+	    implemented ANNOTATE extension.
+	    more flexible interface to add IMAP extensions.
+	    Thanks to Michael Leupold.
+
+2006-04-07 - libetpan-0.45cvs1 - hoa
+
+	* src/driver/interface/mailfolder.[ch]
+	    export properly functions.
+	
+	* src/data-types/connect.c
+	* src/low-level/imap/mailimap_socket.c
+	* src/low-level/nntp/newsnntp_socket.c
+	* src/low-level/pop3/mailpop3_socket.c
+	* src/low-level/smtp/mailsmtp_socket.c
+	    fixed autolookup of port numbers.
+
+2006-03-22 - libetpan-0.45
+
+	* release 0.45 - Depth Charge
+	    bugfix release
+
+2006-03-22 - libetpan-0.44cvs2 - hoa
+
+	* src/data-types/carray.h
+	* src/data-types/charconv.h
+	* src/data-types/chash.h
+	* src/data-types/mailstream_types.h
+	* src/data-types/mmapstring.h
+	* src/low-level/mime/mailmime_types.h
+		fixed includes
+
+2006-03-20 - libetpan-0.44cvs1 - hoa
+
+	* src/data-types/carray.h
+	* src/data-types/charconv.h
+	* src/data-types/chash.h
+	* src/data-types/mailstream_types.h
+	* src/data-types/mmapstring.h
+	* src/low-level/mime/mailmime_types.h
+	    fixed includes
+
+2006-03-10 - libetpan-0.44
+
+	* release 0.44 - Lateralus
+	    bugfix release
+	    fixed versions
+
+2006-03-08 - libetpan-0.43
+
+	* release 0.43 - Lateralus
+	    bugfix release
+
+2006-03-08 - libetpan-0.42cvs5 - hoa
+
+	* ChangeLog
+	* libetpan-config.in
+	    prepare for release
+
+2006-02-15 - libetpan-0.42cvs4 - colin
+
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mailstream_ssl.h
+	    Implement certificate retrieval
+
+2006-02-15 - libetpan-0.42cvs3 - colin
+
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mailstream_ssl.h
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/low-level/smtp/mailsmtp_socket.c
+	    After a bit of googling (and checking SC's sources too), it 
+	    seems that
+	    - use SSLv23 for SSL connections
+	    - use TLSv1 for STARTTLS connections
+	    is the way to go.
+
+	    This patch implements a new mailstream_low_tls_open() to 
+	    complement mailstream_low_ssl_open(), which allows caller 
+	    to use what it needs.
+	    Tested with a few differents servers:
+	    - STARTTLS works ok, SSL works ok with an openssl-libetpan
+	    - STARTTLS works ok, SSL works ok with a gnutls-libetpan
+	    - one server, the one mentioned in bug 911, doesn't get 
+	      TLSv1 at all, and insists on SSLv23 even with 
+	      STARTTLS, which I think is a server bug
+
+	    Finally, Gnutls must do stuff differently (more automagically) 
+	    than
+	    openssl because there's no need to specify the protocol to use, 
+	    it just
+	    works with SSL and STARTTLS.
+
+	    Updated drivers too.
+
+2006-02-14 - libetpan-0.42cvs2 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Use SSLv23 instead of TLSv1, seems to be more 
+	    universal
+
+2006-02-09 - libetpan-0.42cvs1 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Fix return value when we get SSL_ERROR_ZERO_RETURN
+
+2006-01-09 - libetpan-0.42
+
+	* release 0.41 - Figure Number Five
+	    bugfix release
+
+2006-01-04 - libetpan-0.41cvs10 - hoa
+
+	* autogen.sh
+	* configure.in
+	* src/Makefile.in
+	    fixed build.
+	
+	* src/low-level/smtp/mailsmtp.c
+	    fixed SMTP SASL login.
+	
+	* src/main/libetpan.h
+	    added public API.
+
+2005-12-22 - libetpan-0.41cvs9 - hoa
+
+	* src/engine/mailprivacy_tools.[ch]
+	    fixed visibility of functions.
+
+2005-12-20 - libetpan-0.41cvs8 - hoa
+
+	* src/low-level/maildir/maildir.c
+	    fixed maildir expunge.
+
+	* src/low-level/smtp/mailsmtp.[ch]
+	    implemented SMTP RSET (reset).
+
+2005-12-18 - libetpan-0.41cvs7 - hoa
+
+	* src/low-level/smtp/mailsmtp.[ch]
+	    implemented SMTP NOOP.
+
+2005-12-16 - libetpan-0.41cvs6 - hoa
+
+	* Makefile.in
+	    added empty target 'test'
+	
+	* src/data-types/mailsem.c
+	* src/engine/mailengine.c
+	    fixed build when disabling thread safety.
+
+2005-12-16 - libetpan-0.41cvs5 - hoa
+
+	* src/engine/mailprivacy_tools.c
+	    fixed quoting of filename in shell calls.
+
+2005-12-07 - libetpan-0.41cvs4 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	    fixed build when SSL is not available.
+
+2005-12-07 - libetpan-0.41cvs3 - hoa
+
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	    fixed quoting of filename in shell calls.
+
+2005-12-04 - libetpan-0.41cvs2 - hoa
+
+	* configure.in
+	    fixed libtool version
+
+2005-12-02 - libetpan-0.41cvs1 - hoa
+
+	* src/engine/mailengine.c
+	    fixed crash.
+
+2005-12-02 - libetpan-0.41
+
+	* release 0.41 - Transfixion
+	    passphrase is implemented for S/MIME and PGP.
+	    avoid symbols conflict between GnuTLS and OpenSSL.
+
+2005-11-30 - libetpan-0.40cvs6 - hoa
+
+	* src/engine/mailprivacy.c
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	* src/engine/mailprivacy_tools.[ch]
+	   fixed signing.
+	
+	* tests/smime.c
+	    display needed passphrase.
+
+2005-11-21 - libetpan-0.40cvs5 - hoa
+
+	* configure.in
+	    OpenSSL has priority in detection.
+	
+	* src/engine/mailprivacy.[ch]
+	* src/engine/mailprivacy_gnupg.[ch]
+	* src/engine/mailprivacy_smime.[ch]
+	* src/engine/mailprivacy_tools.[ch]
+	* src/engine/mailprivacy_types.h
+	    implemented support of passphrase.
+
+	* tests/Makefile
+	* tests/frm-common.c
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	    fixed compilation of tests.
+
+	* tests/pgp.c                          * NEW FILE *
+	* tests/smime.c                        * NEW FILE *
+	* tests/decrypt.c                      * NEW FILE *
+	    some tests for S/MIME, PGP.
+
+2005-10-09 - libetpan-0.40cvs4 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    Try to finish handshaking when 
+	    possible with gnutls.
+
+2005-10-09 - libetpan-0.40cvs3 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    fixed deadlock on the mutex
+
+2005-10-09 - libetpan-0.40cvs2 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    fixed compilation with GnuTLS
+
+2005-10-09 - libetpan-0.40cvs1 - hoa
+
+	* configure.in
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mailstream_ssl.h
+	    avoid symbols conflicts between OpenSSL and GnuTLS.
+	    Thanks to Colin Leroy.
+
+2005-10-07 - libetpan-0.40 - hoa
+
+	* release 0.40 - Kashmir
+	    SSL initialization is optional.
+
+2005-10-06 - libetpan-0.39cvs2 - hoa
+
+	* src/Makefile.in
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	    fixed compilation on Solaris.
+
+2005-10-02 - libetpan-0.39cvs1 - hoa
+
+	* src/data-types/mailstream_low.c
+	* src/data-types/mailstream_ssl.[ch]
+	* src/low-level/imap/mailimap_ssl.c
+	* src/low-level/nntp/newsnntp_ssl.c
+	* src/low-level/pop3/mailpop3_ssl.c
+	* src/low-level/smtp/mailsmtp_ssl.c
+	* tests/frm.c
+	    SSL initialization is optional
+		fixed SSL port
+		fixed warning in tests
+
+2005-09-16 - libetpan-0.39 - hoa
+
+	* release 0.39 - Deliverance
+	    compatibility with GnuTLS
+		SASL for higher level
+
+2005-09-12 - libetpan-0.38cvs5 - colin
+
+	* src/data-types/mailstream_ssl.c
+	    fixed compatibility with GnuTLS.
+
+2005-08-17 - libetpan-0.38cvs4 - hoa
+
+	* src/engine/mailprivacy_smime.c
+	    fixed crash when a S/MIME 2 signed message does not verify.
+
+2005-08-14 - libetpan-0.38cvs3 - hoa
+
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_types.h
+	* src/driver/implementation/imap/imapstorage.c
+	* src/driver/implementation/imap/imapstorage.h
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_types.h
+	* src/driver/implementation/pop3/pop3storage.c
+	* src/driver/implementation/pop3/pop3storage.h
+	* src/driver/interface/maildriver.c
+	* src/driver/interface/maildriver.h
+	* src/driver/interface/maildriver_types.h
+	* src/driver/interface/mailstorage_tools.c
+	* src/driver/interface/mailstorage_tools.h
+	    implemented SASL at higher level API.
+
+	* src/engine/mailprivacy_smime.c
+	    support for Outlook signed messages.
+
+2005-08-13 - libetpan-0.38cvs2 - hoa
+
+	* src/data-types/mailstream.c
+	* src/data-types/mailstream_socket.c
+	* src/data-types/mailstream_ssl.c
+	* src/driver/implementation/data-message/data_message_driver.c
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/db/dbdriver_message.c
+	* src/driver/implementation/db/dbstorage.c
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	* src/driver/implementation/imap/imapdriver_message.c
+	* src/driver/implementation/imap/imapstorage.c
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/maildir/maildirstorage.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached_message.c
+	* src/driver/implementation/mbox/mboxdriver_message.c
+	* src/driver/implementation/mbox/mboxstorage.c
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached_message.c
+	* src/driver/implementation/mh/mhdriver_message.c
+	* src/driver/implementation/mh/mhstorage.c
+	* src/driver/implementation/mime-message/mime_message_driver.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver_cached_message.c
+	* src/driver/implementation/nntp/nntpdriver_message.c
+	* src/driver/implementation/nntp/nntpstorage.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_cached_message.c
+	* src/driver/implementation/pop3/pop3driver_message.c
+	* src/driver/implementation/pop3/pop3storage.c
+	* src/driver/interface/mailstorage_tools.c
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	    fixed build on Solaris.
+	    Thanks to Alex S. Moore.
+
+2005-08-13 - libetpan-0.38cvs1 - hoa
+
+	* src/low-level/mbox/mailmbox.c
+	    switched from LF to CRLF.
+	    Thanks to Alfons Hoogervorst.
+
+2005-07-20 - libetpan-0.38 - hoa
+
+    * release 0.38 - Deadwing
+
+	* fixed SSL
+	* IMAP improvements
+	* SASL
+
+2005-07-18 - libetpan-0.37cvs6 - hoa
+
+	* src/low-level/imap/mailimap_sender.c
+	    atom is not quoted for now when a dash is to be sent
+	   (workaround a problem in old Courier and old DoveCot IMAP servers)
+
+2005-07-16 - libetpan-0.37cvs5 - hoa
+
+	* configure.in
+	* libetpan-config.in
+	* src/data-types/Makefile
+	* src/low-level/imap/mailimap.[ch]
+	* src/low-level/imap/mailimap_sender.[ch]
+	* src/low-level/imap/mailimap_types.h
+	* src/low-level/pop3/mailpop3.[ch]
+	* src/low-level/pop3/mailpop3_types.h
+	* src/low-level/smtp/mailsmtp.[ch]
+	* src/low-level/smtp/mailsmtp_types.h
+	* src/data-types/mailsasl.[ch]            ** NEW FILES **
+	    implemented SASL.
+
+	* src/low-level/imap/mailimap_parser.c
+	    fixed IMAP parser.
+
+2005-07-15 - libetpan-0.37cvs4 - hoa
+
+	* configure.in
+	* src/data-types/mailstream_low.c
+	    fixed version number. fixed custom logger.
+
+2005-07-15 - libetpan-0.37cvs3 - hoa
+
+	* src/data-types/mailstream.h
+	* src/data-types/mailstream_low.c
+	    changed API for custom logger (added direction of stream).
+
+2005-07-15 - libetpan-0.37cvs2 - hoa
+
+	* src/data-types/mailstream.h
+	* src/data-types/mailstream_low.c
+	    added a custom logger for applications.
+
+2005-07-15 - libetpan-0.37cvs1 - hoa
+
+	* src/data-types/mailstream_ssl.c
+	    fixed SSL write, thanks to Stephan Holl, Colin Leroy
+
+2005-07-03 - libetpan-0.37 - hoa
+
+    * release 0.37 - Deadwing
+
+	* windows port
+	* fixed IMAP implementation (for sylpheed)
+
+2005-06-28 - libetpan-0.36cvs18 - hoa
+
+	* src/low-level/imap/mailimap_sender.c
+	    fixed storage of flags.
+
+2005-06-19 - libetpan-0.36cvs17 - hoa
+
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	    fixed double fclose(). Thanks to Nyoxi.
+
+2005-06-13 - libetpan-0.36cvs16 - hoa
+
+	* src/engine/mailengine.c
+	    fixed thread safety for reference count.
+
+	* src/low-level/mh/mailmh.c
+	    fixed MH (addition of messages).
+
+2005-06-01 - libetpan-0.36cvs15 - hoa
+
+	* libetpan-config.h.in
+	* src/data-types/maillock.c
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/mh/mhdriver_tools.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/interface/maildriver_tools.c
+	* src/driver/tools/generic_cache.c
+	* src/low-level/imap/mailimap_types.h
+	* src/low-level/imf/mailimf_types.h
+	* src/low-level/imf/mailimf_types_helper.c
+	* src/low-level/maildir/maildir_types.h
+	* src/low-level/mh/mailmh.h
+	* src/low-level/mime/mailmime_types_helper.c
+	* src/low-level/mime/mailmime_write_generic.c
+	* src/low-level/nntp/newsnntp_types.h
+	* src/low-level/pop3/mailpop3_types.h
+	* src/low-level/smtp/mailsmtp_socket.h
+	* src/low-level/smtp/mailsmtp_types.h
+	* src/windows/win_etpan.h
+	* src/windows/wsocket.cpp
+	    fixed linux build.
+
+2005-06-01 - libetpan-0.36cvs14 - hoa
+
+	* src/data-types/mail_cache_db.c
+	* src/driver/implementation/db/dbdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_tools.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/tools/generic_cache.c
+	* src/driver/tools/imfcache.c
+	* src/engine/mailprivacy.c
+	* src/engine/mailprivacy_smime.c
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/imap/mailimap_sender.c
+	* src/low-level/imf/mailimf.c
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/mime/mailmime.c
+	* src/low-level/mime/mailmime_decode.c
+	* src/low-level/mime/mailmime_disposition.c
+	* src/low-level/nntp/newsnntp.c
+	* src/low-level/pop3/mailpop3.c
+	* src/low-level/smtp/mailsmtp.c
+	    fixed gcc 4.0 warnings.
+
+2005-06-01 - libetpan-0.36cvs13 - hoa
+
+	* src/data-types/maillock.c
+	* src/data-types/mailstream_socket.c
+	    fixed some warnings.
+
+2005-06-01 - libetpan-0.36cvs12 - smarinier
+
+	* most files
+	    Windows port
+
+2005-05-27 - libetpan-0.36cvs11 - hoa
+
+	* src/data-types/chash.c
+	    don't use tables of size 0.
+	
+	* src/data-types/mailsem.c
+	    includes missing header.
+	
+	* src/engine/mailprivacy_smime.c
+	    insert part even if decoding failed.
+
+2005-05-22 - libetpan-0.36cvs10 - g_roualland
+
+	* configure.in
+	* Makefile.in
+	    change the way libetpan-config.h is generated to cope with 
+	    cross compilers and external build directories. 
+
+2005-05-19 - libetpan-0.36cvs9 - hoa
+
+	* src/driver/interface/mailfolder.c
+	    reconnect on POP3 fetch of message list.
+
+	* src/low-level/pop3/mailpop3.c
+	    fixed crash on mailpop3_quit() in case
+	    of bad state.
+
+2005-04-25 - libetpan-0.36cvs8 - hoa
+
+	* src/data-types/mail_cache_db.c
+	    fixed test of error codes.
+
+2005-04-18 - libetpan-0.36cvs7 - hoa
+
+	* src/data-types/carray.c
+	    don't allow zero-sized array.
+	    That will avoid infinite loops.
+
+2005-04-12 - libetpan-0.36cvs6 - hoa
+
+	* src/data-types/mailsem.c
+	    use unique implementation of semaphore.
+
+2005-04-08 - libetpan-0.36cvs5 - hoa
+
+	* src/data-types/mail_cache_db.c
+	    fixed test of error codes.
+
+2005-04-07 - libetpan-0.36cvs5 - hoa
+
+	* autogen.sh
+	    support for Mac OS X
+	
+	* src/data-types/charconv.c
+	    fixed error code.
+	
+	* src/data-types/mail_cache_db.c
+	* src/data-types/mail_cache_db.h
+	    added function to retrieve the list of keys.
+	
+	* src/data-types/mailsem.c
+	    fixed semaphore.
+	
+	* src/driver/tools/mailthread.c
+	    made mailthread thread safe.
+
+2005-03-12 - libetpan-0.36cvs4 - hoa
+
+	* configure.in
+	* src/Makefile.in
+	* src/data-types/mailstream_ssl.c
+	    support for GNUTLS.
+	    Thanks from Rajko Albrecht.
+	
+	* src/data-types/mailsem.c
+	    disable semaphore when reentrant support is disabled.
+	    Thanks from Rajko Albrecht.
+	
+	* src/driver/implementation/imap/imapdriver_cached.c
+	    fixed false error in cached IMAP driver.
+
+2005-03-04 - libetpan-0.36cvs3 - hoa
+
+	* src/data-types/mail_cache_db.c
+	    reorder unlock() and close()
+	
+	* src/data-types/mailsem.c
+	    implements properly the semaphore.
+
+2005-02-28 - libetpan-0.36cvs2 - hoa
+
+	* Rules.in
+	    fixed build when the exported header list is empty.
+	    Thanks to Alfons Hoogervorst.
+	
+	* doc/README.sgml
+	    removed version numbers.
+
+2005-02-28 - libetpan-0.36cvs1 - g_roualland
+
+	* src/data-types/mail_cache_db.c
+	    fix DB cursor call when running on db2 < 2.6
+	    Thanks to Alfons Hoogervorst.
+
+2005-02-22 - libetpan-0.36 - hoa
+
+    * release 0.36 - Silver Drop
+
+        * memory leak
+        * fixed maildir support
+
+2005-02-17 - libetpan-0.35cvs4 - hoa
+
+	* src/engine/mailprivacy.c
+	    does not check for owner of the folder:
+	    this is the responsibility of the application.
+
+2005-01-31 - libetpan-0.35cvs3 - hoa
+
+	* src/data-types/mmapstring.c
+	* src/engine/mailengine.c
+	    reverted to initial in code in non-debug mode.
+	    fixed thread safety.
+
+2005-01-29 - libetpan-0.35cvs2 - hoa
+
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/low-level/mime/mailmime_types.c
+	    fixed some memory leaks.
+
+2005-01-28 - libetpan-0.35cvs1 - hoa
+
+	* src/data-types/mailsem.c
+	    support for Cygwin.
+	
+	* src/driver/implementation/db/dbdriver.c
+	    removed a log.
+	
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/engine/mailengine.c
+	    fixed some memory leaks.
+	
+	* src/engine/mailprivacy_tools.c
+	    internal version of basename() can be used.
+	
+	* src/low-level/maildir/maildir.c
+	    fixed update of Maildir mailbox.
+	
+	* src/low-level/pop3/mailpop3.[ch]
+	    fixed data types to non-fixed size integers.
+
+2004-12-28 - libetpan-0.35 - hoa
+
+    * release 0.35 - Dimebag Darrell
+
+	* minor bugfixes.
+
+2004-12-27 - libetpan-0.34cvs8 - hoa
+
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_smime.c
+	    fixed syntax error.
+
+	* src/low-level/maildir/maildir.c
+	    avoid stat() on maildir files.
+
+	* src/main/libetpan.h
+	    enabled hotmailstorage.
+
+2004-12-13 - libetpan-0.34cvs7 - hoa
+
+	* src/driver/implementation/mime-message/mime_message_driver.[ch]
+	    MIME message driver will no more need temporary files.
+
+2004-12-13 - libetpan-0.34cvs6 - hoa
+
+	* src/low-level/mime/mailmime_content.c
+	    fixed MIME parser. MIME parts does not include
+	    the boundary CR LF.
+
+2004-12-12 - libetpan-0.34cvs5 - hoa
+
+	* src/data-types/mail_cache_db.c
+	* src/driver/implementation/db/dbdriver.c
+	    fixed data types and uninitialized variable.
+
+	* src/driver/implementation/maildir/maildirdriver_tools.c
+	* src/driver/implementation/mh/mhdriver_tools.c
+	* src/driver/interface/maildriver_errors.h
+	* src/low-level/imap/mailimap_parser.c
+	* src/low-level/maildir/maildir.c
+	* src/low-level/maildir/maildir_types.h
+	* src/low-level/mh/mailmh.c
+	    now use rename() when link() is not available.
+	    Thanks to Lutz Rogowski.
+	
+	* src/low-level/mime/mailmime_decode.c
+	    fixed a memory leak. Thanks to Lutz Rogowski.
+
+2004-11-14 - libetpan-0.34cvs4 - hoa
+
+	* src/low-level/mime/mailmime_content.c
+	    fixed MIME parser.
+	    Problem appeared when there when a boundary identifier
+	    was prefix of an other boundary identifier (1065539).
+
+2004-11-14 - libetpan-0.34cvs3 - hoa
+
+	* src/low-level/maildir/maildir.c
+	    maildir_update() now creates an empty file named maildirfolder.
+
+2004-11-14 - libetpan-0.34cvs2 - hoa
+
+	* src/data-types/maillock.c
+	    fixed locks when using liblockfile.
+
+2004-11-13 - libetpan-0.34cvs1 - hoa
+
+	* src/data-types/maillock.c
+	    fixed locks when using liblockfile.
+	
+	* src/data-types/mmapstring.c
+	    additional checks.
+	   
+	* src/driver/interface/maildriver_errors.h
+	    clean up of code.
+	
+	* src/low-level/imf/Makefile
+	* src/low-level/imf/mailimf.h
+	* src/low-level/imf/mailimf_write_file.[ch]   ** NEW FILES **
+	* src/low-level/imf/mailimf_write_mem.[ch]    ** NEW FILES **
+	* src/low-level/mime/Makefile
+	* src/low-level/mime/mailmime.h
+	* src/low-level/mime/mailmime_write_file.[ch] ** NEW FILES **
+	* src/low-level/mime/mailmime_write_mem.[ch]  ** NEW FILES **
+	    messages can be rendered into a MMAPString.
+
+2004-11-04 - libetpan-0.34 - hoa
+
+    * release 0.34 - edge
+
+	    * general
+			- support for debian systems mbox
+			- ability to disable thread-safe support
+
+2004-11-04 - libetpan-0.33cvs7 - hoa
+
+	* src/data-types/mailstream.c
+	* src/data-types/mailstream_helper.[ch]
+	* src/data-types/mailstream_low.c
+	    debug logs are just before low-level.
+	    helper functions to send multi-lines data.
+	
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	    limit requests to imap server (compatibility with iPlanet).
+	
+	* src/low-level/imap/mailimap.c
+	* src/low-level/imap/mailimap_sender.c
+	    fixed send of literal, add proper CR LF 
+	    (compatibility with Cyrus).
+	
+	* src/low-level/mh/mailmh.h
+	    removed reference to deprecated cinthash
+	
+	* src/low-level/nntp/newsnntp.h
+	    removed inexistant function in header.
+
+2004-10-17 - libetpan-0.33cvs6 - g_roualland
+
+	* configure.in
+	    Add a "--disable-threads" option to compile without pthread.
+	    In that case the library is named as "libetpan-no-mt".
+	    Added a LIBETPAN_REENTRANT define which is true if multithreading
+	    is available.
+	    Added pthread avaibility detection.
+
+	* libetpan-config.in
+	* src/Makefile.in
+	    update to include thread options and the correct name for the
+	    library. fix make clean to remove libs
+	
+	* src/main/libetpan-version.h.in
+	    define LIBETPAN_REENTRANT if the library was compiled as
+	    reentrant.
+
+	* src/data-types/mailstream_ssl.c
+	* src/data-types/mmapstring.c
+	* src/engine/mailengine.c
+	    do not include pthread calls if not reentrant.
+
+2004-10-17 - libetpan-0.33cvs5 - hoa
+
+	* Makefile.in
+	* Rules.in
+	    fixed precopy of headers.
+	
+	* src/low-level/mbox/mailmbox.c
+	    fixed write of mailbox files on debian systems.
+	
+	* src/low-level/mime/mailmime_write.c
+	    fixed a bug. Thanks to Melvin.
+
+2004-09-29 - libetpan-0.33cvs4 - hoa
+
+	* configure.in
+	* src/data-types/maillock.c
+	* src/low-level/mbox/mailmbox.c
+	    support for mailboxes on debian systems.
+
+2004-09-03 - libetpan-0.33cvs3 - hoa
+
+	* src/engine/mailengine.c
+	    can remove storage or folder twice.
+
+2004-09-02 - libetpan-0.33cvs2 - hoa
+
+	* src/driver/interface/maildriver_errors.h
+	* src/driver/tools/mailthread.[ch]
+	* src/driver/tools/mailthread_types.h
+	    can build a tree of messages without message threading
+	
+	* src/data-types/mailsem.[ch]
+	    added semaphore
+
+
+2004-08-28 - libetpan-0.33cvs1 - hoa
+
+	* src/driver/implementation/mh/mhdriver_tools.c
+            fixed the workaround MH mailboxes with messages
+            containing 'From ' header.
+		
+
+2004-08-24 - libetpan-0.33 - hoa
+
+    * release 0.33 - entropia
+
+	    * general
+			- bugfixes in IMAP module and mailstream
+			- fixed low-level data structures
+			- better support for ARM and PPC architecture
+			- support for cross-compilation
+			- fixed Berkeley DB support
+			- changed folder structure of libetpan package
+			- can now add a message to a mailbox with flags
+			- support for hotmail mailboxes (with help of hotwayd)
+			- added Berkeley DB mail storage as experimental
+			- added support for PGP and S/MIME
+			- better folder API
+
+
+2004-08-22 - libetpan-0.32cvs18 - hoa
+
+	* Makefile.in
+	* Rules.in
+	* src/main/libetpan.h
+	    Fixed header inclusion.
+	    Fixed installation of headers.
+
+2004-08-22 - libetpan-0.32cvs17 - hoa
+
+	* Makefile.in
+	* autogen.sh
+	* configure.in
+	* src/Makefile.in
+	* src/main/libetpan.h
+	    Better detection of iconv.
+	    Some fixes in build process.
+	    Documentation is generated at prepackaging.
+	    Engine added to build process.
+	
+	* doc/API.sgml
+	* doc/Makefile
+	* doc/README.sgml
+	    Updated documentation
+	
+	* src/data-types/charconv.c
+	    Better detection of iconv.
+	    
+	* src/data-types/mail_cache_db.c
+	    Fixed db wrapper.
+	    
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver_cached_message.c
+	* src/driver/implementation/mbox/mboxdriver_message.c
+	* src/driver/implementation/mbox/mboxdriver_tools.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/mh/mhdriver_cached_message.c
+	* src/driver/implementation/mh/mhdriver_message.c
+	* src/driver/implementation/mh/mhdriver_tools.c
+	    Fixed format of UID, in several drivers.
+	    
+	* src/driver/interface/mailfolder.c
+	* src/driver/interface/mailfolder.h
+	* src/driver/interface/mailstorage.c
+	* src/driver/interface/mailstorage.h
+	    we can now append messages with their flags.
+	    
+	* src/engine/Makefile
+	* src/engine/mailengine.c
+	* src/engine/mailengine.h
+	* src/engine/mailprivacy.h
+	* src/engine/mailprivacy_gnupg.c
+	* src/engine/mailprivacy_gnupg.h
+	* src/engine/mailprivacy_smime.c
+	* src/engine/mailprivacy_smime.h
+	* src/engine/mailprivacy_tools.c
+	* src/engine/mailprivacy_tools.h
+	* src/engine/mailprivacy_types.h
+	* src/low-level/imap/mailimap_keywords.c
+	* src/low-level/mbox/mailmbox.c
+	* src/low-level/mime/mailmime_write.c
+	    remove hash global to storage to find folder of messages
+	
+2004-07-28 - libetpan-0.32cvs16 - g_roualland
+
+	* acconfig.h					* REMOVED FILE *
+	* configure.in
+	    Convert old, deprecated autoconf defines to 2.5 like.
+
+	* Makefile.in
+	    Do not look for acconfig.h, remove autoconf cache on clean.
+
+	* src/Makefile.in
+	    Make sure "make clean" works even when the library was not built.
+
+	* Makefile.in
+	* Rules.in
+	* src/Makefile.in
+	    Support for DESTDIR to install in another root.
+	    Patch from Rajko Albrecht <ral@alwins-world.de>
+
+	* src/driver/implementation/imap/imapdriver_cached_message.c
+	    Fix a GCC 3.4 compiling issue with labels.
+	    Patch from Rajko Albrecht <ral@alwins-world.de>
+
+2004-05-23 - libetpan-0.32cvs15 - hoa
+
+	* Makefile.in
+	* Rules.in
+	    fixed building and installing.
+	    
+	* configure.in
+	    improved support for Berkeley DB
+	    (thanks to Nikita V. Youshchenko).
+	
+	* doc/README.sgml
+	    updated documentation.
+	
+	* src/data-types/mail_cache_db.[ch]
+	    added function to get size of a given item.
+	
+	* src/data-types/mailstream_helper.c
+	    fixed a crash when sending of data.
+	
+	* src/driver/implementation/Makefile
+	* src/driver/implementation/imap/imapstorage.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mbox/mboxstorage.c
+	* src/driver/implementation/mh/mhstorage.c
+	* src/driver/implementation/nntp/nntpstorage.c
+	    code cleanup.	
+	    
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/implementation/pop3/pop3driver_message.c
+	* src/driver/implementation/pop3/pop3storage.c
+	   implemented get_message_by_uid()
+	   (Thanks to Toni Willberg).
+	   
+	* src/driver/implementation/maildir/maildirdriver_cached_message.c
+	* src/driver/implementation/maildir/maildirdriver_message.c
+	* src/driver/implementation/maildir/maildirstorage.[ch]
+	    implemented get_flags().
+
+	* src/main/libetpan.h
+	* src/driver/implementation/db/Makefile               ** NEW FILE **
+	* src/driver/implementation/db/dbdriver.[ch]          ** NEW FILES **
+	* src/driver/implementation/db/dbdriver_message.[ch]  ** NEW FILES **
+	* src/driver/implementation/db/dbdriver_types.h       ** NEW FILE **
+	* src/driver/implementation/db/dbstorage.[ch]         ** NEW FILES **
+	    added mail DB driver (using a Berkeley DB storage).
+	
+	* hotmail/Makefile                                    ** NEW FILE **
+	* hotmail/hotmailstorage.[ch]                         ** NEW FILES **
+	    added support for hotmail (using hotwayd and POP3 driver)
+	
+	* tests/Makefile
+	* tests/readmsg-uid.c                                 ** NEW FILE **
+	    added example for get_message_by_uid()
+
+2004-05-04 - libetpan-0.32cvs14 - hoa
+
+	* src/driver/implementation/imap/imapdriver.c
+	* src/driver/implementation/imap/imapdriver_cached.c
+	* src/driver/implementation/imap/imapdriver_tools.[ch]
+	* src/driver/implementation/maildir/maildirdriver.c
+	* src/driver/implementation/maildir/maildirdriver_cached.c
+	* src/driver/implementation/mbox/mboxdriver.c
+	* src/driver/implementation/mbox/mboxdriver_cached.c
+	* src/driver/implementation/mh/mhdriver.c
+	* src/driver/implementation/mh/mhdriver_cached.c
+	* src/driver/implementation/nntp/nntpdriver.c
+	* src/driver/implementation/nntp/nntpdriver_cached.c
+	* src/driver/implementation/pop3/pop3driver.c
+	* src/driver/implementation/pop3/pop3driver_cached.c
+	* src/driver/interface/maildriver.[ch]
+	* src/driver/interface/maildriver_types.h
+	    mailsession_append_message_flags() adds a message
+	    in a mailbox with its flags. It is implemented in
+	    IMAP, mbox, maildir and MH drivers.
+	
+	* src/low-level/maildir/maildir.[ch]
+	* src/low-level/mbox/mailmbox.[ch]
+	* src/low-level/mbox/mailmbox_types.[ch]
+	* src/low-level/mh/mailmh.[ch]
+	    get identifier of the message when we add a message
+	    in a mailbox.
+
+2004-05-02 - libetpan-0.32cvs13 - hoa
+
+	* Makefile.in
+	* Rules.in
+	* configure.in
+	* src/Makefile.in                                    * NEW FILES *
+	* src/data-types/Makefile
+	* src/data-types/mmapstring.c
+	* src/driver/Makefile
+	* src/driver/implementation/Makefile                 * NEW FILES *
+	* src/driver/implementation/data-message/Makefile    * NEW FILES *
+	* src/driver/implementation/imap/Makefile            * NEW FILES *
+	* src/driver/implementation/maildir/Makefile         * NEW FILES *
+	* src/driver/implementation/mbox/Makefile            * NEW FILES *
+	* src/driver/implementation/mbox/mboxdriver_message.c
+	* src/driver/implementation/mh/Makefile              * NEW FILES *
+	* src/driver/implementation/mime-message/Makefile    * NEW FILES *
+	* src/driver/implementation/nntp/Makefile            * NEW FILES *
+	* src/driver/implementation/pop3/Makefile            * NEW FILES *
+	* src/driver/interface/Makefile                      * NEW FILES *
+	* src/driver/tools/Makefile                          * NEW FILES *
+	* src/engine/Makefile                                * NEW FILES *
+	* src/engine/mailengine.[ch]                         * NEW FILES *
+	* src/engine/mailprivacy.[ch]                        * NEW FILES *
+	* src/engine/mailprivacy_gnupg.[ch]                  * NEW FILES *
+	* src/engine/mailprivacy_smime.[ch]                  * NEW FILES *
+	* src/engine/mailprivacy_tools.[ch]                  * NEW FILES *
+	* src/engine/mailprivacy_types.h                     * NEW FILES *
+	* src/low-level/Makefile                             * NEW FILES *
+	* src/low-level/imap/Makefile
+	* src/low-level/imf/Makefile
+	* src/low-level/imf/mailimf.c
+	* src/low-level/maildir/Makefile
+	* src/low-level/mbox/Makefile
+	* src/low-level/mh/Makefile
+	* src/low-level/mime/Makefile
+	* src/low-level/nntp/Makefile
+	* src/low-level/pop3/Makefile
+	* src/low-level/smtp/Makefile
+	* src/main/Makefile                                  * NEW FILES *
+	    changed folders structure
+
+2004-03-23 - libetpan-0.32cvs12 - hoa
+
+	* tools/mmapstring.c
+	    fixed a bug when initializing a string of size 0.
+	    That lead to a bug when fetching a part of size 0.
+
+2004-03-13 - libetpan-0.32cvs11 - hoa
+
+	* tools/mailstream_socket.c
+	    revert of previous commit (this is not POSIX).
+
+2004-03-13 - libetpan-0.32cvs10 - hoa
+
+	* tools/mailstream_socket.c
+	    socket failures send no more signals.
+	
+2004-03-13 - libetpan-0.32cvs9 - hoa
+
+	* mime/mailmime_decode.c
+	    better checks in mailmime_encoded_phrase_decode()
+	    Thanks to Frederic Devernay
+
+2004-03-13 - libetpan-0.32cvs8 - g_roualland
+
+	* smtp/mailsmtp_helper.c
+	    Fix esmtp status corruption in mailesmtp_init.
+	    Patch from Rajko Albrecht <ral@alwins-world.de>)
+
+	* smtp/mailsmtp.c
+	    Make sure to reset esmtp status on HELO.
+
+2004-03-03 - libetpan-0.32cvs7 - hoa
+
+	* configure.in
+	* imap/mailimap.c
+	* tools/charconv.c
+	    possibility to disable iconv. Fixed some leaks.
+	    Thanks to Frederic Devernay.
+	
+	* tools/mailstream_socket.c
+	* mime/mailmime_decode.c
+	    some support for broken architecture such as ARM.
+	    Thanks to Rajko Albrecht.
+
+2004-02-28 - libetpan-0.32cvs6 - hoa
+
+	* tools/mail_cache_db.c
+	    read/write cache database when support for Berkeley DB 1.x
+	    is enabled (this fix a bug where the database was readonly).
+
+2004-01-23 - libetpan-0.32cvs5 - melvin
+
+	* libetpan-config.h.in
+	    Better support for ARM: include both limits.h and sys/params.h
+	    if both are available. ARM requires this.
+	    Patch from Rajko Albrecht <ral@alwins-world.de>.
+
+2004-01-20 - libetpan-0.32cvs4 - melvin
+
+	* imap/mailimap_types.h
+	* imap/mailimap_types.c
+	* imap/mailimap_print.c
+	    Fixed concurrent usage of two members of the same union
+	    that resulted in double memory free after parsing some IMAP 
+	    responses (as in ...[APPENDUID VID UID])
+	* generic/mailmessage_types.c
+	* generic/mailstorage_tools.c
+	* tools/maillock.c
+	    Added <string.h> header
+	* tools/connect.c
+	* tools/mail_cache_db.c
+	    Added <unistd.h> header
+
+2004-01-12 - libetpan-0.32cvs3 - hoa
+
+	* configure.in
+	    detection of Berkeley DB can be disabled.
+	
+	* doc/API.sgml
+	* doc/Makefile
+	* doc/README.sgml
+	    updated documentation
+	
+	* generic/Makefile
+	* generic/mailstorage_tools.c
+	* generic/mailfolder.[ch]                * NEW FILES *
+	    destroy the unused file descriptors.
+	    folder API.
+	
+	* mime/mailmime_content.c
+	    fixed a problem in MIME parser on architectures where
+	    char is unsigned.
+	
+	* tools/connect.c
+	    destroy the unused file descriptors.
+
+2004-01-07 - libetpan-0.32cvs2 - g_roualland
+
+	* smtp/mailsmtp.c
+	* smtp/mailsmtp.h
+	* smtp/mailsmtp_types.h
+	    added full parsing of ehlo answer to detect esmtp extensions
+	    added mailsmtp_starttls() command.
+	
+	* smtp/mailsmtp_socket.c
+	* smtp/mailsmtp_socket.h
+	    added mailsmtp_socket_starttls to switch a connected
+	    ESMTP session under a TLS layer.
+
+	* tests/smtpsend.c
+	    updated to make use of starttls and esmtp extensions.
+
+2003-12-23 - libetpan-0.32cvs1 - hoa
+
+	* imap/mailimap_types.c
+	    fixed a crash related to capabilities.
+
+2003-12-16 - libetpan-0.32 - hoa
+
+	* release 0.32 - Black Utopia
+
+	* general
+	    - added documentation for IMF / tools
+	    - bugfixes in IMAP module due to structures change.
+	    - Application that use libEtPan! now have to use
+	        '#include <libetpan/libetpan.h>'
+
+	* generic    
+	    - get_message() is implemented in Maildir cached driver.
+
+2003-12-15 - libetpan-0.31cvs7 - hoa
+
+	* Makefile.in
+	* Rules.in
+	    fixed dependencies in Makefiles.
+
+2003-12-15 - libetpan-0.31cvs6 - hoa
+
+	* Makefile.in
+	    "make clean" does no more delete install include directory.
+
+2003-12-15 - libetpan-0.31cvs5 - hoa
+
+	* Makefile.in
+	    some cleanup.
+	
+	* libetpan-config.h.in            * NEW FILE *
+	    added missing file.
+	
+	* generic/maildirdriver.c
+	    added get_message_by_uid()
+	
+	* generic/maildirdriver_cached.c
+	    added get_message_by_uid() and get_message()
+	    index for the message is persistant in cached driver.
+	
+	* libetpan-config.in
+	    don't add -I/usr/include if /usr is the prefix.
+
+2003-12-15 - libetpan-0.31cvs4 - hoa
+
+	* Makefile.in
+	    some cleanup.
+	
+	* libetpan-config.h.in            * NEW FILE *
+	    added missing file.
+	
+	* generic/maildirdriver.c
+	    added get_message_by_uid()
+	
+	* generic/maildirdriver_cached.c
+	    added get_message_by_uid() and get_message()
+	    index for the message is persistant in cached driver.
+	
+	* libetpan-config.in
+	    don't add -I/usr/include if /usr is the prefix.
+
+2003-12-15 - libetpan-0.31cvs4 - hoa
+
+	* Makefile.in
+	* Rules.in
+	* configure.in
+	* libetpan-config.in
+	* generic/Makefile
+	* generic/data_message_driver.[ch]
+	* generic/generic_cache.c
+	* generic/generic_cache_types.h
+	* generic/imapdriver.[ch]
+	* generic/imapdriver_cached.[ch]
+	* generic/imapdriver_cached_message.h
+	* generic/imapdriver_message.h
+	* generic/imapdriver_tools.c
+	* generic/imapdriver_types.h
+	* generic/imapstorage.[ch]
+	* generic/libetpan.h
+	* generic/maildirdriver.h
+	* generic/maildirdriver_cached.[ch]
+	* generic/maildirdriver_cached_message.h
+	* generic/maildirdriver_message.h
+	* generic/maildirdriver_types.h
+	* generic/maildirstorage.[ch]
+	* generic/maildriver.h
+	* generic/maildriver_tools.c
+	* generic/maildriver_types.h
+	* generic/maildriver_types_helper.[ch]
+	* generic/mailmessage.[ch]
+	* generic/mailmessage_types.[ch]
+	* generic/mailstorage.h
+	* generic/mailstorage_tools.[ch]
+	* generic/mailthread.[ch]
+	* generic/mailthread_types.[ch]
+	* generic/mboxdriver.[ch]
+	* generic/mboxdriver_cached.[ch]
+	* generic/mboxdriver_cached_message.h
+	* generic/mboxdriver_message.h
+	* generic/mboxdriver_types.h
+	* generic/mboxstorage.[ch]
+	* generic/mhdriver.h
+	* generic/mhdriver_cached.[ch]
+	* generic/mhdriver_cached_message.h
+	* generic/mhdriver_message.h
+	* generic/mhdriver_types.h
+	* generic/mhstorage.[ch]
+	* generic/mime_message_driver.[ch]
+	* generic/nntpdriver.[ch]
+	* generic/nntpdriver_cached.[ch]
+	* generic/nntpdriver_cached_message.h
+	* generic/nntpdriver_message.h
+	* generic/nntpdriver_tools.c
+	* generic/nntpdriver_types.h
+	* generic/nntpstorage.[ch]
+	* generic/pop3driver.h
+	* generic/pop3driver_cached.[ch]
+	* generic/pop3driver_cached_message.h
+	* generic/pop3driver_message.h
+	* generic/pop3driver_types.h
+	* generic/pop3storage.[ch]
+	* imap/mailimap.[ch]
+	* imap/mailimap_helper.h
+	* imap/mailimap_parser.c
+	* imap/mailimap_sender.c
+	* imap/mailimap_socket.h
+	* imap/mailimap_ssl.h
+	* imap/mailimap_types.[ch]
+	* imap/mailimap_types_helper.[ch]
+	* imf/mailimf.h
+	* imf/mailimf_types.h
+	* imf/mailimf_types_helper.h
+	* imf/mailimf_write.h
+	* maildir/maildir.[ch]
+	* maildir/maildir_types.h
+	* mbox/mailmbox.c
+	* mbox/mailmbox.h
+	* mbox/mailmbox_types.h
+	* mh/mailmh.[ch]
+	* mime/mailmime.h
+	* mime/mailmime_content.h
+	* mime/mailmime_decode.h
+	* mime/mailmime_disposition.h
+	* mime/mailmime_types.h
+	* mime/mailmime_types_helper.h
+	* mime/mailmime_write.h
+	* nntp/newsnntp.h
+	* nntp/newsnntp_socket.h
+	* nntp/newsnntp_ssl.h
+	* nntp/newsnntp_types.h
+	* pop3/mailpop3.h
+	* pop3/mailpop3_socket.h
+	* pop3/mailpop3_ssl.h
+	* pop3/mailpop3_types.h
+	* smtp/mailsmtp.[ch]
+	* smtp/mailsmtp_helper.c
+	* smtp/mailsmtp_socket.h
+	* smtp/mailsmtp_ssl.h
+	* smtp/mailsmtp_types.h
+	* tests/compose-msg.c
+	* tests/fetch-attachment.c
+	* tests/frm-common.[ch]
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	* tests/frm.c
+	* tests/option-parser.[ch]
+	* tests/readmsg-common.[ch]
+	* tests/readmsg-simple.c
+	* tests/readmsg.c
+	* tests/smtpsend.c
+	* tools/Makefile
+	* tools/carray.h
+	* tools/mail.h
+	* tools/mail_cache_db.c
+	* tools/maillock.c
+	* tools/mailstream.h
+	* tools/mailstream_helper.[ch]
+	* tools/mailstream_low.h
+	* tools/mailstream_socket.h
+	* tools/mailstream_ssl.h
+	* tools/mailstream_types.h
+	* tools/mmapstring.c
+	    fixed some dependencies.
+	    Application that use libEtPan! now have to use
+	    '#include <libetpan/libetpan.h>'
+	    #include <libetpan.h> still exists for backward compatibility.
+	    API version (with libtool) has been introduced.
+
+2003-12-14 - libetpan-0.31cvs3 - hoa
+
+	* Makefile.in
+	    fixed dependencies.
+	
+	* generic/maildriver_tools.c
+	* generic/mailstorage_tools.c
+	    added missing includes.
+	
+	* imf/mailimf_types.h
+	    fixed documentation.
+
+2003-12-11 - libetpan-0.31cvs2 - hoa
+
+	* tools/carray.h
+	    fixed prototype of non-macro version.
+
+2003-12-11 - libetpan-0.31cvs1 - hoa
+
+	* configure.in
+	* imap/mailimap_helper.c
+	* imap/mailimap_parser.c
+	* imap/mailimap_print.c
+	* imap/mailimap_sender.c
+	* imap/mailimap_types.[ch]
+	    now sends empty astring as "".
+	    fixed a problem when fetching RFC822[.XXX] parts.
+	    fixed a problem with mailbox flags.
+
+2003-12-10 - libetpan-0.31 - hoa
+
+	* release 0.31 - Steve Morse release
+
+	* general
+	    - all fields name of structures are changed.
+	    - bugfixes.
+	    - union {} are added everywhere it is possible to save memory.
+	    - support for Berkeley DB 1.
+	    - improved compatibility with FreeBSD and Mac OS X.
+	
+	* drivers
+	    - cache drivers are disable if Berkeley DB is not found.
+	    - disable search call.
+	    - support of buggy Courier-IMAP server.
+	    - semantic of mailsession_get_envelopes_list() changed : it 
+	        does no more remove messages from the list.
+	    - mailsession_get_message_by_uid() is added and implemented 
+	        in some drivers.
+
+2003-12-10 - libetpan-0.30-cvs22 - hoa
+
+	* configure.in
+	* tools/mail_cache_db.c
+	    if Berkeley DB is not found, cached drivers are disabled.
+	
+	* generic/mailmessage_tools.c
+	* generic/mhdriver_tools.c
+	* generic/mime_message_driver.c
+	    fetch_header(), fetch_section_header(), fetch_section_mime()
+	    returns the ending single CRLF line for all drivers.
+
+	* tests/compose-msg.c
+	* tests/fetch-attachment.c
+	* tests/frm-common.c
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	* tests/frm.c
+	* tests/option-parser.c
+	* tests/readmsg.c
+	    fixed examples. Add static keyword where needed, forbid use
+	    of 'msg->msg_single_fields'.
+
+2003-12-08 - libetpan-0.30-cvs21 - hoa
+
+	* tests/fetch-attachment.c
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	* tests/frm.c
+	* tests/option-parser.[ch]
+	* tests/readmsg-simple.c
+	* tests/readmsg.c
+	* tests/frm-common.[ch]          * NEW FILES *
+	    conform to new API.
+	    added missing files frm-common.[ch]
+
+2003-12-08 - libetpan-0.30-cvs20 - hoa
+
+	* generic/generic_cache.[ch]
+	* generic/generic_cache_types.h
+	* generic/maildriver_types.[ch]
+	* generic/maildriver.[ch]
+	* generic/maildriver_tools.[ch]
+	* generic/maildriver_types_helper.c
+	* generic/mailmessage.[ch]
+	* generic/mailmessage_tools.c
+	* generic/mailmessage_types.c
+	* generic/mailstorage.[ch]
+	* generic/mailstorage_tools.[ch]
+	* generic/mailstorage_types.h
+	* generic/mailthread.[ch]
+	* generic/mailthread_types.c
+	    prefix field names.
+	    reflect the changes in the naming.
+	    changed prototype of storage uninitializer.
+	    changed prototype of session initializer.
+	    removed mail_search_key related things.
+
+	* generic/data_message_driver.c
+	* generic/imfcache.c
+	* generic/mime_message_driver.c
+	    reflect the changes in the naming.
+	
+	* generic/imapdriver.[ch]
+	* generic/imapdriver_cached.[ch]
+	* generic/imapdriver_cached_message.c
+	* generic/imapdriver_message.c
+	* generic/imapdriver_tools.[ch]
+	* generic/imapdriver_types.h
+	* generic/imapstorage.[ch]
+	    reflect the changes in the naming.
+	    additionnally, imapdriver becomes imap_session_driver
+	    and imapdriver_cached becomes imap_cached_session_driver.
+	
+	* generic/libetpan.h
+	    drivers are now included in this header.
+	
+	* generic/maildirdriver.[ch]
+	* generic/maildirdriver_cached.[ch]
+	* generic/maildirdriver_cached_message.c
+	* generic/maildirdriver_message.c
+	* generic/maildirdriver_tools.[ch]
+	* generic/maildirdriver_types.h
+	* generic/maildirstorage.[ch]
+	    reflect the changes in the naming.
+	    additionnally, maildirdriver becomes maildir_session_driver
+	    and maildirdriver_cached becomes 
+	    maildir_cached_session_driver.
+	
+	* generic/mboxdriver.[ch]
+	* generic/mboxdriver_cached.[ch]
+	* generic/mboxdriver_cached_message.c
+	* generic/mboxdriver_message.c
+	* generic/mboxdriver_tools.[ch]
+	* generic/mboxdriver_types.h
+	* generic/mboxstorage.[ch]
+	    reflect the changes in the naming.
+	    additionnally, mboxdriver becomes mbox_session_driver
+	    and mboxdriver_cached becomes mbox_cached_session_driver.
+
+	* generic/mhdriver.[ch]
+	* generic/mhdriver_cached.[ch]
+	* generic/mhdriver_cached_message.c
+	* generic/mhdriver_message.c
+	* generic/mhdriver_tools.[ch]
+	* generic/mhdriver_types.h
+	* generic/mhstorage.[ch]
+	    reflect the changes in the naming.
+	    additionnally, mboxdriver becomes mh_session_driver
+	    and mhdriver_cached becomes mh_cached_session_driver.
+
+	* generic/nntpdriver.[ch]
+	* generic/nntpdriver_cached.[ch]
+	* generic/nntpdriver_cached_message.c
+	* generic/nntpdriver_message.c
+	* generic/nntpdriver_tools.[ch]
+	* generic/nntpdriver_types.h
+	* generic/nntpstorage.[ch]
+	    reflect the changes in the naming.
+	    additionnally, nntpdriver becomes nntp_session_driver
+	    and nntpdriver_cached becomes nntp_cached_session_driver.
+
+	* generic/pop3driver.[ch]
+	* generic/pop3driver_cached.[ch]
+	* generic/pop3driver_cached_message.c
+	* generic/pop3driver_message.c
+	* generic/pop3driver_tools.[ch]
+	* generic/pop3driver_types.h
+	* generic/pop3storage.[ch]
+	    reflect the changes in the naming.
+	    additionnally, pop3driver becomes pop3_session_driver
+	    and pop3driver_cached becomes pop3_cached_session_driver.
+
+	* imap/mailimap.c
+	* imap/mailimap_print.c
+	* imap/mailimap_sender.c
+	* imf/mailimf_types_helper.c
+	* imf/mailimf_write.c
+	* mime/mailmime.c
+	* mime/mailmime_content.c
+	* mime/mailmime_types.c
+	* mime/mailmime_types_helper.c
+	* nntp/newsnntp.c
+	* smtp/mailsmtp_helper.c
+	    proper use of clist_content(), clist_next(), carray_count()
+	    and carray_data().
+
+2003-12-05 - libetpan-0.30-cvs19 - hoa
+
+	* generic/imapdriver.c
+	    don't fail if SEARCH command is not supported by the server.
+	    
+	* configure.in
+	    improved autodetection of Berkeley DB version.
+	    Thanks to Keith Edmunds.
+
+2003-12-04 - libetpan-0.30-cvs18 - hoa
+
+	* generic/generic_cache.c
+	* generic/imapdriver.c
+	* generic/imapdriver_cached.c
+	* generic/imapdriver_tools.c
+	* generic/maildirdriver.c
+	* generic/maildirdriver_cached.c
+	* generic/maildirdriver_tools.c
+	* generic/maildriver_tools.c
+	* generic/maildriver_types.c
+	* generic/mailstorage.c
+	* generic/mailstorage_types.h
+	* generic/mailthread.c
+	* generic/mailthread_types.c
+	* generic/mboxdriver.c
+	* generic/mboxdriver_cached.c
+	* generic/mboxdriver_message.c
+	* generic/mboxdriver_tools.c
+	* generic/mhdriver.c
+	* generic/mhdriver_cached.c
+	* generic/mhdriver_cached_message.c
+	* generic/mhdriver_message.c
+	* generic/mhdriver_tools.c
+	* generic/nntpdriver.c
+	* generic/nntpdriver_cached.c
+	* generic/nntpdriver_tools.c
+	* generic/pop3driver.c
+	* generic/pop3driver_cached.c
+	* generic/pop3driver_tools.c
+	* maildir/maildir.c
+	* mbox/mailmbox.c
+	* mbox/mailmbox_parse.c
+	* mbox/mailmbox_types.[ch]
+	* mh/mailmh.[ch]
+	* pop3/mailpop3.c
+	* pop3/mailpop3_types.h
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	* tests/frm.c
+	* tests/readmsg-common.c
+	* tools/carray.[ch]
+	* tools/chash.[ch]
+	* tools/mmapstring.c
+	    changed carray and chash structure to easy use of them.
+	    reflect these changes on the whole code.
+
+2003-12-03 - libetpan-0.30-cvs17 - hoa
+
+	* mh/mailmh.[ch]
+	    don't update folder implicitely.
+	
+	* generic/mhdriver.c
+	* generic/mhdriver_cached.c
+	* generic/mhdriver_cached_message.c
+	* generic/mhdriver_message.c
+	* generic/mhdriver_tools.c
+	    fixed MH driver status and expunge.
+
+	* generic/imapstorage.h
+	    removed duplicate licence.
+	
+	* imap/mailimap_keywords.[ch]
+	* imap/mailimap_sender.[ch]
+	* imap/mailimap_socket.[ch]
+	* imap/mailimap_ssl.[ch]
+	* imf/mailimf.[ch]
+	* imf/mailimf_types.[ch]
+	* imf/mailimf_write.[ch]
+	* maildir/maildir.[ch]
+	* mbox/mailmbox.[ch]
+	* mbox/mailmbox_types.[ch]
+	* mime/mailmime.[ch]
+	* mime/mailmime_content.[ch]
+	* mime/mailmime_decode.[ch]
+	* mime/mailmime_disposition.[ch]
+	* mime/mailmime_types.[ch]
+	* mime/mailmime_types_helper.[ch]
+	* mime/mailmime_write.[ch]
+	* nntp/newsnntp.[ch]
+	* nntp/newsnntp_socket.[ch]
+	* nntp/newsnntp_ssl.[ch]
+	* pop3/mailpop3.[ch]
+	* pop3/mailpop3_socket.[ch]
+	* pop3/mailpop3_ssl.[ch]
+	* smtp/mailsmtp.[ch]
+	* smtp/mailsmtp_helper.[ch]
+	* smtp/mailsmtp_socket.[ch]
+	* smtp/mailsmtp_ssl.[ch]
+	* tools/charconv.[ch]
+	* tools/chash.c
+	* tools/connect.[ch]
+	* tools/mail_cache_db.[ch]
+	* tools/maillock.[ch]
+	* tools/mailstream.[ch]
+	* tools/mailstream_helper.[ch]
+	* tools/mailstream_low.[ch]
+	* tools/mailstream_socket.c
+	* tools/mailstream_ssl.c
+	* tools/mailstream_types.h
+	    applied 'const' qualifier where it is needed except in
+	    generic part.
+
+2003-12-03 - libetpan-0.30-cvs16 - hoa
+
+	* imap/mailimap_sender.c
+	    Workaround for a bug in Courier-IMAP.
+	    Thanks to Mark B. Elrod.
+
+2003-12-03 - libetpan-0.30-cvs15 - hoa
+
+	* README
+	* imap/mailimap_sender.c
+	    fixed IMAP protocol when sending a DELETE command
+	    (there was a missing space).
+	    Thanks to Zsolt VARGA.
+
+2003-12-02 - libetpan-0.30-cvs14 - hoa
+
+	* generic/maildriver_types.h
+	* generic/maildriver_tools.c
+	* generic/nntpdriver.c
+	* generic/nntpdriver_cached.c
+	* tests/frm-simple.c
+	* tests/frm.c
+	    changed semantic of get_envelopes_list() :
+	    the messages that could not be fetched are not
+	    removed from the given list.
+
+2003-12-02 - libetpan-0.30-cvs13 - hoa
+
+	* tests/Makefile
+	* tests/compose-msg.c
+	* tests/etpan-message-data-driver.[ch]  * REMOVED FILES *
+	* tests/fetch-attachment.c
+	* tests/frm-common.c                    * NEW FILES *
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	* tests/frm.c
+	* tests/readmsg-common.c
+	* tests/readmsg.c
+	    synchronize tests with new API.
+
+2003-12-02 - libetpan-0.30-cvs12 - hoa
+
+	* generic/mboxdriver.c
+	* generic/mboxdriver_cached.c
+	* generic/mboxdriver_cached_message.c
+	* generic/mboxdriver_message.c
+	* generic/mboxdriver_tools.c
+	* mbox/mailmbox.c
+	* mbox/mailmbox_parse.c
+	* mbox/mailmbox_types.[ch]
+	    added a prefix before field names in mbox module.
+
+2003-12-02 - libetpan-0.30-cvs11 - hoa
+
+	* generic/imapdriver_tools.c
+	* generic/imfcache.c
+	* generic/maildriver_types.c
+	* generic/mailthread.c
+	* imf/mailimf.c
+	* imf/mailimf_types.[ch]
+	* imf/mailimf_types_helper.c
+	* imf/mailimf_write.c
+	* mime/mailmime.c
+	* mime/mailmime_content.c
+	    added a prefix before field names in IMF module.
+
+2003-12-01 - libetpan-0.30-cvs10 - hoa
+
+	* generic/maildirdriver.c
+	* generic/maildirdriver_cached.c
+	* generic/maildirdriver_tools.c
+	* generic/mhdriver.c
+	* generic/mhdriver_cached.c
+	* generic/mhdriver_cached_message.c
+	* generic/mhdriver_message.c
+	* generic/mhdriver_tools.c
+	* maildir/maildir.c
+	* maildir/maildir_types.h
+	* mh/mailmh.c
+	* mh/mailmh.h
+	    added a prefix before field names in MH
+	    and maildir modules.
+	    Thanks to Melvin Hadasht.
+
+2003-12-01 - libetpan-0.30-cvs9 - hoa
+
+	* generic/nntpdriver.c
+	* generic/nntpdriver_cached.c
+	* generic/nntpdriver_tools.c
+	* generic/pop3driver.c
+	* generic/pop3driver_cached.c
+	* generic/pop3driver_cached_message.c
+	* generic/pop3driver_tools.c
+	* nntp/newsnntp.[ch]
+	* nntp/newsnntp_types.h
+	* pop3/mailpop3.[ch]
+	* pop3/mailpop3_types.h
+	    added a prefix before field names in NNTP
+	    and POP3 modules.
+	    Thanks to Melvin Hadasht.
+
+2003-12-01 - libetpan-0.30-cvs8 - hoa
+
+	* generic/imapdriver_cached_message.c
+	* generic/imapdriver_message.c
+	* generic/imapdriver_tools.c
+	* generic/mailmessage_tools.c
+	* generic/mime_message_driver.c
+	* mime/mailmime_content.c
+	* mime/mailmime_decode.c
+	* mime/mailmime_disposition.c
+	* mime/mailmime_types.[ch]
+	* mime/mailmime_types_helper.[ch]
+	* mime/mailmime_write.c
+	    changed field name in MIME module and
+	    replaced some structure with union.
+	
+	* imap/mailimap.c
+	* nntp/newsnntp.c
+	    fixed bug that didn't allow connection.
+
+2003-12-01 - libetpan-0.30-cvs7 - hoa
+
+	* libetpan-config.in
+	    added LDFLAGS to libetpan-config --libs.
+	
+	* nntp/newsnntp.c
+	* pop3/mailpop3.c
+	* generic/mailstorage_tools.c
+	    don't unreference stream on connect() error.
+	
+	* generic/data_message_driver.c
+	* generic/maildriver_types.c
+	* generic/maildriver_types.h
+	* generic/mailmessage_tools.c
+	    now a zero length string can be given as (NULL, 0)
+	    for the content of the message.
+	    changed field names of mail_search_key structure.
+	
+	* generic/maildriver_errors.h
+	    added error type.
+	
+	* generic/imapdriver.c
+	* generic/imapdriver_cached.c
+	* generic/imapdriver_cached_message.c
+	* generic/imapdriver_message.c
+	* generic/imapdriver_tools.c
+	* generic/nntpdriver_message.c
+	* imap/mailimap.c
+	* imap/mailimap.h
+	* imap/mailimap_helper.c
+	* imap/mailimap_print.c
+	* imap/mailimap_sender.c
+	* imap/mailimap_socket.c
+	* imap/mailimap_types.[ch]
+	* imap/mailimap_types_helper.[ch]
+	    changed the name of the fields in IMAP low-level implementation,
+	    (prefix has been added to field names in structures).
+	
+	* mime/mailmime.c
+	    a FWS can now appear in Content-Type field, before
+	    the MIME type.
+
+2003-11-25 - libetpan-0.30-cvs6 - hoa
+
+	* generic/mboxdriver_cached.c
+	    max-uid file is now located in flags directory.
+	    this allows to keep flags coherence.
+
+2003-11-25 - libetpan-0.30-cvs5 - hoa
+
+	* configure.in
+	* tools/mailstream_socket.c
+	* tools/mailstream_ssl.c
+	    removed specific check for <sys/select.h>
+	
+	* generic/data_message_driver.c
+	* generic/data_message_driver.h
+	* generic/libetpan_version.h.in
+	* generic/maildriver_errors.h
+	* generic/mime_message_driver.c
+	* generic/mime_message_driver.h
+	    added licence information.
+
+2003-11-25 - libetpan-0.30-cvs4 - hoa
+
+	* configure.in
+	* tools/mailstream_socket.c
+	* tools/mailstream_ssl.c
+	    Check for valid <sys/select.h>.
+	    Because Mac OS X systems, <sys/select.h> cannot be included
+	    alone. Then, we follow the old standard to use select() system
+	    call.
+	
+	* generic/generic_cache.c
+	* generic/libetpan_version.c
+	    clean up code.
+	
+	* tools/mail_cache_db.c
+	    Support for Berkeley DB version 1.x.
+
+2003-11-25 - libetpan-0.30-cvs3 - hoa
+
+	* generic/maildirdriver.c 
+	    fixed a crash in get_envelopes_list().
+	
+	* generic/maildriver_errors.h  * NEW FILE *
+	* generic/maildriver_types.h
+	    moved error codes from maildriver_types.h to
+	    maidlriver_errors.h.
+	
+	* generic/mailthread.h
+	* generic/mailthread_types.h
+	    moved threading type to mailthread_types.h
+	
+	* maildir/maildir.c
+	    added internal basename() function so that
+	    libEtPan! can compile on Mac OS X.
+	
+	* tools/mail_cache_db.c
+	* tools/maildb_helper.[ch]     * REMOVED FILES *
+	    added support for DB1 (cleanse of database) and 
+	    removed deprecated files.
+
+2003-11-22 - libetpan-0.30-cvs2 - hoa
+
+	* generic/nntpdriver_message.c
+	    added UID to NNTP mailmessage structure.
+
+2003-11-22 - libetpan-0.30-cvs1 - hoa
+
+	* generic/imapdriver.c
+	* generic/imapdriver_cached.c
+	* generic/imapdriver_message.c
+	* generic/imapdriver_tools.c
+	* generic/maildirdriver.c
+	* generic/maildirdriver_cached.c
+	* generic/maildriver.[ch]
+	* generic/maildriver_types.h
+	* generic/mboxdriver.c
+	* generic/mboxdriver_cached.c
+	* generic/mboxdriver_message.c
+	* generic/mhdriver.c
+	* generic/mhdriver_cached.c
+	* generic/mhdriver_message.c
+	* generic/nntpdriver.c
+	* generic/nntpdriver_cached.c
+	* generic/pop3driver.c
+	* generic/pop3driver_cached.c
+	    mailsession_get_message_by_uid() is added.
+	    It is used like mailsession_get_message(),
+	    but using the uid string.
+	    This is implemented in imap driver, nntp driver,
+	    mh driver and mbox driver (cached and non cached version).
+	    This is not implemented in pop3 nor maildir.
+	    
+	    uid member of mailmessage structure is always defined for
+	    drivers where this function is implemented.
+	    
+	    Thanks to Melvin Hadasht.
+	    
+2003-11-21 - libetpan-0.30 - hoa
+
+	* release 0.30 - Spock's Beard release
+
+	* general
+	    - fixed several memory leaks.
+	    
+	    - defines now exist for new features since version 0.29
+
+	* tools
+	    - dump of network traffic is now possible by setting
+	      exported variable mailstream_debug to 1.
+	    
+	    - TLS/SSL driver for stream is fixed.
+	    
+	* imf
+	    - fixed RFC 2822 format, wrap headers and break lines
+	      when they are longer than requirement (998).
+	    
+	    - reduced size of headers data.
+	      a union is used inside the structure.
+	      *** WARNING *** : this change use of structure field as a union
+	      member is used in mailimf_field structure.
+
+	* imap
+	   - several fixes in IMAP module.
+	
+	* mime
+	   - fixed quoted-printable parser.
+	
+	* generic - cache for drivers
+	   - cache database is now cleaned up.
+	   
+	   - fixed header fields cache.
+	      *** WARNING *** cache format changed. You should reset all
+	      your cache of headers (env.db).
+
+	* generic - threading
+      
+	   - fixed threading when threading by references with subject.
+
+	* generic - drivers for message
+   
+	   - separated flush() and check() in message.
+	     *** WARNING *** : this changes the API of the message.
+	     flush() is used to free the internal structure used
+	     to store the MIME structure of the message. It invalidates
+	     the "mime" member of the message.
+	     check() is used for to notify the modification of message
+	     flags to the session, so that the session saves the flags
+	     of the message at the next call of mailsession_check() or
+	     when leaving the session.
+
+	   - IMAP implementation is more compliant.
+	   
+	   - added driver to build MIME message and see the rendering
+	     through fetch functions.
+	     
+	   - added driver to parse message content given with a string.
+
+	* generic - drivers for maildir
+
+	   - maildir driver for storage / session / messages
+	     is implemented.
+
+2003-11-21 - libetpan-0.1-cvs31 - hoa
+
+	* Makefile.in
+	* README
+	* configure.in
+	* generic/Makefile
+	* generic/libetpan.h
+	* generic/libetpan_version.c
+	* generic/libetpan_version.h.in
+	    support for runtime version of libetpan
+
+2003-11-20 - libetpan-0.29-cvs30 - hoa
+
+	* imf/mailimf_write.c
+	    wrap mailbox list when we have a single address as
+	    a mailbox.
+
+2003-11-20 - libetpan-0.29-cvs29 - hoa
+
+	* generic/imapdriver.c
+	    clean up code.
+	
+	* imap/mailimap.c
+	    update message count with EXPUNGE responses.
+	
+	* tools/mailstream_socket.c
+	    added comment about initial state of socket.
+	
+	* tools/mailstream_ssl.c
+	    added comment about initial state of socket.
+	    read() is fixed.
+	    
+2003-11-19 - libetpan-0.29-cvs28 - hoa
+
+	* generic/mailthread.c
+	    fixed threading by references when using subjects.
+
+2003-11-19 - libetpan-0.29-cvs27 - hoa
+
+	* generic/maildirdriver_cached.c
+	* generic/mboxdriver_cached.c
+	* generic/mhdriver_cached.c
+	* generic/nntpdriver_cached.c
+	* generic/pop3driver_cached.c
+	    don't open any files if flags_store is empty.
+	
+	* imap/mailimap_types.c
+	    fixed a crash when freeing a mailbox list information
+	    with no flags.
+	
+	* tools/mailstream.c
+	    default value for network timeout.
+
+2003-11-17 - libetpan-0.29-cvs26 - hoa
+
+	* imap/mailimap.c
+	* imap/mailimap_sender.c
+	    fixed syntax of SEARCH command.
+	
+	* tools/mailstream.[ch]
+	* tools/mailstream_types.h
+	    if LIBETPAN_STREAM_DEBUG is define in mailstream_types.h, we 
+	    can use a global variable mailstream_debug to enable the dump 
+	    of the network protocol on the file libetpan-stream-debug.log.
+	
+2003-11-17 - libetpan-0.29-cvs25 - hoa
+
+	* generic/imapdriver.c
+	    use SEARCH instead of STATUS on selected folder to 
+	    get UNSEEN messages count.
+	
+	* imap/mailimap.c
+	    allows multiple SEARCH responses.
+	
+	* imap/mailimap_keywords.c
+	* imap/mailimap_parser.c
+	    fixed parsing of mailbox flags.
+	
+	* tools/clist.c
+	    fixed count when using clist_concat().
+
+2003-11-14 - libetpan-0.29-cvs24 - hoa
+
+	* imf/mailimf_write.c
+	    fixed the space between Message-IDs, problem introduced
+	    by rewriting of headers wrapper.
+
+2003-11-13 - libetpan-0.29-cvs23 - hoa
+
+	* generic/maildirdriver_types.h
+	* generic/mhdriver_types.h
+	    fixed some comments.
+	
+	* mime/mailmime_content.c
+	    fixed infinite loop in MIME parser.
+
+2003-11-12 - libetpan-0.29-cvs22 - hoa
+
+	* generic/maildriver_tools.h
+	    removed exported functions that does no more exist.
+
+2003-11-12 - libetpan-0.29-cvs21 - hoa
+
+	* generic/maildriver_tools.h
+	    removed exported function that does no more exist.
+
+2003-11-11 - libetpan-0.29-cvs20 - hoa
+
+	* generic/Makefile
+	* generic/mailmessage.h
+	* generic/data_message_driver.[ch]      * NEW FILES *
+	* generic/mime_message_driver.[ch]      * NEW FILES *
+	    driver to allow construction of MIME message.
+	    (mime_message_driver.[ch]).
+	    driver to operations on message which content is
+	    given by a string.
+
+2003-11-10 - libetpan-0.29-cvs19 - hoa
+
+	* Makefile.in
+	    compilation of maildir low-level implementation.
+
+	* maildir/Makefile                             * NEW FILE *
+	* maildir/maildir.[ch]	                       * NEW FILES *
+	* maildir/maildir_types.h                      * NEW FILE *
+	    maildir low-level implementation.
+	
+	* generic/Makefile
+	* generic/maildirdriver.[ch]                   * NEW FILES *
+	* generic/maildirdriver_cached.[ch]            * NEW FILES *
+	* generic/maildirdriver_cached_message.[ch]    * NEW FILES *
+	* generic/maildirdriver_message.[ch]           * NEW FILES *
+	* generic/maildirdriver_tools.[ch]             * NEW FILES *
+	* generic/maildirdriver_types.h                * NEW FILE *
+	* generic/maildirstorage.[ch]                  * NEW FILES *
+	    implementation of maildir driver, cached and non-cached
+	    versions.
+	
+	* generic/generic_cache.c
+	    use msync() when finished writing using mmap() with MAP_SHARED.
+	
+	* generic/imapdriver_tools.c
+	    changed flag name "Forwarded" into something more standard
+	    "$Forwarded" (draft on flag keywords for IMAP).
+	
+	* generic/maildriver.h
+	    added maildir drivers for session.
+	
+	* generic/maildriver_types.h
+	* generic/mailmessage_tools.c
+	    added message data for drivers that will use internal
+	    data although they are using the generic functions.
+	
+	* generic/mailmessage.h
+	    added maildir drivers for message.
+	
+	* generic/mailstorage.h
+	    added maildir driver for storage.
+	
+	* generic/mboxdriver_cached.c
+	    optimization on memory use.
+	
+	* generic/mhdriver_cached.c
+	    code clean up.
+	
+	* generic/mhdriver_tools.c
+	* mh/mailmh.c
+	    don't use MAP_SHARED for mmap() where it is not needed.
+
+	* tests/fetch-attachment.c
+	* tests/frm.c
+	* tests/frm-simple.c
+	* tests/frm-tree.c
+	* tests/frm.c
+	* tests/option-parser.[ch]
+	* tests/readmsg-simple.c
+	* tests/readmsg.c
+	    factorize code of storage initialization into
+	    option-parser.[ch].
+
+2003-11-09 - libetpan-0.29-cvs18 - hoa
+
+	* generic/imapdriver_tools.c
+	    fixed management of MAIL_FLAG_FORWARDED.
+	
+	* generic/nntpdriver_tools.c
+	    fixed a memory leak.
+	
+	* imap/mailimap_types.c
+	    fixed a memory freeing.
+
+2003-11-05 - libetpan-0.29-cvs17 - hoa
+
+	* imf/mailimf.c
+	    broken parsing of message-id due to previous change
+	    is fixed.
+	
+2003-11-05 - libetpan-0.29-cvs16 - hoa
+
+	* imf/mailimf.c
+	    accept some weird syntax, for example :
+	    foo@bar.com <foo@bar.com>
+	    This is now accepted.
+
+2003-11-04 - libetpan-0.29-cvs15 - hoa
+
+	* imf/mailimf_write.c
+	    fixed (again) wrapping of header fields.
+
+2003-11-03 - libetpan-0.29-cvs14 - hoa
+
+	* generic/imapdriver_message.c
+	    fixed behaviour of IMAP message driver.
+
+2003-11-03 - libetpan-0.29-cvs13 - hoa
+
+	* mh/mailmh.[ch]
+	* mime/mailmime.[ch]
+	* mime/mailmime_decode.[ch]
+	* mime/mailmime_disposition.[ch]
+	* mime/mailmime_types.[ch]
+	* mime/mailmime_types_helper.[ch]
+	    removed duplicated licence.
+	
+	* mime/mailmime_content.[ch]
+	* mime/mailmime_write.[ch]
+	    removed duplicated licence.
+	    fixed quoted-printable parser.
+	    fixed multipart parser, preamble and epilogue are now stored.
+	    fixed quoted-printable part renderer.
+
+2003-10-29 - libetpan-0.29-cvs12 - hoa
+
+	* generic/mailmessage_tools.c
+	    fixed a bug in generic fetch header part of section.
+	
+	* generic/nntpdriver.c
+	    check() replace flush() message in message envelopes list
+	    fetch to reflect new API (0.29-cvs1).
+
+2003-10-29 - libetpan-0.29-cvs11 - hoa
+
+	* imf/mailimf_write.c
+	    workaround for a bug of old versions of INN.
+	
+	* mime/mailmime_types_helper.c
+	    mailmime_single_fields_init() now accept NULL as the
+	    "mailmime_fields" argument, so that we call this function
+	    with only a "mailmime_content".
+	
+2003-10-29 - libetpan-0.29-cvs10 - hoa
+
+	* generic/imapdriver_cached.c
+	* generic/imapdriver_cached_message.c
+	* generic/mboxdriver_cached.c
+	* generic/mhdriver_cached.c
+	* generic/nntpdriver_cached.c
+	* generic/pop3driver_cached.c
+	    code cleanup.
+	    message content cache files are now cleaned up in
+	    an unlocked state.
+
+2003-10-29 - libetpan-0.29-cvs9 - hoa
+	
+	* mbox/mailmbox.c
+	    fixed get_line() function. Does not get out from the buffer.
+
+2003-10-29 - libetpan-0.29-cvs8 - hoa
+	
+	* generic/imapdriver_tools.c
+	    fixed conversion of data in IMAP driver.
+
+2003-10-29 - libetpan-0.29-cvs7 - hoa
+	
+	* mime/mailmime_content.c
+	    remove unparsed IMF (RFC 2822) headers in the
+	    parsed MIME structure, that are MIME headers,
+	    so that rendering of MIME message from parsed MIME
+	    structure is correct.
+
+2003-10-28 - libetpan-0.29-cvs6 - hoa
+
+	* generic/nntpdriver_cached.c
+	    now, the flags are not lost when the cache is deleted.
+	    
+	* generic/imapdriver_message.c
+	    get rid of deprecated things in IMAP protocol.
+	    mailmessage_fetch() will no longer mark the message 
+	    as read.
+
+2003-10-28 - libetpan-0.29-cvs5 - hoa
+	
+	* generic/imfcache.c
+	    fixed header fields cache.
+	    *** WARNING *** cache format changed. You should reset all
+	    your cache of headers (env.db).
+	
+	* generic/maildriver.h
+	    added comment about driver function.
+	
+	* tools/maillock.c
+	    change dotlock behaviour (wait 5 seconds after each failed try)
+	
+2003-10-27 - libetpan-0.29-cvs4 - hoa
+	
+	* README
+	    added information about C #define
+	
+	* generic/imapdriver_cached_message.c
+	    fixed memory leak in cached IMAP message driver.
+	    MIME structure is not fetched again when already fetched.
+	
+	* imf/mailimf_types.h
+	    added LIBETPAN_MAILIMF_FIELD_UNION #define to know that
+	      we are on version of libEtPan! with a union to implement
+	      mailimf_field data type.
+
+	* generic/maildriver_types.h
+	    added LIBETPAN_MAILMESSAGE_CHECK #define to know that
+	      we are on version of libEtPan! with mailmessage_check()
+	      call separated from mailmessage_flush() call, introduced
+	      in 0.29-cvs1
+
+	* imf/mailimf_write.c
+	    fixed wrapping of header text. First character was removed 
+	      when the first word was too long.
+
+	* generic/generic_cache.[ch]
+	* generic/generic_cache_types.h
+	* generic/imapdriver.[ch]
+	* generic/imapdriver_cached.[ch]
+	* generic/imapdriver_tools.h
+	* generic/imapdriver_types.h
+	* generic/imapstorage.[ch]
+	* generic/imfcache.[ch]
+	* generic/libetpan.h
+	* generic/maildriver.c
+	* generic/maildriver_tools.c
+	* generic/maildriver_types.c
+	* generic/mailmessage_types.h
+	* generic/mailstorage.[ch]
+	* generic/mailstorage_tools.[ch]
+	* generic/mailstorage_types.h
+	* generic/mboxdriver.[ch]
+	* generic/mboxdriver_cached.h
+	* generic/mboxdriver_types.h
+	* generic/mboxstorage.[ch]
+	* generic/mhdriver.[ch]
+	* generic/mhdriver_cached.[ch]
+	* generic/mhdriver_types.h
+	* generic/mhstorage.[ch]
+	* generic/nntpdriver.[ch]
+	* generic/nntpdriver_cached.[ch]
+	* generic/nntpdriver_types.h
+	* generic/nntpstorage.[ch]
+	* generic/pop3driver.[ch]
+	* generic/pop3driver_cached.[ch]
+	* generic/pop3driver_types.h
+	* generic/pop3storage.[ch]
+	* imap/mailimap_types_helper.[ch]
+	* imf/mailimf_types_helper.h
+	* imf/mailimf_write.h
+	* mbox/mailmbox.h
+	* mh/mailmh.[ch]
+	* mime/mailmime.[ch]
+	* mime/mailmime_content.[ch]
+	* mime/mailmime_decode.[ch]
+	* mime/mailmime_disposition.[ch]
+	* mime/mailmime_types.[ch]
+	* mime/mailmime_types_helper.[ch]
+	* mime/mailmime_write.[ch]
+	* tools/carray.[ch]
+	* tools/charconv.[ch]
+	* tools/chash.[ch]
+	* tools/cinthash.[ch]
+	* tools/clist.[ch]
+	* tools/hmac-md5.h
+	* tools/mailstream_socket.h
+	* tools/mailstream_types.h
+	* tools/mapping.[ch]
+	* tools/md5.[ch]
+	* tools/md5global.h
+	* tools/mmapstring.[ch]
+	    added licence information and name of last commiter.
+	
+2003-10-25
+	
+	* version 0.29-cvs3
+	* generic/imapdriver_cached.c
+	    fixed wrong message size (of 0) when UID list cache is
+	    used in IMAP cached driver. The size is now stored in the 
+	    UID list cache.
+	
+	* imf/mailimf.c
+	    fixed single address parsing (his will strip all spaces in
+	    the address)
+
+2003-10-24
+	
+	* version 0.29-cvs2
+	* generic/imapdriver_tools.c
+	    flag NEW in IMAP driver is disabled when the message is SEEN.
+
+2003-10-23
+	
+	* version 0.29-cvs1
+	* imf - reduced size of headers data
+	    WARNING : this change use of structure field as a union
+	      member is used in mailimf_field structure.
+	* generic - imap - fixed some data conversion
+	* tools - chash - add a call
+	* generic - separated flush() and check() in message.
+	    WARNING : this changes the API of the message.
+	      flush() is used to free the internal structure used
+	      to store the MIME structure of the message. It invalidates
+	      the "mime" member of the message.
+	      check() is used for to notify the modification of message
+	      flags to the session, so that the session saves the flags
+	      of the message at the next call of mailsession_check() or
+	      when leaving the session.
+	* all - fixed some leaks
+	* imf - fixed mailbox group parsing
+	* imf, mime - fixed RFC 2822 format (CR LF at end of lines)
+	* generic - pop3, nntp - fixed memory leaks
+	* generic - message theading - waste less memory
+	* imap - fixed some memory leaks
+	* mime - parse some non-conform MIME encoded headers
+	* nntp - fixed a memory leak
+	* mbox - strip UID headers when fetching message content
+	* tools - adds new database cache file interface (mail_cache_db.[ch])
+	* tools - added extern "C" { } to avoid name mangling in C++
+	* generic - drivers now make use of new database cache file interface.
+	* tools - adds a function to clean up the database file
+	* all - some compilation warning fixes
+	* generic - drivers - cached drivers now clean their cache
+	* mbox - removed use of cinthash
+	* generic - mbox - removed use of cinthash
+	* all - removed use of alloc.h
+	* imf - can now fold some more headers (including headers with free
+	     form values) for more standards conformance
+	* mime - can parse multilines headers, fixed quoted-printable
+	     decoding (all single \n are now decoded to \r\n)
+	* mbox - synchronize mmapped file before unmapping it.
+	* tools - mmapstring - removed use of cinthash, replaced with chash
+	
+2003-10-06 - XetPan release
+
+        * version 0.29
+	* generic - imap - bugfixes
+	* tools - mailstream - debug for stream, network timeout
+	* tools - mailstream - ssl library is initialized by ssl driver,
+	    fixed a bug
+	* tools - chash - fixed chash interface
+	* imf - fixed interface
+	* mime - fixed memory leak and some interface
+	* generic - fixed messages thread
+	* nntp - bugfixes
+	* pop3 - bugfixes
+	* smtp - added SMTP auth CRAM-MD5, LOGIN, PLAIN
+	* imap - bugfixes
+	* mime - fixed writing of MIME part
+	* tests - added SMTP sample, thanks to Gael Roualland
+	
+2003-04-01 - Avril Lavigne Release
+
+	* version 0.28
+	* imap - fixed IMAP parser
+	* mime - fixed section id generation
+	* mime - fixed mime parser
+	* generic - conform to IMAP naming for flags
+	* tools - prefix for tcp_connect() and get_service_port()
+	* generic - nntp - noop function added
+	* configure - some fixes
+	* generic - message parse fixes
+	* generic - nntp - non existant message are marked as read
+	* generic - thanks to David Woodhouse, access to protocol
+	    using a command, (ex: ssh /usr/sbin/imapd)
+	    imply an API change when calling nntp_storage_init(),
+	    pop3_storage_init() or imap_storage_init().
+	* generic - pop3 - apop is tried and if deconnected, reconnection
+	    is carried out and clear authentication is tried.
+	* mime - make public the encoding functions
+	* mime - conform to RFC 2046 (quoted-string)
+	* tools - fixed chash
+	
+2002-12-18 - Christmas release ^^ //clindoeil
+
+	* version 0.27
+	* imf - added easier interface for IMF fields (RFC 2822)
+	* mime - added easier interface for MIME fields
+	* mime - conversion to quoted printable will quote F to avoid
+	    "From_" sequence
+	* imf - easier usage of IMF (RFC 2822)
+	* fixed toupper() usage
+	* generic - changed interface for mail threading so that we
+	    can notify a default charset.
+	* sunZ - capitaine de soirées
+	* tools - charconv can convert strings with illegal sequences
+	* mime - add helper functions
+	* imf - add helper functions
+	* various bugfixes
+	* imap - comments in IMAP module - API and data structure description
+	* generic - API documentation
+	* generic - flags and cache directory are now different
+	* all - can be used in C++
+	* doc - updated documentation
+	
+2002-09-02
+
+	* version 0.26
+	* generic - message interface
+	*         - new driver interface
+	* imf - bugfix
+	* generic - generic flags, flags for all drivers
+	* generic - mail_info (display of the messages list)
+		and mailmessage (display of the message) merged
+	* tools - fixed an infinite loop when EOF was reached when
+	        fetching a line finished with LF.
+	* mime - does not parse the message mime part when the subtype is
+	        not RFC822
+	* generic - flags and envelopes are stored into Berkeley Database
+		for performance
+	* generic - Berkeley database are now locked (with dotlock)
+	* generic - expunge for mboxdriver (cached version).
+	* tools - bugfix in chash
+	* mh - make a hash table from the subfolders
+	* generic - expunge for pop3driver and mhdriver (cached version)
+	* generic - status of mailboxes
+	* generic - fixed a problem with cache in mbox
+	* generic - fixed cache for nntp driver
+	* generic - "References" field is now fetched with IMAP driver
+	* imap - bugfix when parsing HEADER.FIELDS requests
+	       bugfix in literal
+	* generic - readonly mailbox in mbox driver are no more expunged
+	* tools - fixed memory leaks
+	* generic - internal uid of mbox is based on body length of the message
+	       close mailboxes when retrieving non-cached envelopes.
+	* generic - optimized flags cache
+	* generic - mail storage added
+	* generic - check_folder will store flags on disk
+	* imap - close stream no session logout
+	* imf - day of week stuff
+	* mh - implemented ...folder_find
+	* tools - some code factorization in clist
+	* imap - bugfix for mailbox data and status attribute (UNSEEN) handler
+	
+2002-06-26
+
+	* version 0.25
+	* BSD licence
+	* get rid of strndup()
+	* generic - started implementation of messages threads
+	* driver -  changed the way to get message list in NNTP driver
+	           fetch message returns also the length of the message
+	           bug fix in IMAP driver
+	* MIME - MIME message builder use the same data structure
+	           as the MIME message parser
+	* imf  - less strict parser, bug fix
+	* nntp - bugfix
+	* mbox - UID in mbox
+	* pop  - capa is implemented
+	* driver - cache for mbox and mh, new version of the driver
+	         of mbox.
+	* mh   - max index is retrieved when performing a stat of the folder
+	* MIME - bugfix when parsing multipart, base64 at padding
+	           encoded phrase can now be parsed
+	* tools - character table conversion for buffers
+	* generic - implementation of message threads in now finished
+	* tools - character table conversion notify error type
+	* mime - merged mailmime_write.c and message_build.c
+	* driver - changed interface when fetching MIME parts
+	* driver - error strings added
+	* generic - thread orderedsubject is implemented
+	* mbox - problem when the message identifier was wrong - fixed
+	* mh   - added time information so that the mh-cached driver
+	            can invalidate the cache
+	* driver - MH driver with cache is implemented
+	* mime - add parent in mailmime structure
+	* tools - macro fixed in carray
+	* imap - imap debugging can now compile
+	* driver - added parameters() to interface to set parameters specific
+	             to each driver.
+	             cache is now defined for each session, no more globally.
+		     some code cleaning
+		     mbox parameters are "force read only" and "force no UID"
+		     nntp set max articles to fetch
+	* all - changed <stdint.h> to <inttypes.h> which is more widespread
+	* pop3 - fixed APOP, timestamp is get at connection, no more when
+	             APOP was tried.
+	* tools - GPL MD5 is replaced by RSA Data Security MD5.
+	* driver - nntp cache sets starting and ending article in the cache
+	           mbox cache for a message is updated when it is changed
+		   (detected with size)
+	* tools - changed the name of stream driver so that it does
+	           not interfer with pth.
+		  the user is given the responsibility to initialize the
+		  SSL mechanism (openssl).
+	* mime - serious bugfix
+	* imf - removed "unparsed fields" type.
+	* driver - nntp does not use xover whenever there are no news
+	             header to fetch
+	           bugfix in imap
+		   take account of the bugfix in mime in maildriver_tools.c
+		   no more use of "unparsed fields".
+	
+2002-04-27
+
+	* version 0.20
+	* glib calls removed
+	* driver interface added
+
+2002-02-10
+	
+	* version 0.10
+	* initial release

+ 284 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/NEWS

@@ -0,0 +1,284 @@
+2006-03-22 - libetpan-0.45
+
+	* release 0.45 - Depth Charge
+	    bugfix release
+
+2006-03-08 - libetpan-0.43
+
+	* release 0.43 - Lateralus
+	    bugfix release
+
+2006-01-09 - libetpan-0.42
+
+	* release 0.41 - Figure Number Five
+	    bugfix release
+
+2005-12-02 - libetpan-0.41
+
+    * release 0.41 - Transfixion
+        * passphrase is implemented for S/MIME and PGP.
+        * avoid symbols conflict between GnuTLS and OpenSSL.
+
+2005-10-07 - libetpan-0.40 - hoa
+
+    * release 0.40 - Kashmir
+
+	* SSL initialization is optional.
+
+2005-09-16 - libetpan-0.39 - hoa
+
+    * release 0.39 - Deliverance
+
+	* compatibility with GnuTLS
+	* SASL for higher level
+									
+2005-07-20 - libetpan-0.38 - hoa
+
+    * release 0.38 - Deadwing
+
+	* fixed SSL
+	* IMAP improvements
+	* SASL
+
+2005-07-03 - libetpan-0.37 - hoa
+
+    * release 0.37 - Deadwing
+
+	* windows port
+	* fixed IMAP implementation (for sylpheed)
+
+2005-02-22 - libetpan-0.36 - hoa
+
+    * release 0.36 - Silver Drop
+        
+        * memory leak
+        * fixed maildir support
+
+2004-12-28 - libetpan-0.35 - hoa
+
+    libEtPan! - a mail library
+	
+    	* release 0.35 - Dimebag Darrell
+
+	* minor bugfixes.
+
+2004-11-04 - libetpan-0.34 - hoa
+
+    libEtPan! - a mail library
+	
+	* release 0.34 - edge
+
+	* general
+	   - support for debian systems mbox
+	   - ability to disable thread-safe support
+
+
+2004-08-24 - libetpan-0.33 - hoa
+
+    libEtPan! - a mail library
+	
+	* release 0.33 - entropia
+
+	* general
+	   - bugfixes in IMAP module and mailstream
+	   - fixed low-level data structures
+	   - better support for ARM and PPC architecture
+       - support for cross-compilation	
+	   - fixed Berkeley DB support
+	   - changed folder structure of libetpan package
+	   - can now add a message to a mailbox with flags
+	   - support for hotmail mailboxes (with help of hotwayd)
+	   - added Berkeley DB mail storage as experimental
+       - added support for PGP and S/MIME
+	   - better folder API
+
+
+2003-12-16 - libetpan-0.32 - hoa
+
+	libEtPan! - a mail library
+
+	* release 0.32 - Black Utopia
+
+	* general
+	    - added documentation for IMF / tools
+	    - bugfixes in IMAP module due to structures change.
+	    - Application that use libEtPan! now have to use
+	        '#include <libetpan/libetpan.h>'
+
+	* generic    
+	    - get_message() is implemented in Maildir cached driver.
+
+2003-12-10 - libEtPan! version 0.31
+
+	libEtPan! - a mail library
+
+	* release 0.31 - Steve Morse release
+
+	* general
+	    - all fields name of structures are changed.
+	    - bugfixes.
+	    - union {} are added everywhere it is possible to save memory.
+	    - support for Berkeley DB 1.
+	    - improved compatibility with FreeBSD and Mac OS X.
+	
+	* drivers
+	    - cache drivers are disable if Berkeley DB is not found.
+	    - disable search call.
+	    - support of buggy Courier-IMAP server.
+	    - semantic of mailsession_get_envelopes_list() changed : it 
+	        does no more remove messages from the list.
+	    - mailsession_get_message_by_uid() is added and implemented 
+	        in some drivers.
+
+2003-11-21 - libEtPan! version 0.30
+
+	libEtPan! - a mail library
+
+	* release 0.30 - Spock's Beard release
+	
+	*  main new features
+	    - cache for drivers is cleaned up.
+	    - maildir driver.
+
+	* general
+	    - fixed several memory leaks.
+	    
+	    - defines now exist for new features since version 0.29
+
+
+	* tools
+	    - dump of network traffic is now possible by setting
+	      exported variable mailstream_debug to 1.
+	    
+	    - TLS/SSL driver for stream is fixed.
+	    
+	* imf
+	    - fixed RFC 2822 format, wrap headers and break lines
+	      when they are longer than requirement (998).
+	    
+	    - reduced size of headers data.
+	      a union is used inside the structure.
+	      *** WARNING *** : this change use of structure field as a union
+	      member is used in mailimf_field structure.
+
+	* imap
+	   - several fixes in IMAP module.
+	
+	* mime
+	   - fixed quoted-printable parser.
+	
+	* generic - cache for drivers
+	   - cache database is now cleaned up.
+	   
+	   - fixed header fields cache.
+	      *** WARNING *** cache format changed. You should reset all
+	      your cache of headers (env.db).
+
+	* generic - threading
+      
+	   - fixed threading when threading by references with subject.
+
+	* generic - drivers for message
+   
+	   - separated flush() and check() in message.
+	     *** WARNING *** : this changes the API of the message.
+	     flush() is used to free the internal structure used
+	     to store the MIME structure of the message. It invalidates
+	     the "mime" member of the message.
+	     check() is used for to notify the modification of message
+	     flags to the session, so that the session saves the flags
+	     of the message at the next call of mailsession_check() or
+	     when leaving the session.
+
+	   - IMAP implementation is more compliant.
+	   
+	   - added driver to build MIME message and see the rendering
+	     through fetch functions.
+	     
+	   - added driver to parse message content given with a string.
+
+	* generic - drivers for maildir
+
+	   - maildir driver for storage / session / messages
+	     is implemented.
+
+* 2003-10-06 - libEtPan! version 0.29
+
+	libEtPan! - a mail library
+
+	* XetPan release
+
+	* debug for stream, network timeout
+	* SSL library is initialized by SSL stream driver
+	* fixed messages threading
+	* added SMTP authentication CRAM-MD5, LOGIN, PLAIN
+	* added example of use of SMTP
+
+* 2003-04-01 - libEtPan! version 0.28
+
+	libEtPan! - a mail library
+	
+	* Avril Lavigne Release
+
+	* fixed IMAP parser
+	* access to network protocols with a command
+	* pop3 driver can try APOP authentication and fallback on clear
+		authentication
+
+* 2002-12-18 - libEtPan! version 0.27
+
+	libEtPan! - a mail library
+	
+	* Christmas release ^^ //clindoeil
+
+	* helper interface for IMF (RFC 2822) and MIME
+	* changed interface for mail threading so that a default
+	    charset can be set.
+		*** this means that mail threading INTERFACE CHANGED ***
+	* API documentation in code
+	* flags directory and cache directory can be different.
+		*** this means that storage INTERFACE CHANGED ***
+
+* 2002-09-02 - libEtPan! version 0.26
+
+	libEtPan! - a mail library
+
+	* flags for all cache drivers
+	* flags stored on disk use Berkeley DB
+	* mailmessage, session and storage interface are separated
+		*** this means that generic INTERFACE CHANGED ***
+	* fixes various bugs and memory leaks
+
+	etpan - a console mail client
+
+	* available on CVS
+	* virtual folder (using storage interface) is used
+	* folder list view / message list view / message view
+	* we can poll for status of mailboxes
+	* got rid of expat
+	* uses new interface of libEtPan!
+
+* 2002-06-26 - libEtPan! version 0.25
+
+	libEtPan! - a mail library
+
+	* BSD licence
+	* portability tested on Solaris, FreeBSD, IRIX and Linux
+	* implementation of messages threads
+	* MIME message generator
+	* drivers are implemented for IMAP4rev1, POP3, NNTP, MH, mbox
+	    in both cached and non-cached version.
+
+	etpan - a console mail client
+
+	* a small mail client not distributed has been implemented
+	    written in ncurses
+	    featuring :
+		- MIME message editor
+	    	- IMAP4rev1, POP3, NNTP, MH, mbox access
+	    	- renderer (HTML rendering for example)
+	    	- retrieving of MIME parts
+		- messages threads
+
+	    big missing feature :
+		- removing messages is not yet possible

+ 62 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/README.md

@@ -0,0 +1,62 @@
+## LibEtPan
+
+The purpose of this mail library is to provide a portable, efficient framework for different kinds of mail access: IMAP, SMTP, POP and NNTP.
+
+It provides an API for C language.
+
+[![Build Status](https://travis-ci.org/dinhviethoa/libetpan.png?branch=master)](https://travis-ci.org/dinhviethoa/libetpan)
+
+## Features
+
+- IMAP
+- SMTP
+- POP
+- NNTP
+- RFC822/MIME message builder
+- RFC822/MIME message parser
+- Maildir
+- mbox
+- MH
+
+## Build instructions
+
+### Unix
+
+You need to install autoconf, automake and libtool.
+They can be installed using [brew](http://brew.sh/).
+
+    $ ./autogen.sh
+    $ make
+
+You can use flag --with-poll for using poll() instead of select() for checking connection status
+
+### How to link with it
+
+    $ gcc -c -o sample.o sample.c `libetpan-config --cflags`
+    $ gcc -o sample sample.o `libetpan-config --libs`
+
+### Mac / iOS
+
+- Download Xcode
+- Open `build-mac/libetpan.xcodeproj`
+- Choose the correct target "static libetpan" for Mac or "libetpan ios" for iOS.
+- Build
+
+### Setup a Mac project
+
+- Add `libetpan.xcodeproj` as sub-project
+- Link with libetpan.a
+
+### Setup an iOS project
+
+- Add `libetpan.xcodeproj` as sub-project
+- Link with libetpan-ios.a
+- Set "Other Linker Flags": `-lsasl2`
+
+### Build on Windows
+
+- See README and Visual Studio Solution in build-windows folder
+
+## More information
+
+See http://etpan.org/libetpan.html for more information and examples.

+ 165 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/acl.h

@@ -0,0 +1,165 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+  TODO: parse extension to capability as defined in [rfc4314].
+  capability    =/ rights-capa
+
+  This should actually be automatically parsed by parse_capability_data,
+  so maybe it's sufficient to code a higher-level (not mailimap) function
+  that returns a list of extra-rights as defined in rights-capa.
+*/
+
+#ifndef ACL_H
+
+#define ACL_H
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailimap_extension.h>
+#include <libetpan/acl_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBETPAN_EXPORT
+extern struct mailimap_extension_api mailimap_extension_acl;
+
+/*
+  mailimap_acl_setacl()
+
+  This will set access for an identifier on the mailbox specified.
+
+  @param session      the IMAP session
+  @param mailbox      the mailbox to modify
+  @param identifier   the identifier to set access-rights for
+  @param mod_rights   the modification to make to the rights
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+
+*/
+
+LIBETPAN_EXPORT
+int mailimap_acl_setacl(mailimap * session,
+    const char * mailbox,
+    const char * identifier,
+    const char * mod_rights);
+
+/*
+  mailimap_acl_deleteacl()
+
+  This will remove the acl on the mailbox for the identifier specified.
+
+  @param session      the IMAP session
+  @param mailbox      the mailbox to modify
+  @param identifier   the identifier to remove acl for
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+
+*/
+
+LIBETPAN_EXPORT
+int mailimap_acl_deleteacl(mailimap * session,
+    const char * mailbox,
+    const char * identifier);
+
+/*
+  mailimap_acl_getacl()
+
+  This will get a list of acls for the mailbox
+
+  @param session  the IMAP session
+  @param mailbox  the mailbox to get the acls for
+  @param result   this will store a clist of (struct mailimap_acl_acl_data *)
+      in (* result)
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+
+*/
+
+LIBETPAN_EXPORT
+int mailimap_acl_getacl(mailimap * session,
+    const char * mailbox,
+    clist ** result);
+
+/*
+  mailimap_acl_listrights()
+
+  The LISTRIGHTS command takes a mailbox name and an identifier and
+  returns information about what rights can be granted to the
+  identifier in the ACL for the mailbox.
+
+  @param session    the IMAP session
+  @param mailbox    the mailbox to get the acls for
+  @param identifier the identifier to query the acls for
+  @param result     this will store a (struct mailimap_acl_listrights_data *)
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+
+*/
+
+LIBETPAN_EXPORT
+int mailimap_acl_listrights(mailimap * session,
+    const char * mailbox,
+    const char * identifier,
+    struct mailimap_acl_listrights_data ** result);
+
+/*
+  mailimap_acl_myrights()
+
+  This will list the rights for the querying user on the mailbox
+
+  @param session    the IMAP session
+  @param mailbox    the mailbox to get the acls for
+  @param result     this will store a (struct mailimap_acl_myrights_data *)
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+
+*/
+
+LIBETPAN_EXPORT
+int mailimap_acl_myrights(mailimap * session,
+    const char * mailbox,
+    struct mailimap_acl_myrights_data ** result);
+
+LIBETPAN_EXPORT
+int mailimap_has_acl(mailimap * session);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 169 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/acl_types.h

@@ -0,0 +1,169 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ACL_TYPES_H
+
+#define ACL_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailstream.h>
+#include <libetpan/clist.h>
+
+/*
+   ACL grammar
+   see [rfc4314] for further information
+
+   LOWER-ALPHA     =  %x61-7A   ;; a-z
+
+   acl-data        = "ACL" SP mailbox *(SP identifier SP
+                       rights)
+
+   capability      =/ rights-capa
+                       ;;capability is defined in [IMAP4]
+
+   command-auth    =/ setacl / deleteacl / getacl /
+                       listrights / myrights
+                       ;;command-auth is defined in [IMAP4]
+
+   deleteacl       = "DELETEACL" SP mailbox SP identifier
+
+   getacl          = "GETACL" SP mailbox
+
+   identifier      = astring
+
+   listrights      = "LISTRIGHTS" SP mailbox SP identifier
+
+   listrights-data = "LISTRIGHTS" SP mailbox SP identifier
+                           SP rights *(SP rights)
+
+   mailbox-data    =/ acl-data / listrights-data / myrights-data
+                       ;;mailbox-data is defined in [IMAP4]
+
+   mod-rights      = astring
+                       ;; +rights to add, -rights to remove
+                       ;; rights to replace
+
+   myrights        = "MYRIGHTS" SP mailbox
+
+   myrights-data   = "MYRIGHTS" SP mailbox SP rights
+
+   new-rights      = 1*LOWER-ALPHA
+                       ;; MUST include "t", "e", "x", and "k".
+                       ;; MUST NOT include standard rights listed
+                       ;; in section 2.2
+
+   rights          = astring
+                       ;; only lowercase ASCII letters and digits
+                       ;; are allowed.
+
+   rights-capa     = "RIGHTS=" new-rights
+                       ;; RIGHTS=... capability
+
+   setacl          = "SETACL" SP mailbox SP identifier
+                       SP mod-rights
+*/
+
+/*
+  only need to recognize types that can be "embedded" into main
+  IMAPrev1 types.
+*/
+enum {
+  MAILIMAP_ACL_TYPE_ACL_DATA,                   /* child of mailbox-data  */
+  MAILIMAP_ACL_TYPE_LISTRIGHTS_DATA,            /* child of mailbox-data  */
+  MAILIMAP_ACL_TYPE_MYRIGHTS_DATA               /* child of mailbox-data  */
+};
+
+void mailimap_acl_identifier_free(char * identifier);
+
+void mailimap_acl_rights_free(char * rights);
+
+struct mailimap_acl_identifier_rights {
+  char * identifer;
+  char * rights;
+};
+
+struct mailimap_acl_identifier_rights *
+mailimap_acl_identifier_rights_new(char * identifier, char * rights);
+
+void mailimap_acl_identifier_rights_free(
+        struct mailimap_acl_identifier_rights * id_rights);
+
+struct mailimap_acl_acl_data {
+  char * mailbox;
+  clist * idrights_list;
+  /* list of (struct mailimap_acl_identifier_rights *) */
+};
+
+struct mailimap_acl_acl_data *
+mailimap_acl_acl_data_new(char * mailbox, clist * idrights_list);
+
+LIBETPAN_EXPORT
+void mailimap_acl_acl_data_free(struct
+        mailimap_acl_acl_data * acl_data);
+
+struct mailimap_acl_listrights_data {
+  char * mailbox;
+  char * identifier;
+  clist * rights_list; /* list of (char *) */
+};
+
+struct mailimap_acl_listrights_data *
+mailimap_acl_listrights_data_new(char * mailbox,
+        char * identifier, clist * rights_list);
+
+LIBETPAN_EXPORT
+void mailimap_acl_listrights_data_free(struct
+        mailimap_acl_listrights_data * listrights_data);
+
+struct mailimap_acl_myrights_data {
+  char * mailbox;
+  char * rights;
+};
+
+struct mailimap_acl_myrights_data *
+mailimap_acl_myrights_data_new(char * mailbox, char * rights);
+
+LIBETPAN_EXPORT
+void mailimap_acl_myrights_data_free(struct
+        mailimap_acl_myrights_data * myrights_data);
+
+void
+mailimap_acl_free(struct mailimap_extension_data * ext_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 103 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/annotatemore.h

@@ -0,0 +1,103 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ANNOTATEMORE_H
+
+#define ANNOTATEMORE_H
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailimap_extension.h>
+#include <libetpan/annotatemore_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBETPAN_EXPORT
+extern struct mailimap_extension_api mailimap_extension_annotatemore;
+
+/*
+  mailimap_annotatemore_getannotation()
+
+  This function will get annotations from given mailboxes or the server.
+
+  @param session the IMAP session
+  @param list_mb mailbox name with possible wildcard,
+                 empty string implies server annotation
+  @param entries entry specifier with possible wildcards
+  @param attribs attribute specifier with possible wildcards
+  @param result  This will store a clist of (struct mailimap_annotate_data *)
+      in (* result)
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+  
+*/
+
+LIBETPAN_EXPORT
+int mailimap_annotatemore_getannotation(mailimap * session,
+    const char * list_mb,
+    struct mailimap_annotatemore_entry_match_list * entries,
+    struct mailimap_annotatemore_attrib_match_list * attribs,
+    clist ** result);
+
+/*
+  mailimap_annotatemore_setannotation()
+
+  This function will set annotations on given mailboxes or the server.
+
+  @param session  the IMAP session
+  @param list_mb  mailbox name with possible wildcard,
+                  empty string implies server annotation
+  @param en_att   a list of entries/attributes to set
+  @param result   if return is MAILIMAP_ERROR_EXTENSION result
+                  is MAILIMAP_ANNOTATEMORE_RESP_TEXT_CODE_TOOBIG or
+                  MAILIMAP_ANNOTATEMORE_RESP_TEXT_CODE_TOOMANY for
+                  extra information about the error.
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_annotatemore_setannotation(mailimap * session,
+    const char * list_mb,
+    struct mailimap_annotatemore_entry_att_list * en_att,
+    int * result);
+
+LIBETPAN_EXPORT
+int mailimap_has_annotatemore(mailimap * session);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 268 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/annotatemore_types.h

@@ -0,0 +1,268 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ANNOTATEMORE_TYPES_H
+
+#define ANNOTATEMORE_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailstream.h>
+#include <libetpan/clist.h>
+
+/*
+   ANNOTATEMORE grammar
+   see [draft-daboo-imap-annotatemore-07] for further information
+
+   annotate-data     = "ANNOTATION" SP mailbox SP entry-list
+                       ; empty string for mailbox implies
+                       ; server annotation.
+
+   att-value         = attrib SP value
+
+   attrib            = string
+                       ; dot-separated attribute name
+                       ; MUST NOT contain "*" or "%"
+   attrib-match      = string
+                       ; dot-separated attribute name
+                       ; MAY contain "*" or "%" for use as wildcards
+
+   attribs           = attrib-match / "(" attrib-match *(SP attrib-match) ")"
+                       ; attribute specifiers that can include wildcards
+
+   command-auth      /= setannotation / getannotation
+                       ; adds to original IMAP command
+
+   entries           = entry-match / "(" entry-match *(SP entry-match) ")"
+                       ; entry specifiers that can include wildcards
+
+   entry             = string
+                       ; slash-separated path to entry
+                       ; MUST NOT contain "*" or "%"
+
+   entry-att         = entry SP "(" att-value *(SP att-value) ")"
+
+   entry-list        = entry-att *(SP entry-att) /
+                       "(" entry *(SP entry) ")"
+                       ; entry attribute-value pairs list for
+                       ; GETANNOTATION response, or
+                       ; parenthesised entry list for unsolicited
+                       ; notification of annotation changes
+
+   entry-match       = string
+                       ; slash-separated path to entry
+                       ; MAY contain "*" or "%" for use as wildcards
+
+   getannotation     = "GETANNOTATION" SP list-mailbox SP entries SP attribs
+                       ; empty string for list-mailbox implies
+                       ; server annotation.
+
+   response-data     /= "*" SP annotate-data CRLF
+                       ; adds to original IMAP data responses
+
+   resp-text-code    =/ "ANNOTATEMORE" SP "TOOBIG" /
+                        "ANNOTATEMORE" SP "TOOMANY"
+                       ; new response codes for SETANNOTATION failures
+
+   setannotation     = "SETANNOTATION" SP list-mailbox SP setentryatt
+                       ; empty string for list-mailbox implies
+                       ; server annotation.
+
+   setentryatt       = entry-att / "(" entry-att *(SP entry-att) ")"
+
+   value             = nstring
+*/
+
+/*
+  only need to recognize types that can be "embedded" into main
+  IMAPrev1 types.
+*/
+enum {
+  MAILIMAP_ANNOTATEMORE_TYPE_ANNOTATE_DATA,          /* child of response-data   */
+  MAILIMAP_ANNOTATEMORE_TYPE_RESP_TEXT_CODE          /* child of resp-text-code  */
+};
+
+/*
+  error codes for annotatemore.
+*/
+enum {
+  MAILIMAP_ANNOTATEMORE_RESP_TEXT_CODE_UNSPECIFIED, /* unspecified response   */
+  MAILIMAP_ANNOTATEMORE_RESP_TEXT_CODE_TOOBIG,      /* annotation too big     */
+  MAILIMAP_ANNOTATEMORE_RESP_TEXT_CODE_TOOMANY      /* too many annotations   */
+};
+
+void mailimap_annotatemore_attrib_free(char * attrib);
+
+void mailimap_annotatemore_value_free(char * value);
+
+void mailimap_annotatemore_entry_free(char * entry);
+
+struct mailimap_annotatemore_att_value  {
+  char * attrib;
+  char * value;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_att_value *
+mailimap_annotatemore_att_value_new(char * attrib, char * value);
+
+void mailimap_annotatemore_att_value_free(struct
+        mailimap_annotatemore_att_value * att_value);
+
+struct mailimap_annotatemore_entry_att {
+  char * entry;
+  clist * att_value_list;
+  /* list of (struct mailimap_annotatemore_att_value *) */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_entry_att *
+mailimap_annotatemore_entry_att_new(char * entry, clist * list);
+
+LIBETPAN_EXPORT
+void mailimap_annotatemore_entry_att_free(struct
+        mailimap_annotatemore_entry_att * en_att);
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_entry_att *
+mailimap_annotatemore_entry_att_new_empty(char * entry);
+
+LIBETPAN_EXPORT
+int mailimap_annotatemore_entry_att_add(struct
+        mailimap_annotatemore_entry_att * en_att,
+        struct mailimap_annotatemore_att_value * at_value);
+
+enum {
+  MAILIMAP_ANNOTATEMORE_ENTRY_LIST_TYPE_ERROR,          /* error condition */
+  MAILIMAP_ANNOTATEMORE_ENTRY_LIST_TYPE_ENTRY_ATT_LIST, /* entry-att-list */
+  MAILIMAP_ANNOTATEMORE_ENTRY_LIST_TYPE_ENTRY_LIST      /* entry-list */
+};
+
+struct mailimap_annotatemore_entry_list {
+  int en_list_type;
+  clist * en_list_data;
+  /* either a list of (struct annotatemore_entry_att *)
+     or a list of (char *) */
+};
+
+struct mailimap_annotatemore_entry_list *
+mailimap_annotatemore_entry_list_new(int type, clist * en_att_list, clist * en_list);
+
+void mailimap_annotatemore_entry_list_free(struct
+        mailimap_annotatemore_entry_list * en_list);
+
+struct mailimap_annotatemore_annotate_data {
+  char * mailbox;
+  struct mailimap_annotatemore_entry_list * entry_list;
+};
+
+struct mailimap_annotatemore_annotate_data *
+mailimap_annotatemore_annotate_data_new(char * mb, struct
+        mailimap_annotatemore_entry_list * en_list);
+
+LIBETPAN_EXPORT
+void mailimap_annotatemore_annotate_data_free(struct
+        mailimap_annotatemore_annotate_data * an_data);
+
+struct mailimap_annotatemore_entry_match_list {
+  clist * entry_match_list; /* list of (char *) */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_entry_match_list *
+mailimap_annotatemore_entry_match_list_new(clist * en_list);
+
+LIBETPAN_EXPORT
+void mailimap_annotatemore_entry_match_list_free(
+        struct mailimap_annotatemore_entry_match_list * en_list);
+
+struct mailimap_annotatemore_attrib_match_list {
+  clist * attrib_match_list; /* list of (char *) */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_attrib_match_list *
+mailimap_annotatemore_attrib_match_list_new(clist * at_list);
+
+LIBETPAN_EXPORT
+void mailimap_annotatemore_attrib_match_list_free(
+        struct mailimap_annotatemore_attrib_match_list * at_list);
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_entry_match_list *
+mailimap_annotatemore_entry_match_list_new_empty(void);
+
+LIBETPAN_EXPORT
+int mailimap_annotatemore_entry_match_list_add(
+      struct mailimap_annotatemore_entry_match_list * en_list,
+      char * entry);
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_attrib_match_list *
+mailimap_annotatemore_attrib_match_list_new_empty(void);
+
+LIBETPAN_EXPORT
+int mailimap_annotatemore_attrib_match_list_add(
+      struct mailimap_annotatemore_attrib_match_list * at_list,
+      char * attrib);
+
+struct mailimap_annotatemore_entry_att_list {
+  clist * entry_att_list; /* list of (mailimap_annotatemore_entry_att *) */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_entry_att_list *
+mailimap_annotatemore_entry_att_list_new(clist * en_list);
+
+LIBETPAN_EXPORT
+void mailimap_annotatemore_entry_att_list_free(
+      struct mailimap_annotatemore_entry_att_list * en_list);
+
+LIBETPAN_EXPORT
+struct mailimap_annotatemore_entry_att_list *
+mailimap_annotatemore_entry_att_list_new_empty(void);
+
+LIBETPAN_EXPORT
+int mailimap_annotatemore_entry_att_list_add(
+      struct mailimap_annotatemore_entry_att_list * en_list,
+      struct mailimap_annotatemore_entry_att * en_att);
+
+void
+mailimap_annotatemore_free(struct mailimap_extension_data * ext_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 149 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/carray.h

@@ -0,0 +1,149 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * carray - Implements simple dynamic pointer arrays
+ *
+ * Copyright (c) 1999-2005, Gaël Roualland <gael.roualland@iname.com>
+ * interface changes - 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: carray.h,v 1.18 2010/11/16 20:46:35 hoa Exp $
+ */
+
+#ifndef CARRAY_H
+#define CARRAY_H
+
+#ifndef LIBETPAN_CONFIG_H
+#	include <libetpan/libetpan-config.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct carray_s {
+  void ** array;
+  unsigned int len;
+  unsigned int max;
+};
+
+typedef struct carray_s carray;
+
+/* Creates a new array of pointers, with initsize preallocated cells */
+LIBETPAN_EXPORT
+carray *   carray_new(unsigned int initsize);
+
+/* Adds the pointer to data in the array.
+   Returns the index of the pointer in the array or -1 on error */
+LIBETPAN_EXPORT
+int       carray_add(carray * array, void * data, unsigned int * indx);
+
+LIBETPAN_EXPORT
+int carray_set_size(carray * array, unsigned int new_size);
+
+/* Removes the cell at this index position. Returns TRUE on success.
+   Order of elements in the array IS changed. */
+LIBETPAN_EXPORT
+int       carray_delete(carray * array, unsigned int indx);
+
+/* Removes the cell at this index position. Returns TRUE on success.
+   Order of elements in the array IS not changed. */
+LIBETPAN_EXPORT
+int       carray_delete_slow(carray * array, unsigned int indx);
+
+/* remove without decreasing the size of the array */
+LIBETPAN_EXPORT
+int carray_delete_fast(carray * array, unsigned int indx);
+
+/* Some of the following routines can be implemented as macros to
+   be faster. If you don't want it, define NO_MACROS */
+#ifdef NO_MACROS
+
+/* Returns the array itself */
+LIBETPAN_EXPORT
+void **   carray_data(carray *);
+
+/* Returns the number of elements in the array */
+LIBETPAN_EXPORT
+unsigned int carray_count(carray *);
+
+/* Returns the contents of one cell */
+LIBETPAN_EXPORT
+void *    carray_get(carray * array, unsigned int indx);
+
+/* Sets the contents of one cell */
+LIBETPAN_EXPORT
+void      carray_set(carray * array, unsigned int indx, void * value);
+
+#else
+
+#if 0
+#define   carray_data(a)         (a->array)
+#define   carray_count(a)        (a->len)
+#define   carray_get(a, indx)    (a->array[indx])
+#define   carray_set(a, indx, v) do { a->array[indx]=v; } while(0)
+#endif
+
+#ifndef INLINE
+#ifdef _MSC_VER
+#define INLINE __inline
+#else
+#define INLINE inline
+#endif
+#endif
+
+static INLINE void ** carray_data(carray * array)
+{
+  return array->array;
+}
+
+static INLINE unsigned int carray_count(carray * array)
+{
+  return array->len;
+}
+
+static INLINE void * carray_get(carray * array, unsigned int indx)
+{
+  return array->array[indx];
+}
+
+static INLINE void carray_set(carray * array, unsigned int indx, void * value)
+{
+  array->array[indx] = value;
+}
+#endif
+
+LIBETPAN_EXPORT
+void carray_free(carray * array);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 84 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/charconv.h

@@ -0,0 +1,84 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: charconv.h,v 1.13 2006/06/16 09:25:23 smarinier Exp $
+ */
+
+#ifndef CHARCONV_H
+
+#define CHARCONV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#ifndef LIBETPAN_CONFIG_H
+#	include <libetpan/libetpan-config.h>
+#endif
+
+enum {
+  MAIL_CHARCONV_NO_ERROR = 0,
+  MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET,
+  MAIL_CHARCONV_ERROR_MEMORY,
+  MAIL_CHARCONV_ERROR_CONV
+};
+
+/**
+*	define your own conversion. 
+*		- result is big enough to contain your converted string 
+*		- result_len contain the maximum size available (out value must contain the final converted size)
+*		- your conversion return an error code based on upper enum values
+*/
+LIBETPAN_EXPORT
+extern int (*extended_charconv)(const char * tocode, const char * fromcode, const char * str, size_t length,
+    char * result, size_t* result_len);
+
+LIBETPAN_EXPORT
+int charconv(const char * tocode, const char * fromcode,
+    const char * str, size_t length,
+    char ** result);
+
+LIBETPAN_EXPORT
+int charconv_buffer(const char * tocode, const char * fromcode,
+		    const char * str, size_t length,
+		    char ** result, size_t * result_len);
+
+LIBETPAN_EXPORT
+void charconv_buffer_free(char * str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 191 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/chash.h

@@ -0,0 +1,191 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * chash - Implements generic hash tables.
+ *
+ * Copyright (c) 1999-2005, Gaël Roualland <gael.roualland@iname.com>
+ * interface changes - 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: chash.h,v 1.16 2010/11/16 20:46:35 hoa Exp $
+ */
+
+#ifndef CHASH_H
+#define CHASH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef LIBETPAN_CONFIG_H
+#	include <libetpan/libetpan-config.h>
+#endif
+
+typedef struct {
+  void * data;
+  unsigned int len;
+} chashdatum;
+
+struct chash {
+  unsigned int size;
+  unsigned int count;
+  int copyvalue;
+  int copykey;
+  struct chashcell ** cells; 
+};
+
+typedef struct chash chash;
+
+struct chashcell {
+  unsigned int func;
+  chashdatum key;
+  chashdatum value;
+  struct chashcell * next;
+};
+
+typedef struct chashcell chashiter;
+
+#define CHASH_COPYNONE    0
+#define CHASH_COPYKEY     1
+#define CHASH_COPYVALUE   2
+#define CHASH_COPYALL     (CHASH_COPYKEY | CHASH_COPYVALUE)
+
+#define CHASH_DEFAULTSIZE 13
+  
+/* Allocates a new (empty) hash using this initial size and the given flags,
+   specifying which data should be copied in the hash.
+    CHASH_COPYNONE  : Keys/Values are not copied.
+    CHASH_COPYKEY   : Keys are dupped and freed as needed in the hash.
+    CHASH_COPYVALUE : Values are dupped and freed as needed in the hash.
+    CHASH_COPYALL   : Both keys and values are dupped in the hash.
+ */
+LIBETPAN_EXPORT
+chash * chash_new(unsigned int size, int flags);
+
+/* Frees a hash */
+LIBETPAN_EXPORT
+void chash_free(chash * hash);
+
+/* Removes all elements from a hash */
+LIBETPAN_EXPORT
+void chash_clear(chash * hash);
+
+/* Adds an entry in the hash table.
+   Length can be 0 if key/value are strings.
+   If an entry already exists for this key, it is replaced, and its value
+   is returned. Otherwise, the data pointer will be NULL and the length
+   field be set to TRUE or FALSe to indicate success or failure. */
+LIBETPAN_EXPORT
+int chash_set(chash * hash,
+	      chashdatum * key,
+	      chashdatum * value,
+	      chashdatum * oldvalue);
+
+/* Retrieves the data associated to the key if it is found in the hash table.
+   The data pointer and the length will be NULL if not found*/
+LIBETPAN_EXPORT
+int chash_get(chash * hash,
+	      chashdatum * key, chashdatum * result);
+
+/* Removes the entry associated to this key if it is found in the hash table,
+   and returns its contents if not dupped (otherwise, pointer will be NULL
+   and len TRUE). If entry is not found both pointer and len will be NULL. */
+LIBETPAN_EXPORT
+int chash_delete(chash * hash,
+		 chashdatum * key,
+		 chashdatum * oldvalue);
+
+/* Resizes the hash table to the passed size. */
+LIBETPAN_EXPORT
+int chash_resize(chash * hash, unsigned int size);
+
+/* Returns an iterator to the first non-empty entry of the hash table */
+LIBETPAN_EXPORT
+chashiter * chash_begin(chash * hash);
+
+/* Returns the next non-empty entry of the hash table */
+LIBETPAN_EXPORT
+chashiter * chash_next(chash * hash, chashiter * iter);
+
+/* Some of the following routines can be implemented as macros to
+   be faster. If you don't want it, define NO_MACROS */
+#ifdef NO_MACROS
+/* Returns the size of the hash table */
+LIBETPAN_EXPORT
+unsigned int          chash_size(chash * hash);
+
+/* Returns the number of entries in the hash table */
+LIBETPAN_EXPORT
+unsigned int          chash_count(chash * hash);
+
+/* Returns the key part of the entry pointed by the iterator */
+LIBETPAN_EXPORT
+void chash_key(chashiter * iter, chashdatum * result);
+
+/* Returns the value part of the entry pointed by the iterator */
+LIBETPAN_EXPORT
+void chash_value(chashiter * iter, chashdatum * result);
+
+#else
+
+#ifndef INLINE
+#ifdef _MSC_VER
+#define INLINE __inline
+#else
+#define INLINE inline
+#endif
+#endif
+
+static INLINE unsigned int chash_size(chash * hash)
+{
+  return hash->size;
+}
+
+static INLINE unsigned int chash_count(chash * hash)
+{
+  return hash->count;
+}
+
+static INLINE void chash_key(chashiter * iter, chashdatum * result)
+{
+  * result = iter->key;
+}
+
+static INLINE void chash_value(chashiter * iter, chashdatum * result)
+{
+  * result = iter->value;
+}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 146 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/clist.h

@@ -0,0 +1,146 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * clist - Implements simple generic double-linked pointer lists
+ *
+ * Copyright (c) 1999-2005, Gaël Roualland <gael.roualland@iname.com>
+ * interface changes - 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: clist.h,v 1.13 2011/05/09 21:49:46 hoa Exp $
+ */
+
+#ifndef CLIST_H
+#define CLIST_H
+
+#ifndef LIBETPAN_CONFIG_H
+#       include <libetpan/libetpan-config.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct clistcell_s {
+  void * data;
+  struct clistcell_s * previous;
+  struct clistcell_s * next;
+} clistcell;
+
+struct clist_s {
+  clistcell * first;
+  clistcell * last;
+  int count;
+};
+
+typedef struct clist_s clist;
+typedef clistcell clistiter;
+
+/* Allocate a new pointer list */
+LIBETPAN_EXPORT
+clist *      clist_new(void);
+
+/* Destroys a list. Data pointed by data pointers is NOT freed. */
+LIBETPAN_EXPORT
+void        clist_free(clist *);
+
+/* Some of the following routines can be implemented as macros to
+   be faster. If you don't want it, define NO_MACROS */
+#ifdef NO_MACROS
+
+/* Returns TRUE if list is empty */
+int         clist_isempty(clist *);
+
+/* Returns the number of elements in the list */
+int         clist_count(clist *);
+
+/* Returns an iterator to the first element of the list */
+clistiter *   clist_begin(clist *);
+
+/* Returns an iterator to the last element of the list */
+clistiter *   clist_end(clist *);
+
+/* Returns an iterator to the next element of the list */
+clistiter *   clist_next(clistiter *);
+
+/* Returns an iterator to the previous element of the list */
+clistiter *   clist_previous(clistiter *);
+
+/* Returns the data pointer of this element of the list */
+void*       clist_content(clistiter *);
+
+/* Inserts this data pointer at the beginning of the list */
+int         clist_prepend(clist *, void *);
+
+/* Inserts this data pointer at the end of the list */
+int         clist_append(clist *, void *);
+#else
+#define     clist_isempty(lst)             (((lst)->first==(lst)->last) && ((lst)->last==NULL))
+#define     clist_count(lst)               ((lst)->count)
+#define     clist_begin(lst)               ((lst)->first)
+#define     clist_end(lst)                 ((lst)->last)
+#define     clist_next(iter)               (iter ? (iter)->next : NULL)
+#define     clist_previous(iter)           (iter ? (iter)->previous : NULL)
+#define     clist_content(iter)            (iter ? (iter)->data : NULL)
+#define     clist_prepend(lst, data)  (clist_insert_before(lst, (lst)->first, data))
+#define     clist_append(lst, data)   (clist_insert_after(lst, (lst)->last, data))
+#endif
+
+/* Inserts this data pointer before the element pointed by the iterator */
+LIBETPAN_EXPORT
+int         clist_insert_before(clist *, clistiter *, void *);
+
+/* Inserts this data pointer after the element pointed by the iterator */
+LIBETPAN_EXPORT
+int         clist_insert_after(clist *, clistiter *, void *);
+
+/* Deletes the element pointed by the iterator.
+   Returns an iterator to the next element. */
+LIBETPAN_EXPORT
+clistiter *   clist_delete(clist *, clistiter *);
+
+typedef void (* clist_func)(void *, void *);
+
+LIBETPAN_EXPORT
+void clist_foreach(clist * lst, clist_func func, void * data);
+
+LIBETPAN_EXPORT
+void clist_concat(clist * dest, clist * src);
+
+LIBETPAN_EXPORT
+void * clist_nth_data(clist * lst, int indx);
+
+LIBETPAN_EXPORT
+clistiter * clist_nth(clist * lst, int indx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 101 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/condstore.h

@@ -0,0 +1,101 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2013 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef CONDSTORE_H
+
+#define CONDSTORE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailimap_extension.h>
+#include <libetpan/condstore_types.h>
+
+LIBETPAN_EXPORT
+extern struct mailimap_extension_api mailimap_extension_condstore;
+
+LIBETPAN_EXPORT
+int mailimap_store_unchangedsince(mailimap * session,
+	struct mailimap_set * set, uint64_t mod_sequence_valzer,
+	struct mailimap_store_att_flags * store_att_flags);
+
+LIBETPAN_EXPORT
+int mailimap_uid_store_unchangedsince(mailimap * session,
+	struct mailimap_set * set, uint64_t mod_sequence_valzer,
+	struct mailimap_store_att_flags * store_att_flags);
+
+LIBETPAN_EXPORT
+int mailimap_fetch_changedsince(mailimap * session,
+	struct mailimap_set * set,
+	struct mailimap_fetch_type * fetch_type, uint64_t mod_sequence_value,
+	clist ** result);
+
+LIBETPAN_EXPORT
+int mailimap_uid_fetch_changedsince(mailimap * session,
+	struct mailimap_set * set,
+	struct mailimap_fetch_type * fetch_type, uint64_t mod_sequence_value,
+	clist ** result);
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att * mailimap_fetch_att_new_modseq(void);
+
+LIBETPAN_EXPORT
+int mailimap_search_modseq(mailimap * session, const char * charset,
+	struct mailimap_search_key * key, clist ** result, uint64_t * p_mod_sequence_value);
+
+LIBETPAN_EXPORT
+int mailimap_uid_search_modseq(mailimap * session, const char * charset,
+	struct mailimap_search_key * key, clist ** result, uint64_t * p_mod_sequence_value);
+
+LIBETPAN_EXPORT
+int mailimap_search_literalplus_modseq(mailimap * session, const char * charset,
+                                       struct mailimap_search_key * key, clist ** result, uint64_t * p_mod_sequence_value);
+  
+LIBETPAN_EXPORT
+int mailimap_uid_search_literalplus_modseq(mailimap * session, const char * charset,
+                                           struct mailimap_search_key * key, clist ** result, uint64_t * p_mod_sequence_value);
+
+LIBETPAN_EXPORT
+int mailimap_select_condstore(mailimap * session, const char * mb, uint64_t * p_mod_sequence_value);
+
+LIBETPAN_EXPORT
+int mailimap_examine_condstore(mailimap * session, const char * mb, uint64_t * p_mod_sequence_value);
+
+LIBETPAN_EXPORT
+int mailimap_has_condstore(mailimap * session);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 97 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/condstore_types.h

@@ -0,0 +1,97 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2013 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef CONDSTORE_TYPE_H
+
+#define CONDSTORE_TYPE_H
+
+#include <libetpan/mailimap_types.h>
+
+enum {
+  MAILIMAP_CONDSTORE_TYPE_FETCH_DATA,
+  MAILIMAP_CONDSTORE_TYPE_RESP_TEXT_CODE,
+  MAILIMAP_CONDSTORE_TYPE_SEARCH_DATA,
+  MAILIMAP_CONDSTORE_TYPE_STATUS_INFO
+};
+
+struct mailimap_condstore_fetch_mod_resp {
+  uint64_t cs_modseq_value;
+};
+
+enum {
+  MAILIMAP_CONDSTORE_RESPTEXTCODE_HIGHESTMODSEQ,
+  MAILIMAP_CONDSTORE_RESPTEXTCODE_NOMODSEQ,
+  MAILIMAP_CONDSTORE_RESPTEXTCODE_MODIFIED
+};
+
+struct mailimap_condstore_resptextcode {
+  int cs_type;
+  union {
+    uint64_t cs_modseq_value;
+    struct mailimap_set * cs_modified_set;
+  } cs_data;
+};
+
+struct mailimap_condstore_search {
+  clist * cs_search_result; /* uint32_t */
+  uint64_t cs_modseq_value;
+};
+
+struct mailimap_condstore_status_info {
+  uint64_t cs_highestmodseq_value;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_condstore_fetch_mod_resp * mailimap_condstore_fetch_mod_resp_new(uint64_t cs_modseq_value);
+
+LIBETPAN_EXPORT
+void mailimap_condstore_fetch_mod_resp_free(struct mailimap_condstore_fetch_mod_resp * fetch_data);
+
+LIBETPAN_EXPORT
+struct mailimap_condstore_resptextcode * mailimap_condstore_resptextcode_new(int cs_type,
+  uint64_t cs_modseq_value, struct mailimap_set * cs_modified_set);
+
+LIBETPAN_EXPORT
+void mailimap_condstore_resptextcode_free(struct mailimap_condstore_resptextcode * resptextcode);
+
+LIBETPAN_EXPORT
+struct mailimap_condstore_search * mailimap_condstore_search_new(clist * cs_search_result, uint64_t cs_modseq_value);
+
+LIBETPAN_EXPORT
+void mailimap_condstore_search_free(struct mailimap_condstore_search * search_data);
+
+LIBETPAN_EXPORT
+struct mailimap_condstore_status_info * mailimap_condstore_status_info_new(uint64_t cs_highestmodseq_value);
+
+LIBETPAN_EXPORT
+void mailimap_condstore_status_info_free(struct mailimap_condstore_status_info * status_info);
+
+#endif

+ 180 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/config.h

@@ -0,0 +1,180 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Check for Linux's /usr/include/features.h
+ */
+#ifdef _FEATURES_H
+#  error  config.h must be first file included
+#endif
+
+/* Define to detected Berkeley DB major version number */
+/* #undef DBVERS */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define to use curl */
+/* #undef HAVE_CURL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to use expat */
+/* #undef HAVE_EXPAT */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to use getopt_long */
+#define HAVE_GETOPT_LONG 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if you have the iconv() function. */
+/* #undef HAVE_ICONV */
+
+/* prototype of iconv() has const parameters */
+/* #undef HAVE_ICONV_PROTO_CONST */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to enable IPv6 support. */
+#define HAVE_IPV6 1
+
+/* Define to 1 if you have the `lockfile' library (-llockfile). */
+/* #undef HAVE_LIBLOCKFILE */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Defined if we run on a W32 API based system */
+/* #undef HAVE_MINGW32_SYSTEM */
+
+/* Define to 1 if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+/* #undef HAVE_NETDB_H */
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to use setenv */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+/* #undef HAVE_WINSOCK2_H */
+
+/* Enable classes using zlib compression. */
+#define HAVE_ZLIB 1
+
+/* Define to include multithreading support */
+#define LIBETPAN_REENTRANT 1
+
+/* Define this to the version of libEtPan */
+//#define LIBETPAN_VERSION "1.2-dev-20141203"
+
+/* Define this to the major version of libEtPan */
+//#define LIBETPAN_VERSION_MAJOR 1
+
+/* Define this to the minor version of libEtPan */
+//#define LIBETPAN_VERSION_MINOR 2
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libetpan"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "libetpan-devel@lists.sourceforge.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libetpan"
+
+/* Define to the full name and version of this package. */
+//#define PACKAGE_STRING "libetpan 1.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libetpan"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+//#define PACKAGE_VERSION "1.2"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to be lazy on protocol syntax */
+#define UNSTRICT_SYNTAX 1
+
+/* Define to use GnuTLS */
+/* #undef USE_GNUTLS */
+
+/* Define to use SASL */
+#define USE_SASL 1
+
+/* Define to use OpenSSL */
+#define USE_SSL 1
+
+/* Version number of package */
+//#define VERSION "1.2"
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif

+ 60 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/data_message_driver.h

@@ -0,0 +1,60 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: data_message_driver.h,v 1.5 2007/12/10 21:32:58 hoa Exp $
+ */
+
+#ifndef DATA_MESSAGE_DRIVER_H
+
+#define DATA_MESSAGE_DRIVER_H
+
+#include <libetpan/mailmessage.h>
+
+#define LIBETPAN_DATA_MESSAGE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailmessage_driver * data_message_driver;
+
+LIBETPAN_EXPORT
+mailmessage * data_message_init(char * data, size_t len);
+
+LIBETPAN_EXPORT
+void data_message_detach_mime(mailmessage * msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 53 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbdriver.h

@@ -0,0 +1,53 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: dbdriver.h,v 1.2 2004/11/21 21:53:31 hoa Exp $
+ */
+
+#ifndef DBDRIVER_H
+
+#define DBDRIVER_H
+
+#include <libetpan/dbdriver_message.h>
+#include <libetpan/dbdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailsession_driver * db_session_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbdriver_message.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: dbdriver_message.h,v 1.2 2004/11/21 21:53:31 hoa Exp $
+ */
+
+#ifndef DBDRIVER_MESSAGE_H
+
+#define DBDRIVER_MESSAGE_H
+
+#include <libetpan/dbdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailmessage_driver * db_message_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 71 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbdriver_types.h

@@ -0,0 +1,71 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: dbdriver_types.h,v 1.2 2004/11/21 21:53:31 hoa Exp $
+ */
+
+#ifndef DBDRIVER_TYPES_H
+
+#define DBDRIVER_TYPES_H
+
+#include <libetpan/libetpan-config.h>
+
+#include <libetpan/maildriver_types.h>
+#include <libetpan/generic_cache_types.h>
+#include <libetpan/mailstorage_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct db_session_state_data {
+  char db_filename[PATH_MAX];
+  struct mail_flags_store * db_flags_store;
+};
+
+/* db storage */
+
+/*
+  db_mailstorage is the state data specific to the db storage.
+
+  - pathname is the path of the db storage.
+*/
+
+struct db_mailstorage {
+  char * db_pathname;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 62 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/dbstorage.h

@@ -0,0 +1,62 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: dbstorage.h,v 1.3 2005/06/01 12:21:57 smarinier Exp $
+ */
+
+#ifndef DBSTORAGE_H
+
+#define DBSTORAGE_H
+
+#include <libetpan/dbdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+  db_mailstorage_init is the constructor for a DB storage.
+  
+  @param storage this is the storage to initialize.
+  
+  @param pathname is the directory that contains the mailbox.
+*/
+
+LIBETPAN_EXPORT
+int db_mailstorage_init(struct mailstorage * storage,
+    char * db_pathname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 56 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/enable.h

@@ -0,0 +1,56 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2011 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ENABLE_H
+
+#define ENABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimap_extension.h>
+
+LIBETPAN_EXPORT
+extern struct mailimap_extension_api mailimap_extension_enable;
+
+LIBETPAN_EXPORT
+int mailimap_enable(mailimap * session, struct mailimap_capability_data * capabilities,
+    struct mailimap_capability_data ** result);
+
+LIBETPAN_EXPORT
+int mailimap_has_enable(mailimap * session);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feeddriver.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: feeddriver.h,v 1.1 2007/01/18 09:15:01 hoa Exp $
+ */
+
+#ifndef FEEDDRIVER_H
+
+#define FEEDDRIVER_H
+
+#include <libetpan/feeddriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailsession_driver * feed_session_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feeddriver_message.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: feeddriver_message.h,v 1.1 2007/01/18 09:15:01 hoa Exp $
+ */
+
+#ifndef FEEDDRIVER_MESSAGE_H
+
+#define FEEDDRIVER_MESSAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/feeddriver_types.h>
+
+extern mailmessage_driver * feed_message_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 68 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feeddriver_types.h

@@ -0,0 +1,68 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: feeddriver_types.h,v 1.1 2007/01/18 09:15:01 hoa Exp $
+ */
+
+#ifndef FEEDDRIVER_TYPES_H
+
+#define FEEDDRIVER_TYPES_H
+
+#include <libetpan/libetpan-config.h>
+
+#include <libetpan/maildriver_types.h>
+#include <libetpan/mailstorage_types.h>
+#include <libetpan/newsfeed.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct feed_session_state_data {
+  time_t feed_last_update;
+  struct newsfeed * feed_session;
+  int feed_error;
+};
+
+struct feed_mailstorage {
+  char * feed_url;
+
+  int feed_cached;
+  char * feed_cache_directory;
+  char * feed_flags_directory;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 72 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/feedstorage.h

@@ -0,0 +1,72 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: feedstorage.h,v 1.1 2007/01/18 09:15:01 hoa Exp $
+ */
+
+#ifndef FEEDSTORAGE_H
+
+#define FEEDSTORAGE_H
+
+#include <libetpan/feeddriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+  feed_mailstorage_init is the constructor for a FEED storage
+
+  @param storage this is the storage to initialize.
+
+  @param feed_url  this is the URL of the feed.
+  
+  @param cached if this value is != 0, a persistant cache will be
+    stored on local system.
+
+  @param cache_directory is the location of the cache
+
+  @param flags_directory is the location of the flags
+*/
+
+LIBETPAN_EXPORT
+int feed_mailstorage_init(struct mailstorage * storage,
+    const char * feed_url,
+    int feed_cached, const char * feed_cache_directory,
+    const char * feed_flags_directory);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 56 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/generic_cache_types.h

@@ -0,0 +1,56 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: generic_cache_types.h,v 1.6 2004/11/21 21:53:35 hoa Exp $
+ */
+
+#ifndef GENERIC_CACHE_TYPE_H
+
+#define GENERIC_CACHE_TYPE_H
+
+#include <libetpan/carray.h>
+#include <libetpan/chash.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct mail_flags_store {
+  carray * fls_tab;
+  chash * fls_hash;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 57 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/hotmailstorage.h

@@ -0,0 +1,57 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: hotmailstorage.h,v 1.3 2005/06/01 12:21:58 smarinier Exp $
+ */
+
+#ifndef HOTMAILSTORAGE_H
+
+#define HOTMAILSTORAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mailstorage_types.h"
+
+LIBETPAN_EXPORT
+int hotmail_mailstorage_init(struct mailstorage * storage,
+    char * hotmail_login, char * hotmail_password,
+    int hotmail_cached, char * hotmail_cache_directory,
+    char * hotmail_flags_directory);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

+ 64 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/idle.h

@@ -0,0 +1,64 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2014 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef MAILIMAP_IDLE_H
+
+#define MAILIMAP_IDLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mailimap_types.h"
+
+LIBETPAN_EXPORT
+int mailimap_idle(mailimap * session);
+
+LIBETPAN_EXPORT
+int mailimap_idle_done(mailimap * session);
+
+LIBETPAN_EXPORT
+int mailimap_idle_get_fd(mailimap * session);
+
+/* delay in seconds */
+LIBETPAN_EXPORT
+void mailimap_idle_set_delay(mailimap * session, long delay);
+
+LIBETPAN_EXPORT
+long mailimap_idle_get_done_delay(mailimap * session);
+
+LIBETPAN_EXPORT
+int mailimap_has_idle(mailimap * session);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapdriver.h,v 1.12 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef IMAPDRIVER_H
+
+#define IMAPDRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/imapdriver_types.h>
+
+extern mailsession_driver * imap_session_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_cached.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapdriver_cached.h,v 1.11 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef IMAPDRIVER_CACHED_H
+
+#define IMAPDRIVER_CACHED_H
+
+#include <libetpan/imapdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailsession_driver * imap_cached_session_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_cached_message.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapdriver_cached_message.h,v 1.6 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef IMAPDRIVER_CACHED_MESSAGE_H
+
+#define IMAPDRIVER_CACHED_MESSAGE_H
+
+#include <libetpan/imapdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailmessage_driver * imap_cached_message_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_message.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapdriver_message.h,v 1.6 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef IMAPDRIVER_MESSAGE_H
+
+#define IMAPDRIVER_MESSAGE_H
+
+#include <libetpan/imapdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailmessage_driver * imap_message_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 88 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_tools.h

@@ -0,0 +1,88 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapdriver_tools.h,v 1.9 2007/08/08 21:33:30 hoa Exp $
+ */
+
+#ifndef IMAPDRIVER_TOOLS_H
+
+#define IMAPDRIVER_TOOLS_H
+
+#include "mailimap.h"
+#include "mailmime.h"
+#include "imapdriver_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int imap_list_to_list(clist * imap_list, struct mail_list ** result);
+
+int
+imap_section_to_imap_section(struct mailmime_section * section, int type,
+    struct mailimap_section ** result);
+
+int imap_get_msg_att_info(struct mailimap_msg_att * msg_att,
+    uint32_t * puid,
+    struct mailimap_envelope ** pimap_envelope,
+    char ** preferences,
+    size_t * pref_size,
+    struct mailimap_msg_att_dynamic ** patt_dyn,
+    struct mailimap_body ** pimap_body);
+
+int imap_add_envelope_fetch_att(struct mailimap_fetch_type * fetch_type);
+
+int imap_env_to_fields(struct mailimap_envelope * env,
+    char * ref_str, size_t ref_size,
+    struct mailimf_fields ** result);
+
+int
+imap_fetch_result_to_envelop_list(clist * fetch_result,
+    struct mailmessage_list * env_list);
+
+int imap_body_to_body(struct mailimap_body * imap_body,
+    struct mailmime ** result);
+
+int imap_msg_list_to_imap_set(clist * msg_list,
+    struct mailimap_set ** result);
+
+int imap_flags_to_imap_flags(struct mail_flags * flags,
+    struct mailimap_flag_list ** result);
+
+int imap_flags_to_flags(struct mailimap_msg_att_dynamic * att_dyn,
+    struct mail_flags ** result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 62 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_tools_private.h

@@ -0,0 +1,62 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2014 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef IMAPDRIVER_TOOLS_PRIVATE_H
+
+#define IMAPDRIVER_TOOLS_PRIVATE_H
+
+#include "mail_cache_db.h"
+
+int
+imapdriver_get_cached_envelope(struct mail_cache_db * cache_db,
+    MMAPString * mmapstr,
+    mailsession * session, mailmessage * msg,
+    struct mailimf_fields ** result);
+
+int
+imapdriver_write_cached_envelope(struct mail_cache_db * cache_db,
+    MMAPString * mmapstr,
+    mailsession * session, mailmessage * msg,
+    struct mailimf_fields * fields);
+
+int imap_error_to_mail_error(int error);
+
+int imap_store_flags(mailimap * imap, uint32_t first, uint32_t last,
+    struct mail_flags * flags);
+
+int imap_fetch_flags(mailimap * imap,
+    uint32_t indx, struct mail_flags ** result);
+
+int imap_get_messages_list(mailimap * imap,
+    mailsession * session, mailmessage_driver * driver,
+    uint32_t first_index,
+    struct mailmessage_list ** result);
+
+#endif

+ 165 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapdriver_types.h

@@ -0,0 +1,165 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapdriver_types.h,v 1.27 2007/06/30 12:58:21 hoa Exp $
+ */
+
+#ifndef IMAPDRIVER_TYPES_H
+
+#define IMAPDRIVER_TYPES_H
+
+#include <libetpan/libetpan-config.h>
+
+#include <libetpan/mailimap.h>
+#include <libetpan/maildriver_types.h>
+#include <libetpan/generic_cache_types.h>
+#include <libetpan/mailstorage_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* IMAP driver for session */
+
+struct imap_session_state_data {
+  mailimap * imap_session;
+  char * imap_mailbox;
+  struct mail_flags_store * imap_flags_store;
+  void (* imap_ssl_callback)(struct mailstream_ssl_context * ssl_context, void * data);
+  void * imap_ssl_cb_data;
+};
+
+enum {
+  IMAP_SECTION_MESSAGE,
+  IMAP_SECTION_HEADER,
+  IMAP_SECTION_MIME,
+  IMAP_SECTION_BODY
+};
+
+/* cached IMAP driver for session */
+
+enum {
+  IMAPDRIVER_CACHED_SET_SSL_CALLBACK = 1,
+  IMAPDRIVER_CACHED_SET_SSL_CALLBACK_DATA = 2,
+  /* cache */
+  IMAPDRIVER_CACHED_SET_CACHE_DIRECTORY = 1001
+};
+
+struct imap_cached_session_state_data {
+  mailsession * imap_ancestor;
+  char * imap_quoted_mb;
+  char imap_cache_directory[PATH_MAX];
+  carray * imap_uid_list;
+  uint32_t imap_uidvalidity;
+};
+
+
+/* IMAP storage */
+
+/*
+  imap_mailstorage is the state data specific to the IMAP4rev1 storage.
+
+  - servername  this is the name of the IMAP4rev1 server
+  
+  - port is the port to connect to, on the server.
+    you give 0 to use the default port.
+
+  - command, if non-NULL the command used to connect to the
+    server instead of allowing normal TCP connections to be used.
+    
+  - connection_type is the type of socket layer to use.
+    The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
+    CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS or
+    CONNECTION_TYPE_COMMAND.
+
+  - auth_type is the authenticate mechanism to use.
+    The value can be IMAP_AUTH_TYPE_PLAIN.
+    Other values are not yet implemented.
+
+  - login is the login of the IMAP4rev1 account.
+
+  - password is the password of the IMAP4rev1 account.
+
+  - cached if this value is != 0, a persistant cache will be
+    stored on local system.
+
+  - cache_directory is the location of the cache
+*/
+
+struct imap_mailstorage {
+  char * imap_servername;
+  uint16_t imap_port;
+  char * imap_command;
+  int imap_connection_type;
+  
+  int imap_auth_type;
+  char * imap_login; /* deprecated */
+  char * imap_password; /* deprecated */
+  
+  int imap_cached;
+  char * imap_cache_directory;
+  
+  struct {
+    int sasl_enabled;
+    char * sasl_auth_type;
+    char * sasl_server_fqdn;
+    char * sasl_local_ip_port;
+    char * sasl_remote_ip_port;
+    char * sasl_login;
+    char * sasl_auth_name;
+    char * sasl_password;
+    char * sasl_realm;
+  } imap_sasl;
+  
+  char * imap_local_address;
+  uint16_t imap_local_port;
+};
+
+/* this is the type of IMAP4rev1 authentication */
+
+enum {
+  IMAP_AUTH_TYPE_PLAIN,            /* plain text authentication */
+  IMAP_AUTH_TYPE_SASL_ANONYMOUS,   /* SASL anonymous */
+  IMAP_AUTH_TYPE_SASL_CRAM_MD5,    /* SASL CRAM MD5 */
+  IMAP_AUTH_TYPE_SASL_KERBEROS_V4, /* SASL KERBEROS V4 */
+  IMAP_AUTH_TYPE_SASL_PLAIN,       /* SASL plain */
+  IMAP_AUTH_TYPE_SASL_SCRAM_MD5,   /* SASL SCRAM MD5 */
+  IMAP_AUTH_TYPE_SASL_GSSAPI,      /* SASL GSSAPI */
+  IMAP_AUTH_TYPE_SASL_DIGEST_MD5   /* SASL digest MD5 */
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 120 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/imapstorage.h

@@ -0,0 +1,120 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: imapstorage.h,v 1.13 2007/06/30 12:58:21 hoa Exp $
+ */
+
+#ifndef IMAPSTORAGE_H
+
+#define IMAPSTORAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/imapdriver_types.h>
+
+/*
+  imap_mailstorage_init is the constructor for a IMAP4rev1 storage
+
+  @param storage this is the storage to initialize.
+
+  @param servername  this is the name of the IMAP4rev1 server
+  
+  @param port is the port to connect to, on the server.
+    you give 0 to use the default port.
+
+  @param command the command used to connect to the server instead of
+    allowing normal TCP connections to be used.
+
+  @param connection_type is the type of socket layer to use.
+    The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
+    CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS,
+    CONNECTION_TYPE_COMMAND, CONNECTION_TYPE_COMMAND_STARTTLS,
+    CONNECTION_TYPE_COMMAND_TRY_STARTTLS, CONNECTION_TYPE_COMMAND_TLS,.
+    
+  @param auth_type is the authenticate mechanism to use.
+    The value can be IMAP_AUTH_TYPE_PLAIN.
+    Other values are not yet implemented.
+
+  @param login is the login of the IMAP4rev1 account.
+
+  @param password is the password of the IMAP4rev1 account.
+    If performing OAuth2 login, use the OAuth2 token here
+    instead of password.
+
+  @param cached if this value is != 0, a persistant cache will be
+    stored on local system.
+
+  @param cache_directory is the location of the cache
+*/
+
+LIBETPAN_EXPORT
+int imap_mailstorage_init(struct mailstorage * storage,
+    const char * imap_servername, uint16_t imap_port,
+    const char * imap_command,
+    int imap_connection_type, int imap_auth_type,
+    const char * imap_login, const char * imap_password,
+    int imap_cached, const char * imap_cache_directory);
+
+LIBETPAN_EXPORT
+int imap_mailstorage_init_sasl(struct mailstorage * storage,
+    const char * imap_servername, uint16_t imap_port,
+    const char * imap_command,
+    int imap_connection_type,
+    const char * auth_type,
+    const char * server_fqdn,
+    const char * local_ip_port,
+    const char * remote_ip_port,
+    const char * login, const char * auth_name,
+    const char * password, const char * realm,
+    int imap_cached, const char * imap_cache_directory);
+
+LIBETPAN_EXPORT
+int imap_mailstorage_init_sasl_with_local_address(struct mailstorage * storage,
+    const char * imap_servername, uint16_t imap_port,
+    const char * imap_local_address, uint16_t imap_local_port,
+    const char * imap_command,
+    int imap_connection_type,
+    const char * auth_type,
+    const char * server_fqdn,
+    const char * local_ip_port,
+    const char * remote_ip_port,
+    const char * login, const char * auth_name,
+    const char * password, const char * realm,
+    int imap_cached, const char * imap_cache_directory);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 26 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/libetpan-config.h

@@ -0,0 +1,26 @@
+#ifndef LIBETPAN_CONFIG_H
+#define LIBETPAN_CONFIG_H
+#if WIN32
+# define MMAP_UNAVAILABLE
+#endif
+#if defined(_MSC_VER) && !defined(__cplusplus)
+# define inline __inline
+#endif
+#include <limits.h>
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+#include <sys/param.h>
+#include <inttypes.h>
+#define MAIL_DIR_SEPARATOR '/'
+#define MAIL_DIR_SEPARATOR_S "/"
+#ifdef _MSC_VER
+# ifdef LIBETPAN_DLL
+# define LIBETPAN_EXPORT __declspec(dllexport)
+# else
+# define LIBETPAN_EXPORT __declspec(dllimport)
+# endif
+#else
+# define LIBETPAN_EXPORT
+#endif
+#endif

+ 128 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/libetpan.h

@@ -0,0 +1,128 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: libetpan.h,v 1.17 2007/01/18 09:15:02 hoa Exp $
+ */
+
+#ifndef LIBETPAN_H
+
+#define LIBETPAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan_version.h>
+#include <libetpan/maildriver.h>
+#include <libetpan/mailmessage.h>
+#include <libetpan/mailfolder.h>
+#include <libetpan/mailstorage.h>
+#include <libetpan/mailthread.h>
+#include <libetpan/mailsmtp.h>
+#include <libetpan/charconv.h>
+#include <libetpan/mailsem.h>
+#include <libetpan/carray.h>
+#include <libetpan/chash.h>
+#include <libetpan/maillock.h>
+  
+/* mbox driver */
+#include <libetpan/mboxdriver.h>
+#include <libetpan/mboxdriver_message.h>
+#include <libetpan/mboxdriver_cached.h>
+#include <libetpan/mboxdriver_cached_message.h>
+#include <libetpan/mboxstorage.h>
+
+/* MH driver */
+#include <libetpan/mhdriver.h>
+#include <libetpan/mhdriver_message.h>
+#include <libetpan/mhdriver_cached.h>
+#include <libetpan/mhdriver_cached_message.h>
+#include <libetpan/mhstorage.h>
+
+/* IMAP4rev1 driver */
+#include <libetpan/imapdriver.h>
+#include <libetpan/imapdriver_message.h>
+#include <libetpan/imapdriver_cached.h>
+#include <libetpan/imapdriver_cached_message.h>
+#include <libetpan/imapstorage.h>
+
+/* POP3 driver */
+#include <libetpan/pop3driver.h>
+#include <libetpan/pop3driver_message.h>
+#include <libetpan/pop3driver_cached.h>
+#include <libetpan/pop3driver_cached_message.h>
+#include <libetpan/pop3storage.h>
+
+/* Hotmail */
+#include <libetpan/hotmailstorage.h>
+
+/* NNTP driver */
+#include <libetpan/nntpdriver.h>
+#include <libetpan/nntpdriver_message.h>
+#include <libetpan/nntpdriver_cached.h>
+#include <libetpan/nntpdriver_cached_message.h>
+#include <libetpan/nntpstorage.h>
+
+/* maildir driver */
+#include <libetpan/maildirdriver.h>
+#include <libetpan/maildirdriver_message.h>
+#include <libetpan/maildirdriver_cached.h>
+#include <libetpan/maildirdriver_cached_message.h>
+#include <libetpan/maildirstorage.h>
+
+/* db driver */
+#include <libetpan/dbdriver.h>
+#include <libetpan/dbdriver_message.h>
+#include <libetpan/dbstorage.h>
+
+/* feed driver */
+#include <libetpan/feeddriver.h>
+#include <libetpan/feeddriver_message.h>
+#include <libetpan/feedstorage.h>
+
+/* message which content is given by a MIME structure */
+#include <libetpan/mime_message_driver.h>
+
+/* message which content given by a string */
+#include <libetpan/data_message_driver.h>
+
+/* engine */
+#include <libetpan/mailprivacy.h>
+#include <libetpan/mailengine.h>
+#include <libetpan/mailprivacy_gnupg.h>
+#include <libetpan/mailprivacy_smime.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 66 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/libetpan_version.h

@@ -0,0 +1,66 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001 - 2003 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef LIBETPAN_VERSION_H
+
+#define LIBETPAN_VERSION_H
+
+#ifndef LIBETPAN_VERSION_MAJOR
+#define LIBETPAN_VERSION_MAJOR 1
+#endif
+
+#ifndef LIBETPAN_VERSION_MINOR
+#define LIBETPAN_VERSION_MINOR 7
+#endif
+
+#ifndef LIBETPAN_REENTRANT
+#if 1
+#define LIBETPAN_REENTRANT 1
+#endif
+
+#ifndef LIBETPAN_API_CURRENT
+#define LIBETPAN_API_CURRENT 20
+#endif
+
+#ifndef LIBETPAN_API_REVISION
+#define LIBETPAN_API_REVISION 0
+#endif
+
+#ifndef LIBETPAN_API_COMPATIBILITY
+#define LIBETPAN_API_COMPATIBILITY 20
+#endif
+
+#endif
+
+int libetpan_get_version_major(void);
+int libetpan_get_version_minor(void);
+
+#endif

+ 56 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mail.h

@@ -0,0 +1,56 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mail.h,v 1.8 2004/11/21 21:53:31 hoa Exp $
+ */
+
+#ifndef MAIL_H
+
+#define MAIL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 67 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildir.h

@@ -0,0 +1,67 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildir.h,v 1.5 2004/11/21 21:53:38 hoa Exp $
+ */
+
+#ifndef MAILDIR_H
+
+#define MAILDIR_H
+
+#include <libetpan/maildir_types.h>
+
+struct maildir * maildir_new(const char * path);
+
+void maildir_free(struct maildir * md);
+
+int maildir_update(struct maildir * md);
+
+int maildir_message_add_uid(struct maildir * md,
+    const char * message, size_t size,
+    char * uid, size_t max_uid_len);
+
+int maildir_message_add(struct maildir * md,
+    const char * message, size_t size);
+
+int maildir_message_add_file_uid(struct maildir * md, int fd,
+    char * uid, size_t max_uid_len);
+
+int maildir_message_add_file(struct maildir * md, int fd);
+
+char * maildir_message_get(struct maildir * md, const char * uid);
+
+int maildir_message_remove(struct maildir * md, const char * uid);
+
+int maildir_message_change_flags(struct maildir * md,
+    const char * uid, int new_flags);
+
+#endif

+ 93 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildir_types.h

@@ -0,0 +1,93 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildir_types.h,v 1.9 2006/05/22 13:39:42 hoa Exp $
+ */
+
+#ifndef MAILDIR_TYPES_H
+
+#define MAILDIR_TYPES_H
+
+#include <sys/types.h>
+#include <libetpan/libetpan-config.h>
+#include <libetpan/chash.h>
+#include <libetpan/carray.h>
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+
+#include <libetpan/libetpan-config.h>
+
+#define LIBETPAN_MAILDIR
+
+enum {
+  MAILDIR_NO_ERROR = 0,
+  MAILDIR_ERROR_CREATE,
+  MAILDIR_ERROR_DIRECTORY,
+  MAILDIR_ERROR_MEMORY,
+  MAILDIR_ERROR_FILE,
+  MAILDIR_ERROR_NOT_FOUND,
+  MAILDIR_ERROR_FOLDER
+};
+
+#define MAILDIR_FLAG_NEW      (1 << 0)
+#define MAILDIR_FLAG_SEEN     (1 << 1)
+#define MAILDIR_FLAG_REPLIED  (1 << 2)
+#define MAILDIR_FLAG_FLAGGED  (1 << 3)
+#define MAILDIR_FLAG_TRASHED  (1 << 4)
+
+struct maildir_msg {
+  char * msg_uid;
+  char * msg_filename;
+  int msg_flags;
+};
+
+/*
+  work around for missing #define HOST_NAME_MAX in Linux
+*/
+
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
+struct maildir {
+  pid_t mdir_pid;
+  char mdir_hostname[HOST_NAME_MAX];
+  char mdir_path[PATH_MAX];
+  uint32_t mdir_counter;
+  time_t mdir_mtime_new;
+  time_t mdir_mtime_cur;
+  carray * mdir_msg_list;
+  chash * mdir_msg_hash;
+};
+
+#endif

+ 53 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver.h

@@ -0,0 +1,53 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildirdriver.h,v 1.4 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef MAILDIRDRIVER_H
+
+#define MAILDIRDRIVER_H
+
+#include <libetpan/maildriver.h>
+#include <libetpan/maildirdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailsession_driver * maildir_session_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 53 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_cached.h

@@ -0,0 +1,53 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildirdriver_cached.h,v 1.4 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef MAILDIRDRIVER_CACHED_H
+
+#define MAILDIRDRIVER_CACHED_H
+
+#include <libetpan/maildriver.h>
+#include <libetpan/maildirdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailsession_driver * maildir_cached_session_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_cached_message.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildirdriver_cached_message.h,v 1.3 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef MAILDIRDRIVER_CACHED_MESSAGE_H
+
+#define MAILDIRDRIVER_CACHED_MESSAGE_H
+
+#include <libetpan/maildirdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailmessage_driver * maildir_cached_message_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 52 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_message.h

@@ -0,0 +1,52 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildirdriver_message.h,v 1.3 2004/11/21 21:53:32 hoa Exp $
+ */
+
+#ifndef MAILDIRDRIVER_MESSAGE_H
+
+#define MAILDIRDRIVER_MESSAGE_H
+
+#include <libetpan/maildirdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern mailmessage_driver * maildir_message_driver;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 96 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirdriver_types.h

@@ -0,0 +1,96 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildirdriver_types.h,v 1.6 2006/05/22 13:39:40 hoa Exp $
+ */
+
+#ifndef MAILDIRDRIVER_TYPES_H
+
+#define MAILDIRDRIVER_TYPES_H
+
+#include <libetpan/libetpan-config.h>
+
+#include <libetpan/maildriver_types.h>
+#include <libetpan/maildir.h>
+#include <libetpan/generic_cache_types.h>
+#include <libetpan/mailstorage_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct maildir_session_state_data {
+  struct maildir * md_session;
+  struct mail_flags_store * md_flags_store;
+};
+
+enum {
+  MAILDIRDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
+  MAILDIRDRIVER_CACHED_SET_FLAGS_DIRECTORY
+};
+
+struct maildir_cached_session_state_data {
+  mailsession * md_ancestor;
+  char * md_quoted_mb;
+  struct mail_flags_store * md_flags_store;
+  char md_cache_directory[PATH_MAX];
+  char md_flags_directory[PATH_MAX];
+};
+
+/* maildir storage */
+
+/*
+  maildir_mailstorage is the state data specific to the maildir storage.
+
+  - pathname is the path of the maildir storage.
+  
+  - cached if this value is != 0, a persistant cache will be
+      stored on local system.
+  
+  - cache_directory is the location of the cache.
+
+  - flags_directory is the location of the flags.
+*/
+
+struct maildir_mailstorage {
+  char * md_pathname;
+  
+  int md_cached;
+  char * md_cache_directory;
+  char * md_flags_directory;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 70 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildirstorage.h

@@ -0,0 +1,70 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildirstorage.h,v 1.7 2006/06/02 15:44:29 smarinier Exp $
+ */
+
+#ifndef MAILDIRSTORAGE_H
+
+#define MAILDIRSTORAGE_H
+
+#include <libetpan/maildirdriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+  maildir_mailstorage_init is the constructor for a maildir storage.
+
+  @param storage this is the storage to initialize.
+  
+  @param pathname is the directory that contains the mailbox.
+  
+  @param cached if this value is != 0, a persistant cache will be
+    stored on local system.
+
+  @param cache_directory is the location of the cache
+
+  @param flags_directory is the location of the flags
+*/
+
+LIBETPAN_EXPORT
+int maildir_mailstorage_init(struct mailstorage * storage,
+    const char * md_pathname, int md_cached,
+    const char * md_cache_directory, const char * md_flags_directory);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 607 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver.h

@@ -0,0 +1,607 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildriver.h,v 1.34 2006/06/07 15:10:01 smarinier Exp $
+ */
+
+#ifndef MAILDRIVER_H
+
+#define MAILDRIVER_H
+
+#include <libetpan/maildriver_types.h>
+#include <libetpan/maildriver_types_helper.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* mailsession */
+
+/*
+  mailsession_new creates a new session, using the given driver
+
+  @return the created session is returned
+*/
+
+LIBETPAN_EXPORT
+mailsession * mailsession_new(mailsession_driver * sess_driver);
+
+/*
+  mailsession_free release the memory used by the session
+*/
+
+LIBETPAN_EXPORT
+void mailsession_free(mailsession * session);
+
+/*
+  mailsession_parameters is used to make calls specific to the driver
+
+  @param id   is the command to send to the driver,
+           usually, commands can be found in the header of the driver
+
+  @param value is the parameter of the specific call 
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_parameters(mailsession * session,
+			   int id, void * value);
+
+/*
+  There are drivers of two kinds : stream drivers (driver that connects
+  to servers through TCP or other means of connection) and file drivers
+  (driver that are based on filesystem)
+
+  The following function can only be used by stream drivers.
+  mailsession_connect_stream connects a stream to the session
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_connect_stream(mailsession * session, mailstream * s);
+
+/*
+  The following function can only be used by file drivers.
+  mailsession_connect_path selects the main path of the session
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_connect_path(mailsession * session, const char * path);
+
+/*
+  NOTE: works only on stream drivers
+
+  mailsession_starttls switches the current connection to TLS (secure layer)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_starttls(mailsession * session);
+
+/*
+  mailsession_login notifies the login and the password to authenticate
+  to the session
+
+  @param userid    the given string is only needed at this function call
+    (it will be duplicated if necessary)
+  @param password  the given string is only needed at this function call
+    (it will be duplicated if necessary)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_login(mailsession * session,
+		      const char * userid, const char * password);
+
+/*
+  NOTE: this function doesn't often work on filsystem drivers
+
+  mailsession_logout deconnects the session and closes the stream.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_logout(mailsession * session);
+
+/*
+  mailsession_noop does no operation on the session, but it can be
+  used to poll for the status of the connection.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_noop(mailsession * session);
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_build_folder_name will return an allocated string with
+  that contains the complete path of the folder to create
+
+  @param session the sesion
+  @param mb is the parent mailbox
+  @param name is the name of the folder to create
+  @param result the complete path of the folder to create will be
+    stored in (* result), this name have to be freed with free()
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_build_folder_name(mailsession * session, const char * mb,
+				  const char * name, char ** result);
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_create_folder creates the folder that corresponds to the
+  given name
+
+  @param session the session
+  @param mb is the name of the mailbox
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_create_folder(mailsession * session, const char * mb);
+
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_delete_folder deletes the folder that corresponds to the
+  given name
+
+  @param session the session
+  @param mb is the name of the mailbox
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_delete_folder(mailsession * session, const char * mb);
+
+
+/*
+  mailsession_rename_folder changes the name of the folder
+
+  @param session the session
+  @param mb is the name of the mailbox whose name has to be changed
+  @param new_name is the destination name (the parent
+    of the new folder folder can be other)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_rename_folder(mailsession * session,
+			      const char * mb, const char * new_name);
+
+/*
+  mailsession_check_folder makes a checkpoint of the session
+  
+  @param session the session
+  
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_check_folder(mailsession * session);
+
+
+/*
+  NOTE: this function is not implemented in most drivers
+
+  mailsession_examine_folder selects a mailbox as readonly
+  
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_examine_folder(mailsession * session, const char * mb);
+
+
+/*
+  mailsession_select_folder selects a mailbox
+  
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_select_folder(mailsession * session, const char * mb);
+
+
+/*
+  mailsession_expunge_folder deletes all messages marked \Deleted
+  
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_expunge_folder(mailsession * session);
+
+
+/*
+  mailsession_status_folder queries the status of the folder
+  (number of messages, number of recent messages, number of unseen messages)
+  
+  @param session the session
+  @param mb mailbox to query
+  @param result_messages the number of messages is stored
+    in (* result_messages)
+  @param result_recent the number of messages is stored
+    in (* result_recent)
+  @param result_unseen the number of messages is stored
+    in (* result_unseen)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_status_folder(mailsession * session, const char * mb,
+    uint32_t * result_messages, uint32_t * result_recent,
+    uint32_t * result_unseen);
+
+
+/*
+  mailsession_messages_number queries the number of messages in the folder
+
+  @param session the session
+  @param mb mailbox to query
+  @param result the number of messages is stored in (* result)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_messages_number(mailsession * session, const char * mb,
+				uint32_t * result);
+
+/*
+  mailsession_recent_number queries the number of recent messages in the folder
+
+  @param session the session
+  @param mb mailbox to query
+  @param result the number of recent messages is stored in (* result)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_recent_number(mailsession * session,
+			      const char * mb, uint32_t * result);
+
+/*
+  mailsession_unseen_number queries the number of unseen messages in the folder
+
+  @param session the session
+  @param mb mailbox to query
+  @param result the number of unseen messages is stored in (* result)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_unseen_number(mailsession * session, const char * mb,
+			      uint32_t * result);
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_list_folders returns the list of all sub-mailboxes
+  of the given mailbox
+
+  @param session the session
+  @param mb the mailbox
+  @param result list of mailboxes if stored in (* result),
+    this structure have to be freed with mail_list_free()
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_list_folders(mailsession * session, const char * mb,
+			     struct mail_list ** result);
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_lsub_folders returns the list of subscribed
+  sub-mailboxes of the given mailbox
+
+  @param session the session
+  @param mb the mailbox
+  @param result list of mailboxes if stored in (* result),
+    this structure have to be freed with mail_list_free()
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_lsub_folders(mailsession * session, const char * mb,
+			     struct mail_list ** result);
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_subscribe_folder subscribes to the given mailbox
+
+  @param session the session
+  @param mb the mailbox
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_subscribe_folder(mailsession * session, const char * mb);
+
+/*
+  NOTE: driver's specific should be used
+
+  mailsession_unsubscribe_folder unsubscribes to the given mailbox
+
+  @param session the session
+  @param mb the mailbox
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_unsubscribe_folder(mailsession * session, const char * mb);
+
+/*
+  mailsession_append_message adds a RFC 2822 message to the current
+  given mailbox
+
+  @param session the session
+  @param message is a string that contains the RFC 2822 message
+  @param size this is the size of the message
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_append_message(mailsession * session,
+			       const char * message, size_t size);
+
+LIBETPAN_EXPORT
+int mailsession_append_message_flags(mailsession * session,
+    const char * message, size_t size, struct mail_flags * flags);
+
+/*
+  NOTE: some drivers does not implement this
+
+  mailsession_copy_message copies a message whose number is given to
+  a given mailbox. The mailbox must be accessible from the same session.
+
+  @param session the session
+  @param num the message number
+  @param mb the destination mailbox
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_copy_message(mailsession * session,
+			     uint32_t num, const char * mb);
+
+/*
+  NOTE: some drivers does not implement this
+
+  mailsession_move_message copies a message whose number is given to
+  a given mailbox. The mailbox must be accessible from the same session.
+
+  @param session the session
+  @param num the message number
+  @param mb the destination mailbox
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_move_message(mailsession * session,
+			     uint32_t num, const char * mb);
+
+/*
+  mailsession_get_messages_list returns the list of message numbers
+  of the current mailbox.
+
+  @param session the session
+  @param result the list of message numbers will be stored in (* result),
+    this structure have to be freed with mailmessage_list_free()
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_get_messages_list(mailsession * session,
+				  struct mailmessage_list ** result);
+
+/*
+  mailsession_get_envelopes_list fills the parsed fields in the
+  mailmessage structures of the mailmessage_list.
+
+  @param session the session
+  @param result this is the list of mailmessage structures
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_get_envelopes_list(mailsession * session,
+				   struct mailmessage_list * result);
+
+/*
+  NOTE: some drivers does not implement this
+
+  mailsession_remove_message removes the given message from the mailbox.
+  The message is permanently deleted.
+
+  @param session the session
+  @param num is the message number
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_remove_message(mailsession * session, uint32_t num);
+
+
+/*
+  NOTE: this function is not implemented in most drivers
+
+  mailsession_search_message returns a list of message numbers that
+  corresponds to the given criteria.
+
+  @param session the session
+  @param charset is the charset to use (it can be NULL)
+  @param key is the list of criteria
+  @param result the search result is stored in (* result),
+    this structure have to be freed with mail_search_result_free()
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+#if 0
+LIBETPAN_EXPORT
+int mailsession_search_messages(mailsession * session, const char * charset,
+				struct mail_search_key * key,
+				struct mail_search_result ** result);
+#endif
+
+/*
+  mailsession_get_message returns a mailmessage structure that corresponds
+  to the given message number.
+  * WARNING * mailsession_get_message_by_uid() should be used instead.
+
+  @param session the session
+  @param num the message number
+  @param result the allocated mailmessage structure will be stored
+    in (* result), this structure have to be freed with mailmessage_free() 
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_get_message(mailsession * session,
+			    uint32_t num, mailmessage ** result);
+
+/*
+  mailsession_get_message_by_uid returns a mailmessage structure
+  that corresponds to the given message unique identifier.
+  This is currently implemented only for cached drivers.
+  * WARNING * That will deprecates the use of mailsession_get_message()
+  
+  @param session the session
+  @param uid the message unique identifier
+  @param result the allocated mailmessage structure will be stored
+    in (* result), this structure have to be freed with mailmessage_free() 
+  
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_get_message_by_uid(mailsession * session,
+    const char * uid, mailmessage ** result);
+
+
+/*
+  mailsession_login notifies the SASL authentication information
+  to the session
+
+  @param auth_type      type of SASL authentication
+  @param server_fqdn    server full qualified domain name
+  @param local_ip_port  local IP:port (client)
+  @param remote_ip_port remote IP:port (server)
+  @param login          login
+  @param auth_name      authentication name
+  @param password       password (or token for OAuth2 login)
+  @param realm          realm
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+LIBETPAN_EXPORT
+int mailsession_login_sasl(mailsession * session, const char * auth_type,
+    const char * server_fqdn,
+    const char * local_ip_port,
+    const char * remote_ip_port,
+    const char * login, const char * auth_name,
+    const char * password, const char * realm);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 103 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver_errors.h

@@ -0,0 +1,103 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildriver_errors.h,v 1.9 2006/12/13 18:31:32 hoa Exp $
+ */
+
+#ifndef MAILDRIVER_ERRORS_H
+
+#define MAILDRIVER_ERRORS_H
+
+enum {
+  MAIL_NO_ERROR = 0,
+  MAIL_NO_ERROR_AUTHENTICATED,
+  MAIL_NO_ERROR_NON_AUTHENTICATED,
+  MAIL_ERROR_NOT_IMPLEMENTED,
+  MAIL_ERROR_UNKNOWN,
+  MAIL_ERROR_CONNECT,
+  MAIL_ERROR_BAD_STATE,
+  MAIL_ERROR_FILE,
+  MAIL_ERROR_STREAM,
+  MAIL_ERROR_LOGIN,
+  MAIL_ERROR_CREATE, /* 10 */
+  MAIL_ERROR_DELETE,
+  MAIL_ERROR_LOGOUT,
+  MAIL_ERROR_NOOP,
+  MAIL_ERROR_RENAME,
+  MAIL_ERROR_CHECK,
+  MAIL_ERROR_EXAMINE,
+  MAIL_ERROR_SELECT,
+  MAIL_ERROR_MEMORY,
+  MAIL_ERROR_STATUS,
+  MAIL_ERROR_SUBSCRIBE, /* 20 */
+  MAIL_ERROR_UNSUBSCRIBE,
+  MAIL_ERROR_LIST,
+  MAIL_ERROR_LSUB,
+  MAIL_ERROR_APPEND,
+  MAIL_ERROR_COPY,
+  MAIL_ERROR_FETCH,
+  MAIL_ERROR_STORE,
+  MAIL_ERROR_SEARCH,
+  MAIL_ERROR_DISKSPACE,
+  MAIL_ERROR_MSG_NOT_FOUND,  /* 30 */
+  MAIL_ERROR_PARSE,
+  MAIL_ERROR_INVAL,
+  MAIL_ERROR_PART_NOT_FOUND,
+  MAIL_ERROR_REMOVE,
+  MAIL_ERROR_FOLDER_NOT_FOUND,
+  MAIL_ERROR_MOVE,
+  MAIL_ERROR_STARTTLS,
+  MAIL_ERROR_CACHE_MISS,
+  MAIL_ERROR_NO_TLS,
+  MAIL_ERROR_EXPUNGE, /* 40 */
+  /* misc errors */
+  MAIL_ERROR_MISC,
+  MAIL_ERROR_PROTOCOL,
+  MAIL_ERROR_CAPABILITY,
+  MAIL_ERROR_CLOSE,
+  MAIL_ERROR_FATAL,
+  MAIL_ERROR_READONLY,
+  MAIL_ERROR_NO_APOP,
+  MAIL_ERROR_COMMAND_NOT_SUPPORTED,
+  MAIL_ERROR_NO_PERMISSION,
+  MAIL_ERROR_PROGRAM_ERROR, /* 50 */
+  MAIL_ERROR_SUBJECT_NOT_FOUND,
+  MAIL_ERROR_CHAR_ENCODING_FAILED,
+  MAIL_ERROR_SEND,
+  MAIL_ERROR_COMMAND,
+  MAIL_ERROR_SYSTEM,
+  MAIL_ERROR_UNABLE,
+  MAIL_ERROR_FOLDER,
+  MAIL_ERROR_SSL
+};
+
+#endif

+ 822 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver_types.h

@@ -0,0 +1,822 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildriver_types.h,v 1.49 2008/04/19 09:25:40 hoa Exp $
+ */
+
+#ifndef MAILDRIVER_TYPES_H
+
+#define MAILDRIVER_TYPES_H
+
+#ifndef _MSC_VER
+#	ifdef HAVE_INTTYPES_H
+#		include <inttypes.h>
+#	endif
+#	include <sys/types.h>
+#endif
+
+#include <libetpan/mailstream.h>
+#include <libetpan/mailimf.h>
+#include <libetpan/mailmime.h>
+#include <libetpan/carray.h>
+
+#include <libetpan/mailthread_types.h>
+#include <libetpan/maildriver_errors.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct mailsession_driver mailsession_driver;
+
+typedef struct mailsession mailsession;
+
+typedef struct mailmessage_driver mailmessage_driver;
+
+typedef struct mailmessage mailmessage;
+
+
+/*
+  mailmessage_list is a list of mailmessage
+  
+  - tab is an array of mailmessage structures
+*/
+
+struct mailmessage_list {
+  carray * msg_tab; /* elements are (mailmessage *) */
+};
+
+LIBETPAN_EXPORT
+struct mailmessage_list * mailmessage_list_new(carray * msg_tab);
+
+LIBETPAN_EXPORT
+void mailmessage_list_free(struct mailmessage_list * env_list);
+
+/*
+  mail_list is a list of mailbox names
+
+  - list is a list of mailbox names
+*/
+
+struct mail_list {
+  clist * mb_list; /* elements are (char *) */
+};
+
+LIBETPAN_EXPORT
+struct mail_list * mail_list_new(clist * mb_list);
+
+LIBETPAN_EXPORT
+void mail_list_free(struct mail_list * resp);
+
+/*
+  This is a flag value.
+  Flags can be combined with OR operation
+*/
+
+enum {
+  MAIL_FLAG_NEW       = 1 << 0,
+  MAIL_FLAG_SEEN      = 1 << 1,
+  MAIL_FLAG_FLAGGED   = 1 << 2,
+  MAIL_FLAG_DELETED   = 1 << 3,
+  MAIL_FLAG_ANSWERED  = 1 << 4,
+  MAIL_FLAG_FORWARDED = 1 << 5,
+  MAIL_FLAG_CANCELLED = 1 << 6
+};
+
+/*
+  mail_flags is the value of a flag related to a message.
+  
+  - flags is the standard flags value
+
+  - extension is a list of unknown flags for libEtPan!
+*/
+
+struct mail_flags {
+  uint32_t fl_flags;
+  clist * fl_extension; /* elements are (char *) */
+};
+
+LIBETPAN_EXPORT
+struct mail_flags * mail_flags_new(uint32_t fl_flags, clist * fl_ext);
+
+LIBETPAN_EXPORT
+void mail_flags_free(struct mail_flags * flags);
+
+/*
+  This function creates a flag for a new message
+*/
+
+LIBETPAN_EXPORT
+struct mail_flags * mail_flags_new_empty(void);
+
+
+/*
+  mailimf_date_time_comp compares two dates
+  
+  
+*/
+
+LIBETPAN_EXPORT
+int32_t mailimf_date_time_comp(struct mailimf_date_time * date1,
+    struct mailimf_date_time * date2);
+
+/*
+  this is type type of the search criteria
+*/
+
+enum {
+  MAIL_SEARCH_KEY_ALL,        /* all messages correspond */
+  MAIL_SEARCH_KEY_ANSWERED,   /* messages with flag \Answered */
+  MAIL_SEARCH_KEY_BCC,        /* messages which Bcc field contains
+                                 a given string */
+  MAIL_SEARCH_KEY_BEFORE,     /* messages which internal date is earlier
+                                 than the specified date */
+  MAIL_SEARCH_KEY_BODY,       /* message that contains the given string
+                                 (in header and text parts) */
+  MAIL_SEARCH_KEY_CC,         /* messages whose Cc field contains the
+                                 given string */
+  MAIL_SEARCH_KEY_DELETED,    /* messages with the flag \Deleted */
+  MAIL_SEARCH_KEY_FLAGGED,    /* messages with the flag \Flagged */ 
+  MAIL_SEARCH_KEY_FROM,       /* messages whose From field contains the
+                                 given string */
+  MAIL_SEARCH_KEY_NEW,        /* messages with the flag \Recent and not
+                                 the \Seen flag */
+  MAIL_SEARCH_KEY_OLD,        /* messages that do not have the
+                                 \Recent flag set */
+  MAIL_SEARCH_KEY_ON,         /* messages whose internal date is the
+                                 specified date */
+  MAIL_SEARCH_KEY_RECENT,     /* messages with the flag \Recent */
+  MAIL_SEARCH_KEY_SEEN,       /* messages with the flag \Seen */
+  MAIL_SEARCH_KEY_SINCE,      /* messages whose internal date is later
+                                 than specified date */
+  MAIL_SEARCH_KEY_SUBJECT,    /* messages whose Subject field contains the
+                                 given string */
+  MAIL_SEARCH_KEY_TEXT,       /* messages whose text part contains the
+                                 given string */
+  MAIL_SEARCH_KEY_TO,         /* messages whose To field contains the
+                                 given string */
+  MAIL_SEARCH_KEY_UNANSWERED, /* messages with no flag \Answered */
+  MAIL_SEARCH_KEY_UNDELETED,  /* messages with no flag \Deleted */
+  MAIL_SEARCH_KEY_UNFLAGGED,  /* messages with no flag \Flagged */
+  MAIL_SEARCH_KEY_UNSEEN,     /* messages with no flag \Seen */
+  MAIL_SEARCH_KEY_HEADER,     /* messages whose given field 
+                                 contains the given string */
+  MAIL_SEARCH_KEY_LARGER,     /* messages whose size is larger then
+                                 the given size */
+  MAIL_SEARCH_KEY_NOT,        /* not operation of the condition */
+  MAIL_SEARCH_KEY_OR,         /* or operation between two conditions */
+  MAIL_SEARCH_KEY_SMALLER,    /* messages whose size is smaller than
+                                 the given size */
+  MAIL_SEARCH_KEY_MULTIPLE    /* the boolean operator between the
+                                 conditions is AND */
+};
+
+/*
+  mail_search_key is the condition on the messages to return
+  
+  - type is the type of the condition
+
+  - bcc is the text to search in the Bcc field when type is
+    MAIL_SEARCH_KEY_BCC, should be allocated with malloc()
+
+  - before is a date when type is MAIL_SEARCH_KEY_BEFORE
+
+  - body is the text to search in the message when type is
+    MAIL_SEARCH_KEY_BODY, should be allocated with malloc()
+
+  - cc is the text to search in the Cc field when type is
+    MAIL_SEARCH_KEY_CC, should be allocated with malloc()
+  
+  - from is the text to search in the From field when type is
+    MAIL_SEARCH_KEY_FROM, should be allocated with malloc()
+
+  - on is a date when type is MAIL_SEARCH_KEY_ON
+
+  - since is a date when type is MAIL_SEARCH_KEY_SINCE
+  
+  - subject is the text to search in the Subject field when type is
+    MAILIMAP_SEARCH_KEY_SUBJECT, should be allocated with malloc()
+
+  - text is the text to search in the text part of the message when
+    type is MAILIMAP_SEARCH_KEY_TEXT, should be allocated with malloc()
+
+  - to is the text to search in the To field when type is
+    MAILIMAP_SEARCH_KEY_TO, should be allocated with malloc()
+
+  - header_name is the header name when type is MAILIMAP_SEARCH_KEY_HEADER,
+    should be allocated with malloc()
+
+  - header_value is the text to search in the given header when type is
+    MAILIMAP_SEARCH_KEY_HEADER, should be allocated with malloc()
+
+  - larger is a size when type is MAILIMAP_SEARCH_KEY_LARGER
+
+  - not is a condition when type is MAILIMAP_SEARCH_KEY_NOT
+
+  - or1 is a condition when type is MAILIMAP_SEARCH_KEY_OR
+
+  - or2 is a condition when type is MAILIMAP_SEARCH_KEY_OR
+  
+  - sentbefore is a date when type is MAILIMAP_SEARCH_KEY_SENTBEFORE
+
+  - senton is a date when type is MAILIMAP_SEARCH_KEY_SENTON
+
+  - sentsince is a date when type is MAILIMAP_SEARCH_KEY_SENTSINCE
+
+  - smaller is a size when type is MAILIMAP_SEARCH_KEY_SMALLER
+
+  - multiple is a set of message when type is MAILIMAP_SEARCH_KEY_MULTIPLE
+*/
+
+#if 0
+struct mail_search_key {
+  int sk_type;
+  union {
+    char * sk_bcc;
+    struct mailimf_date_time * sk_before;
+    char * sk_body;
+    char * sk_cc;
+    char * sk_from;
+    struct mailimf_date_time * sk_on;
+    struct mailimf_date_time * sk_since;
+    char * sk_subject;
+    char * sk_text;
+    char * sk_to;
+    char * sk_header_name;
+    char * sk_header_value;
+    size_t sk_larger;
+    struct mail_search_key * sk_not;
+    struct mail_search_key * sk_or1;
+    struct mail_search_key * sk_or2;
+    size_t sk_smaller;
+    clist * sk_multiple; /* list of (struct mailimap_search_key *) */
+  } sk_data;
+};
+
+
+struct mail_search_key *
+mail_search_key_new(int sk_type,
+    char * sk_bcc, struct mailimf_date_time * sk_before,
+    char * sk_body, char * sk_cc, char * sk_from,
+    struct mailimf_date_time * sk_on, struct mailimf_date_time * sk_since,
+    char * sk_subject, char * sk_text, char * sk_to,
+    char * sk_header_name, char * sk_header_value, size_t sk_larger,
+    struct mail_search_key * sk_not, struct mail_search_key * sk_or1,
+    struct mail_search_key * sk_or2, size_t sk_smaller,
+    clist * sk_multiple);
+
+void mail_search_key_free(struct mail_search_key * key);
+#endif
+
+/*
+  mail_search_result is a list of message numbers that is returned
+  by the mailsession_search_messages function()
+*/
+
+#if 0
+struct mail_search_result {
+  clist * sr_list; /* list of (uint32_t *) */
+};
+
+struct mail_search_result * mail_search_result_new(clist * sr_list);
+
+void mail_search_result_free(struct mail_search_result * search_result);
+#endif
+
+
+/*
+  There is three kinds of identities :
+  - storage
+  - folders
+  - session
+
+  A storage (struct mailstorage) represents whether a server or
+  a main path,
+
+  A storage can be an IMAP server, the root path of a MH or a mbox file.
+
+  Folders (struct mailfolder) are the mailboxes we can
+  choose in the server or as sub-folder of the main path.
+
+  Folders for IMAP are the IMAP mailboxes, for MH this is one of the
+  folder of the MH storage, for mbox, there is only one folder, the
+  mbox file content;
+
+  A mail session (struct mailsession) is whether a connection to a server
+  or a path that is open. It is the abstraction lower folders and storage.
+  It allow us to send commands.
+
+  We have a session driver for mail session for each kind of storage.
+
+  From a session, we can get a message (struct mailmessage) to read.
+  We have a message driver for each kind of storage.
+*/
+
+/*
+  maildriver is the driver structure for mail sessions
+
+  - name is the name of the driver
+  
+  - initialize() is the function that will initializes a data structure
+      specific to the driver, it returns a value that will be stored
+      in the field data of the session.
+      The field data of the session is the state of the session,
+      the internal data structure used by the driver.
+      It is called when creating the mailsession structure with
+      mailsession_new().
+  
+  - uninitialize() frees the structure created with initialize()
+
+  - parameters() implements functions specific to the given mail access
+  
+  - connect_stream() connects a stream to the session
+
+  - connect_path() notify a main path to the session
+
+  - starttls() changes the current stream to a TLS stream
+  
+  - login() notifies the user and the password to authenticate to the
+      session
+
+  - logout() exits the session and closes the stream
+
+  - noop() does no operation on the session, but it can be
+      used to poll for the status of the connection.
+
+  - build_folder_name() will return an allocated string with
+      that contains the complete path of the folder to create
+
+  - create_folder() creates the folder that corresponds to the
+      given name
+
+  - delete_folder() deletes the folder that corresponds to the
+      given name
+
+  - rename_folder() change the name of the folder
+
+  - check_folder() makes a checkpoint of the session
+
+  - examine_folder() selects a mailbox as readonly
+
+  - select_folder() selects a mailbox
+
+  - expunge_folder() deletes all messages marked \Deleted
+
+  - status_folder() queries the status of the folder
+      (number of messages, number of recent messages, number of
+      unseen messages)
+
+  - messages_number() queries the number of messages in the folder
+
+  - recent_number() queries the number of recent messages in the folder
+
+  - unseen_number() queries the number of unseen messages in the folder
+
+  - list_folders() returns the list of all sub-mailboxes
+      of the given mailbox
+
+  - lsub_folders() returns the list of subscribed
+      sub-mailboxes of the given mailbox
+
+  - subscribe_folder() subscribes to the given mailbox
+
+  - unsubscribe_folder() unsubscribes to the given mailbox
+
+  - append_message() adds a RFC 2822 message to the current
+      given mailbox
+
+  - copy_message() copies a message whose number is given to
+       a given mailbox. The mailbox must be accessible from
+       the same session.
+
+  - move_message() copies a message whose number is given to
+       a given mailbox. The mailbox must be accessible from the
+       same session.
+
+  - get_messages_list() returns the list of message numbers
+      of the current mailbox.
+
+  - get_envelopes_list() fills the parsed fields in the
+      mailmessage structures of the mailmessage_list.
+
+  - remove_message() removes the given message from the mailbox.
+      The message is permanently deleted.
+
+  - search_message() returns a list of message numbers that
+      corresponds to the given criteria.
+
+  - get_message returns a mailmessage structure that corresponds
+      to the given message number.
+
+  - get_message_by_uid returns a mailmessage structure that corresponds
+      to the given message unique identifier.
+
+  * mandatory functions are the following :
+
+  - connect_stream() of connect_path()
+  - logout()
+  - get_messages_list()
+  - get_envelopes_list()
+
+  * we advise you to implement these functions :
+
+  - select_folder() (in case a session can access several folders)
+  - noop() (to check if the server is responding)
+  - check_folder() (to make a checkpoint of the session)
+  - status_folder(), messages_number(), recent_number(), unseen_number()
+      (to get stat of the folder)
+  - append_message() (but can't be done in the case of POP3 at least)
+  - login() in a case of an authenticated driver.
+  - starttls() in a case of a stream driver, if the procotol supports
+      STARTTLS.
+  - get_message_by_uid() so that the application can remember the message
+      by UID and build its own list of messages.
+  - login_sasl() notifies the SASL information to authenticate to the
+      session.
+
+  * drivers' specific :
+
+  Everything that is specific to the driver will be implemented in this
+  function :
+
+  - parameters()
+*/
+
+struct mailsession_driver {
+  char * sess_name;
+
+  int (* sess_initialize)(mailsession * session);
+  void (* sess_uninitialize)(mailsession * session);
+
+  int (* sess_parameters)(mailsession * session,
+      int id, void * value);
+
+  int (* sess_connect_stream)(mailsession * session, mailstream * s);
+  int (* sess_connect_path)(mailsession * session, const char * path);
+
+  int (* sess_starttls)(mailsession * session);
+
+  int (* sess_login)(mailsession * session, const char * userid, const char * password);
+  int (* sess_logout)(mailsession * session);
+  int (* sess_noop)(mailsession * session);
+
+  /* folders operations */
+
+  int (* sess_build_folder_name)(mailsession * session, const char * mb,
+      const char * name, char ** result);
+
+  int (* sess_create_folder)(mailsession * session, const char * mb);
+  int (* sess_delete_folder)(mailsession * session, const char * mb);
+  int (* sess_rename_folder)(mailsession * session, const char * mb,
+      const char * new_name);
+  int (* sess_check_folder)(mailsession * session);
+  int (* sess_examine_folder)(mailsession * session, const char * mb);
+  int (* sess_select_folder)(mailsession * session, const char * mb);
+  int (* sess_expunge_folder)(mailsession * session);
+  int (* sess_status_folder)(mailsession * session, const char * mb,
+      uint32_t * result_num, uint32_t * result_recent,
+      uint32_t * result_unseen);
+  int (* sess_messages_number)(mailsession * session, const char * mb,
+      uint32_t * result);
+  int (* sess_recent_number)(mailsession * session, const char * mb,
+      uint32_t * result);
+  int (* sess_unseen_number)(mailsession * session, const char * mb,
+      uint32_t * result);
+
+  int (* sess_list_folders)(mailsession * session, const char * mb,
+      struct mail_list ** result);
+  int (* sess_lsub_folders)(mailsession * session, const char * mb,
+      struct mail_list ** result);
+
+  int (* sess_subscribe_folder)(mailsession * session, const char * mb);
+  int (* sess_unsubscribe_folder)(mailsession * session, const char * mb);
+
+  /* messages operations */
+
+  int (* sess_append_message)(mailsession * session,
+      const char * message, size_t size);
+  int (* sess_append_message_flags)(mailsession * session,
+      const char * message, size_t size, struct mail_flags * flags);
+  int (* sess_copy_message)(mailsession * session,
+      uint32_t num, const char * mb);
+  int (* sess_move_message)(mailsession * session,
+      uint32_t num, const char * mb);
+
+  int (* sess_get_message)(mailsession * session,
+      uint32_t num, mailmessage ** result);
+
+  int (* sess_get_message_by_uid)(mailsession * session,
+      const char * uid, mailmessage ** result);
+  
+  int (* sess_get_messages_list)(mailsession * session,
+      struct mailmessage_list ** result);
+  int (* sess_get_envelopes_list)(mailsession * session,
+      struct mailmessage_list * env_list);
+  int (* sess_remove_message)(mailsession * session, uint32_t num);
+  
+  int (* sess_login_sasl)(mailsession * session, const char * auth_type,
+      const char * server_fqdn,
+      const char * local_ip_port,
+      const char * remote_ip_port,
+      const char * login, const char * auth_name,
+      const char * password, const char * realm);
+};
+
+
+/*
+  session is the data structure for a mail session.
+
+  - data is the internal data structure used by the driver
+    It is called when initializing the mailsession structure.
+
+  - driver is the driver used for the session
+*/
+
+struct mailsession {
+  void * sess_data;
+  mailsession_driver * sess_driver;
+};
+
+
+
+
+/*
+  mailmessage_driver is the driver structure to get information from messages.
+  
+  - name is the name of the driver
+
+  - initialize() is the function that will initializes a data structure
+      specific to the driver, it returns a value that will be stored
+      in the field data of the mailsession.
+      The field data of the session is the state of the session,
+      the internal data structure used by the driver.
+      It is called when initializing the mailmessage structure with
+      mailmessage_init().
+  
+  - uninitialize() frees the structure created with initialize().
+      It will be called by mailmessage_free().
+
+  - flush() will free from memory all temporary structures of the message
+      (for example, the MIME structure of the message).
+
+  - fetch_result_free() will free all strings resulted by fetch() or
+      any fetch_xxx() functions that returns a string.
+
+  - fetch() returns the content of the message (headers and text).
+
+  - fetch_header() returns the content of the headers.
+
+  - fetch_body() returns the message text (message content without headers)
+
+  - fetch_size() returns the size of the message content.
+
+  - get_bodystructure() returns the MIME structure of the message.
+
+  - fetch_section() returns the content of a given MIME part
+
+  - fetch_section_header() returns the header of the message
+      contained by the given MIME part.
+
+  - fetch_section_mime() returns the MIME headers of the
+      given MIME part.
+
+  - fetch_section_body() returns the text (if this is a message, this is the
+      message content without headers) of the given MIME part.
+
+  - fetch_envelope() returns a mailimf_fields structure, with a list of
+      fields chosen by the driver.
+
+  - get_flags() returns a the flags related to the message.
+      When you want to get flags of a message, you have to make sure to
+      call get_flags() at least once before using directly message->flags.
+*/
+
+#define LIBETPAN_MAIL_MESSAGE_CHECK
+
+struct mailmessage_driver {
+  char * msg_name;
+
+  int (* msg_initialize)(mailmessage * msg_info);
+ 
+  void (* msg_uninitialize)(mailmessage * msg_info);
+  
+  void (* msg_flush)(mailmessage * msg_info);
+
+  void (* msg_check)(mailmessage * msg_info);
+
+  void (* msg_fetch_result_free)(mailmessage * msg_info,
+			     char * msg);
+
+  int (* msg_fetch)(mailmessage * msg_info,
+		char ** result,
+		size_t * result_len);
+       
+  int (* msg_fetch_header)(mailmessage * msg_info,
+		       char ** result,
+		       size_t * result_len);
+  
+  int (* msg_fetch_body)(mailmessage * msg_info,
+		     char ** result, size_t * result_len);
+
+  int (* msg_fetch_size)(mailmessage * msg_info,
+		     size_t * result);
+  
+  int (* msg_get_bodystructure)(mailmessage * msg_info,
+			    struct mailmime ** result);
+  
+  int (* msg_fetch_section)(mailmessage * msg_info,
+			struct mailmime * mime,
+			char ** result, size_t * result_len);
+  
+  int (* msg_fetch_section_header)(mailmessage * msg_info,
+			       struct mailmime * mime,
+			       char ** result,
+			       size_t * result_len);
+  
+  int (* msg_fetch_section_mime)(mailmessage * msg_info,
+			     struct mailmime * mime,
+			     char ** result,
+			     size_t * result_len);
+  
+  int (* msg_fetch_section_body)(mailmessage * msg_info,
+			     struct mailmime * mime,
+			     char ** result,
+			     size_t * result_len);
+
+  int (* msg_fetch_envelope)(mailmessage * msg_info,
+			 struct mailimf_fields ** result);
+
+  int (* msg_get_flags)(mailmessage * msg_info,
+		    struct mail_flags ** result);
+};
+
+
+/*
+  mailmessage is a data structure to get information from messages
+
+  - session is the session linked to the given message, it can be NULL
+
+  - driver is the message driver
+  
+  - index is the message number
+
+  - uid, when it is not NULL, it means that the folder 
+      the folder has persistant message numbers, the string is
+      the unique message number in the folder.
+      uid should be implemented if possible.
+      for drivers where we cannot generate real uid,
+      a suggestion is "AAAA-IIII" where AAAA is some
+      random session number and IIII the content of index field.
+
+  - size, when it is not 0, is the size of the message content.
+  
+  - fields, when it is not NULL, are the header fields of the message.
+
+  - flags, when it is not NULL, are the flags related to the message.
+
+  - single_fields, when resolved != 0, is filled with the data of fields.
+
+  - mime, when it is not NULL
+
+  - cached is != 0 when the header fields were read from the cache.
+  
+  - data is data specific to the driver, this is internal data structure,
+      some state of the message.
+*/
+
+struct mailmessage {
+  mailsession * msg_session;
+  mailmessage_driver * msg_driver;
+  uint32_t msg_index;
+  char * msg_uid;
+
+  size_t msg_size;
+  struct mailimf_fields * msg_fields;
+  struct mail_flags * msg_flags;
+
+  int msg_resolved;
+  struct mailimf_single_fields msg_single_fields;
+  struct mailmime * msg_mime;
+
+  /* internal data */
+
+  int msg_cached;
+  void * msg_data;
+  
+ /*
+   msg_folder field :
+   used to reference the mailfolder, this is a workaround due
+   to the problem with initial conception, where folder notion
+   did not exist.
+ */
+  void * msg_folder;
+  /* user data */
+  void * msg_user_data;
+};
+
+
+/*
+  mailmessage_tree is a node in the messages tree (thread)
+  
+  - node_parent is the parent of the message, it is NULL if the message
+      is the root of the message tree.
+
+  - node_msgid is the message ID of this node.
+
+  - node_date is the date of the message in number of second elapsed
+      since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
+
+  - node_msg is the message structure that is stored referenced by the node.
+      is msg is NULL, this is a dummy node.
+
+  - node_children is an array that contains all the children of the node.
+      children are mailmessage_tree structures.
+
+  - node_is_reply is != 0 when the message is a reply or a forward
+
+  - node_base_subject is the extracted subject of the message.
+*/
+
+struct mailmessage_tree {
+  struct mailmessage_tree * node_parent;
+  char * node_msgid;
+  time_t node_date;
+  mailmessage * node_msg;
+  carray * node_children; /* array of (struct mailmessage_tree *) */
+
+  /* private, used for threading */
+  int node_is_reply;
+  char * node_base_subject;
+};
+
+LIBETPAN_EXPORT
+struct mailmessage_tree *
+mailmessage_tree_new(char * node_msgid, time_t node_date,
+    mailmessage * node_msg);
+
+LIBETPAN_EXPORT
+void mailmessage_tree_free(struct mailmessage_tree * tree);
+
+/*
+  mailmessage_tree_free_recursive
+
+  if you want to release memory of the given tree and all the sub-trees,
+  you can use this function.
+*/
+LIBETPAN_EXPORT
+void mailmessage_tree_free_recursive(struct mailmessage_tree * tree);
+
+
+struct generic_message_t {
+  int (* msg_prefetch)(mailmessage * msg_info);
+  void (* msg_prefetch_free)(struct generic_message_t * msg);
+  int msg_fetched;
+  char * msg_message;
+  size_t msg_length;
+  void * msg_data;
+};
+
+LIBETPAN_EXPORT
+const char * maildriver_strerror(int err);
+
+/* basic malloc / free functions to be compliant with the library allocations */
+LIBETPAN_EXPORT
+void *libetpan_malloc(size_t length);
+
+LIBETPAN_EXPORT
+void libetpan_free(void* data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 99 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maildriver_types_helper.h

@@ -0,0 +1,99 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maildriver_types_helper.h,v 1.6 2004/11/21 21:53:35 hoa Exp $
+ */
+
+#ifndef MAILDRIVER_TYPES_HELPER_H
+
+#define MAILDRIVER_TYPES_HELPER_H
+
+#include <libetpan/maildriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+  mail_flags_add_extension adds the given flag if it does not exists in
+  the flags.
+
+  @param flags this is the flag to change
+
+  @param ext_flag this is the name of an extension flag
+    the given flag name is duplicated and is no more needed after
+    the function call.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+int mail_flags_add_extension(struct mail_flags * flags,
+			     char * ext_flag);
+
+/*
+  mail_flags_remove_extension removes the given flag if it does not exists in
+  the flags.
+
+  @param flags this is the flag to change
+
+  @param ext_flag this is the name of an extension flag
+    the given flag name is no more needed after the function call.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+int mail_flags_remove_extension(struct mail_flags * flags,
+				char * ext_flag);
+
+/*
+  mail_flags_has_extension returns 1 if the flags is in the given flags,
+    0 is returned otherwise.
+
+  @param flags this is the flag to change
+
+  @param ext_flag this is the name of an extension flag
+    the given flag name is no more needed after the function call.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+
+int mail_flags_has_extension(struct mail_flags * flags,
+			     char * ext_flag);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 190 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailengine.h

@@ -0,0 +1,190 @@
+/*
+ * libEtPan! -- a mail library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailengine.h,v 1.3 2004/11/21 21:53:35 hoa Exp $
+ */
+
+#ifndef MAILENGINE_H
+
+#define MAILENGINE_H
+
+#include <libetpan/mailmessage.h>
+#include <libetpan/mailfolder.h>
+#include <libetpan/mailprivacy_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+  to run things in thread, you must protect the storage again concurrency.
+*/
+
+
+/*
+  storage data
+*/
+
+struct mailengine *
+libetpan_engine_new(struct mailprivacy * privacy);
+
+void libetpan_engine_free(struct mailengine * engine);
+
+
+struct mailprivacy *
+libetpan_engine_get_privacy(struct mailengine * engine);
+
+
+/*
+  message ref and unref
+*/
+
+/*
+  these function can only take messages returned by get_msg_list()
+  as arguments.
+  
+  these functions cannot fail.
+*/
+
+int libetpan_message_ref(struct mailengine * engine,
+    mailmessage * msg);
+
+int libetpan_message_unref(struct mailengine * engine,
+    mailmessage * msg);
+
+
+/*
+  when you want to access the MIME structure of the message
+  with msg->mime, you have to call libetpan_message_mime_ref()
+  and libetpan_message_mime_unref() when you have finished.
+  
+  if libetpan_mime_ref() returns a value <= 0, it means this failed.
+  the value is -MAIL_ERROR_XXX
+*/
+
+int libetpan_message_mime_ref(struct mailengine * engine,
+    mailmessage * msg);
+
+int libetpan_message_mime_unref(struct mailengine * engine,
+    mailmessage * msg);
+
+/*
+  message list
+*/
+
+/*
+  libetpan_folder_get_msg_list()
+  
+  This function returns two list.
+  - List of lost message (the messages that were previously returned
+    but that does no more exist) (p_lost_msg_list)
+  - List of valid messages (p_new_msg_list).
+
+  These two list can only be freed by libetpan_folder_free_msg_list()
+*/
+
+int libetpan_folder_get_msg_list(struct mailengine * engine,
+    struct mailfolder * folder,
+    struct mailmessage_list ** p_new_msg_list,
+    struct mailmessage_list ** p_lost_msg_list);
+
+int libetpan_folder_fetch_env_list(struct mailengine * engine,
+    struct mailfolder * folder,
+    struct mailmessage_list * msg_list);
+
+void libetpan_folder_free_msg_list(struct mailengine * engine,
+    struct mailfolder * folder,
+    struct mailmessage_list * env_list);
+
+
+/*
+  connect and disconnect storage
+*/
+
+int libetpan_storage_add(struct mailengine * engine,
+    struct mailstorage * storage);
+
+void libetpan_storage_remove(struct mailengine * engine,
+    struct mailstorage * storage);
+
+int libetpan_storage_connect(struct mailengine * engine,
+    struct mailstorage * storage);
+
+void libetpan_storage_disconnect(struct mailengine * engine,
+    struct mailstorage * storage);
+
+int libetpan_storage_used(struct mailengine * engine,
+    struct mailstorage * storage);
+
+
+/*
+  libetpan_folder_connect()
+  libetpan_folder_disconnect()
+  
+  You can disconnect the folder only when you have freed all the message
+  you were given.
+*/
+
+int libetpan_folder_connect(struct mailengine * engine,
+    struct mailfolder * folder);
+
+void libetpan_folder_disconnect(struct mailengine * engine,
+    struct mailfolder * folder);
+
+
+struct mailfolder *
+libetpan_message_get_folder(struct mailengine * engine,
+    mailmessage * msg);
+
+struct mailstorage *
+libetpan_message_get_storage(struct mailengine * engine,
+    mailmessage * msg);
+
+
+/*
+  register a message
+*/
+
+int libetpan_message_register(struct mailengine * engine,
+    struct mailfolder * folder,
+    mailmessage * msg);
+
+
+void libetpan_engine_debug(struct mailengine * engine, FILE * f);
+
+extern void * engine_app;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 80 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailfolder.h

@@ -0,0 +1,80 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailfolder.h,v 1.4 2006/04/06 22:54:56 hoa Exp $
+ */
+
+#ifndef MAILFOLDER_H
+
+#define MAILFOLDER_H
+
+#include "mailstorage_types.h"
+
+LIBETPAN_EXPORT
+int mailfolder_noop(struct mailfolder * folder);
+
+LIBETPAN_EXPORT
+int mailfolder_check(struct mailfolder * folder);
+
+LIBETPAN_EXPORT
+int mailfolder_expunge(struct mailfolder * folder);
+
+LIBETPAN_EXPORT
+int mailfolder_status(struct mailfolder * folder,
+    uint32_t * result_messages, uint32_t * result_recent,
+    uint32_t * result_unseen);
+
+LIBETPAN_EXPORT
+int mailfolder_append_message(struct mailfolder * folder,
+    char * message, size_t size);
+
+LIBETPAN_EXPORT
+int mailfolder_append_message_flags(struct mailfolder * folder,
+    char * message, size_t size, struct mail_flags * flags);
+
+LIBETPAN_EXPORT
+int mailfolder_get_messages_list(struct mailfolder * folder,
+    struct mailmessage_list ** result);
+
+LIBETPAN_EXPORT
+int mailfolder_get_envelopes_list(struct mailfolder * folder,
+    struct mailmessage_list * result);
+
+LIBETPAN_EXPORT
+int mailfolder_get_message(struct mailfolder * folder,
+    uint32_t num, mailmessage ** result);
+
+LIBETPAN_EXPORT
+int mailfolder_get_message_by_uid(struct mailfolder * folder,
+    const char * uid, mailmessage ** result);
+
+#endif

+ 914 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap.h

@@ -0,0 +1,914 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimap.h,v 1.23 2011/03/29 23:59:05 hoa Exp $
+ */
+
+#ifndef MAILIMAP_H
+
+#define MAILIMAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimap_types.h>
+#include <libetpan/mailimap_types_helper.h>
+#include <libetpan/mailimap_helper.h>
+
+#include <libetpan/mailimap_socket.h>
+#include <libetpan/mailimap_ssl.h>
+
+#include <libetpan/acl.h>
+#include <libetpan/annotatemore.h>
+#include <libetpan/uidplus.h>
+#include <libetpan/idle.h>
+#include <libetpan/quota.h>
+#include <libetpan/namespace.h>
+#include <libetpan/mailimap_id.h>
+#include <libetpan/enable.h>
+#include <libetpan/xlist.h>
+#include <libetpan/xgmlabels.h>
+#include <libetpan/xgmmsgid.h>
+#include <libetpan/xgmthrid.h>
+#include <libetpan/condstore.h>
+#include <libetpan/qresync.h>
+#include <libetpan/mailimap_sort.h>
+#include <libetpan/mailimap_compress.h>
+#include <libetpan/mailimap_oauth2.h>
+
+/*
+  mailimap_connect()
+
+  This function will connect the IMAP session with the given stream.
+
+  @param session  the IMAP session
+  @param s        stream to use
+
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+  
+  note that on success, MAILIMAP_NO_ERROR_AUTHENTICATED or
+    MAILIMAP_NO_ERROR_NON_AUTHENTICATED is returned
+
+  MAILIMAP_NO_ERROR_NON_AUTHENTICATED is returned when you need to
+  use mailimap_login() to authenticate, else
+  MAILIMAP_NO_ERROR_AUTHENTICATED is returned.
+*/
+
+LIBETPAN_EXPORT
+int mailimap_connect(mailimap * session, mailstream * s);
+
+/*
+  mailimap_append()
+
+  This function will append a given message to the given mailbox
+  by sending an APPEND command.
+
+  @param session       the IMAP session
+  @param mailbox       name of the mailbox
+  @param flag_list     flags of the message
+  @param date_time     timestamp of the message
+  @param literal       content of the message
+  @param literal_size  size of the message
+  
+  @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_append(mailimap * session, const char * mailbox,
+    struct mailimap_flag_list * flag_list,
+    struct mailimap_date_time * date_time,
+    const char * literal, size_t literal_size);
+
+/*
+   mailimap_noop()
+   
+   This function will poll for an event on the server by
+   sending a NOOP command to the IMAP server
+
+   @param session IMAP session
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR_XXX codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_noop(mailimap * session);
+
+/*
+   mailimap_logout()
+   
+   This function will logout from an IMAP server by sending
+   a LOGOUT command.
+
+   @param session IMAP session
+  
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_logout(mailimap * session);
+
+/*
+   mailimap_capability()
+   
+   This function will query an IMAP server for his capabilities
+   by sending a CAPABILITY command.
+
+   @param session IMAP session
+   @param result  The result of this command is a list of
+     capabilities and it is stored into (* result).
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_capability(mailimap * session,
+			struct mailimap_capability_data ** result);
+
+/*
+   mailimap_check()
+
+   This function will request for a checkpoint of the mailbox by
+   sending a CHECK command.
+   
+   @param session IMAP session
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_check(mailimap * session);
+
+/*
+   mailimap_close()
+
+   This function will close the selected mailbox by sending
+   a CLOSE command.
+
+   @param session IMAP session
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_close(mailimap * session);
+
+/*
+   mailimap_expunge()
+
+   This function will permanently remove from the selected mailbox
+   message that have the \Deleted flag set.
+
+   @param session IMAP session
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_expunge(mailimap * session);
+
+/*
+   mailimap_copy()
+
+   This function will copy the given messages from the selected mailbox
+   to the given mailbox. 
+
+   @param session IMAP session
+   @param set     This is a set of message numbers.
+   @param mb      This is the destination mailbox.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_copy(mailimap * session, struct mailimap_set * set,
+    const char * mb);
+
+/*
+   mailimap_uid_copy()
+
+   This function will copy the given messages from the selected mailbox
+   to the given mailbox. 
+
+   @param session IMAP session
+   @param set     This is a set of message unique identifiers.
+   @param mb      This is the destination mailbox.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+   MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_uid_copy(mailimap * session,
+    struct mailimap_set * set, const char * mb);
+
+/*
+   mailimap_move()
+
+   This function will move the given messages from the selected mailbox
+   to the given mailbox. 
+
+   @param session IMAP session
+   @param set     This is a set of message numbers.
+   @param mb      This is the destination mailbox.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_move(mailimap * session, struct mailimap_set * set,
+                  const char * mb);
+
+/*
+   mailimap_uid_move()
+
+   This function will move the given messages from the selected mailbox
+   to the given mailbox. 
+
+   @param session IMAP session
+   @param set     This is a set of message unique identifiers.
+   @param mb      This is the destination mailbox.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+   MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_uid_move(mailimap * session, struct mailimap_set * set,
+                      const char * mb);
+
+/*
+   mailimap_create()
+
+   This function will create a mailbox.
+
+   @param session IMAP session
+   @param mb      This is the name of the mailbox to create.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_create(mailimap * session, const char * mb);
+
+/*
+   mailimap_delete()
+
+   This function will delete a mailox.
+
+   @param session IMAP session
+   @param mb      This is the name of the mailbox to delete.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_delete(mailimap * session, const char * mb);
+
+/*
+   mailimap_examine()
+
+   This function will select the mailbox for read-only operations.
+
+   @param session IMAP session
+   @param mb      This is the name of the mailbox to select.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_examine(mailimap * session, const char * mb);
+
+/*
+  mailimap_fetch()
+
+  This function will retrieve data associated with the given message
+  numbers.
+  
+  @param session    IMAP session
+  @param set        set of message numbers
+  @param fetch_type type of information to be retrieved
+  @param result     The result of this command is a clist
+    and it is stored into (* result). Each element of the clist is a
+    (struct mailimap_msg_att *).
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_fetch(mailimap * session, struct mailimap_set * set,
+	       struct mailimap_fetch_type * fetch_type, clist ** result);
+
+/*
+  mailimap_fetch()
+
+  This function will retrieve data associated with the given message
+  numbers.
+  
+  @param session    IMAP session
+  @param set        set of message unique identifiers
+  @param fetch_type type of information to be retrieved
+  @param result     The result of this command is a clist
+    and it is stored into (* result). Each element of the clist is a
+    (struct mailimap_msg_att *).
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+   
+LIBETPAN_EXPORT
+int
+mailimap_uid_fetch(mailimap * session,
+		   struct mailimap_set * set,
+		   struct mailimap_fetch_type * fetch_type, clist ** result);
+
+/*
+   mailimap_fetch_list_free()
+   
+   This function will free the result of a fetch command.
+
+   @param fetch_list  This is the clist containing
+     (struct mailimap_msg_att *) elements to free.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_fetch_list_free(clist * fetch_list);
+
+/*
+   mailimap_list()
+
+   This function will return the list of the mailbox
+   available on the server.
+
+   @param session IMAP session
+   @param mb      This is the reference name that informs
+     of the level of hierarchy
+   @param list_mb mailbox name with possible wildcard
+   @param result  This will store a clist of (struct mailimap_mailbox_list *)
+     in (* result)
+ 
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_list(mailimap * session, const char * mb,
+    const char * list_mb, clist ** result);
+
+/*
+   mailimap_login()
+
+   This function will authenticate the client.
+
+   @param session   IMAP session
+   @param userid    login of the user
+   @param password  password of the user
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+    MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_login(mailimap * session,
+    const char * userid, const char * password);
+
+/*
+   mailimap_authenticate()
+   
+   This function will authenticate the client.
+   TODO : documentation
+*/
+
+LIBETPAN_EXPORT
+int mailimap_authenticate(mailimap * session, const char * auth_type,
+    const char * server_fqdn,
+    const char * local_ip_port,
+    const char * remote_ip_port,
+    const char * login, const char * auth_name,
+    const char * password, const char * realm);
+
+/*
+   mailimap_lsub()
+
+   This function will return the list of the mailbox
+   that the client has subscribed to.
+
+   @param session IMAP session
+   @param mb      This is the reference name that informs
+   of the level of hierarchy
+   @param list_mb mailbox name with possible wildcard
+   @param result  This will store a list of (struct mailimap_mailbox_list *)
+   in (* result)
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_lsub(mailimap * session, const char * mb,
+		  const char * list_mb, clist ** result);
+
+/*
+   mailimap_list_result_free()
+
+   This function will free the clist of (struct mailimap_mailbox_list *)
+
+   @param list  This is the clist to free.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_list_result_free(clist * list);
+
+/*
+   mailimap_rename()
+
+   This function will change the name of a mailbox.
+
+   @param session  IMAP session
+   @param mb       current name
+   @param new_name new name
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_rename(mailimap * session,
+    const char * mb, const char * new_name);
+
+/*
+   mailimap_search()
+
+   All mails that match the given criteria will be returned
+   their numbers in the result list.
+
+   @param session  IMAP session
+   @param charset  This indicates the charset of the strings that appears
+   in the searching criteria
+   @param key      This is the searching criteria
+   @param result   The result is a clist of (uint32_t *) and will be
+   stored in (* result).
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_search(mailimap * session, const char * charset,
+    struct mailimap_search_key * key, clist ** result);
+
+/*
+   mailimap_uid_search()
+
+
+   All mails that match the given criteria will be returned
+   their unique identifiers in the result list.
+
+   @param session  IMAP session
+   @param charset  This indicates the charset of the strings that appears
+   in the searching criteria
+   @param key      This is the searching criteria
+   @param result   The result is a clist of (uint32_t *) and will be
+   stored in (* result).
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_uid_search(mailimap * session, const char * charset,
+    struct mailimap_search_key * key, clist ** result);
+
+/*
+ mailimap_search_literalplus()
+
+ All mails that match the given criteria will be returned
+ their numbers in the result list.
+ LITERAL+ feature will be used to send strings.
+
+ @param session  IMAP session
+ @param charset  This indicates the charset of the strings that appears
+ in the searching criteria
+ @param key      This is the searching criteria
+ @param result   The result is a clist of (uint32_t *) and will be
+ stored in (* result).
+
+ @return the return code is one of MAILIMAP_ERROR_XXX or
+ MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT int mailimap_search_literalplus(mailimap * session, const char * charset,
+                                                struct mailimap_search_key * key, clist ** result);
+
+/*
+ mailimap_uid_search_literalplus()
+
+ All mails that match the given criteria will be returned
+ their numbers in the result list.
+ LITERAL+ feature will be used to send strings.
+
+ @param session  IMAP session
+ @param charset  This indicates the charset of the strings that appears
+ in the searching criteria
+ @param key      This is the searching criteria
+ @param result   The result is a clist of (uint32_t *) and will be
+ stored in (* result).
+ 
+ @return the return code is one of MAILIMAP_ERROR_XXX or
+ MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT int mailimap_uid_search_literalplus(mailimap * session, const char * charset,
+                                                    struct mailimap_search_key * key, clist ** result);
+
+/*
+   mailimap_search_result_free()
+
+   This function will free the result of the a search.
+
+   @param search_result   This is a clist of (uint32_t *) returned
+     by mailimap_uid_search() or mailimap_search()
+*/
+
+LIBETPAN_EXPORT
+void mailimap_search_result_free(clist * search_result);
+
+/*
+   mailimap_select()
+
+   This function will select a given mailbox so that messages in the
+   mailbox can be accessed.
+   
+   @param session          IMAP session
+   @param mb  This is the name of the mailbox to select.
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_select(mailimap * session, const char * mb);
+
+/*
+ mailimap_custom_command()
+ 
+ @param session   IMAP session
+ @param command   Custom IMAP command to be send
+ 
+ @return the return code is one of MAILIMAP_ERROR_XXX or
+ MAILIMAP_NO_ERROR_XXX codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_custom_command(mailimap * session, const char * command);
+  
+/*
+   mailimap_status()
+
+   This function will return informations about a given mailbox.
+
+   @param session          IMAP session
+   @param mb               This is the name of the mailbox
+   @param status_att_list  This is the list of mailbox information to return
+   @param result           List of returned values
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_status(mailimap * session, const char * mb,
+		struct mailimap_status_att_list * status_att_list,
+		struct mailimap_mailbox_data_status ** result);
+
+/*
+   mailimap_uid_store()
+
+   This function will alter the data associated with some messages
+   (flags of the messages).
+
+   @param session          IMAP session
+   @param set              This is a list of message numbers.
+   @param store_att_flags  This is the data to associate with the
+     given messages
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_store(mailimap * session,
+	       struct mailimap_set * set,
+	       struct mailimap_store_att_flags * store_att_flags);
+
+/*
+   mailimap_uid_store()
+
+   This function will alter the data associated with some messages
+   (flags of the messages).
+
+   @param session          IMAP session
+   @param set              This is a list of message unique identifiers.
+   @param store_att_flags  This is the data to associate with the
+     given messages
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_uid_store(mailimap * session,
+    struct mailimap_set * set,
+    struct mailimap_store_att_flags * store_att_flags);
+
+/*
+   mailimap_subscribe()
+
+   This function adds the specified mailbox name to the
+   server's set of "active" or "subscribed" mailboxes.
+
+   @param session   IMAP session
+   @param mb        This is the name of the mailbox
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_subscribe(mailimap * session, const char * mb);
+
+/*
+   mailimap_unsubscribe()
+
+   This function removes the specified mailbox name to the
+   server's set of "active" or "subscribed" mailboxes.
+
+   @param session   IMAP session
+   @param mb        This is the name of the mailbox
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+*/
+
+LIBETPAN_EXPORT
+int mailimap_unsubscribe(mailimap * session, const char * mb);
+
+/*
+   mailimap_starttls()
+
+   This function starts change the mode of the connection to
+   switch to SSL connection.
+   It won't change the stream connection to SSL rightway.
+   See mailimap_socket_starttls() will switch the mailstream too.
+
+   @param session   IMAP session
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR_XXX codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_starttls(mailimap * session);
+
+/*
+   mailimap_new()
+
+   This function returns a new IMAP session.
+
+   @param progr_rate  When downloading messages, a function will be called
+     each time the amount of bytes downloaded reaches a multiple of this
+     value, this can be 0.
+   @param progr_fun   This is the function to call to notify the progress,
+     this can be NULL.
+
+   @return an IMAP session is returned.
+ */
+
+LIBETPAN_EXPORT
+mailimap * mailimap_new(size_t imap_progr_rate,
+    progress_function * imap_progr_fun);
+
+/*
+   mailimap_free()
+
+   This function will free the data structures associated with
+   the IMAP session.
+
+   @param session   IMAP session
+ */
+
+LIBETPAN_EXPORT
+void mailimap_free(mailimap * session);
+
+/*
+   mailimap_send_current_tag() send current IMAP tag. See RFC 3501.
+
+   @param session   IMAP session
+
+   @return MAILIMAP_NO_ERROR if the tag could be sent on the network.
+*/
+
+int mailimap_send_current_tag(mailimap * session);
+
+/*
+    mailimap_read_line() receive a line line buffer into memory.
+
+    It needs to be called before starting to parse a response.
+
+    @param session   IMAP session
+
+    @return MAILIMAP_NO_ERROR if a line could be buffered.
+*/
+
+char * mailimap_read_line(mailimap * session);
+
+/*
+    mailimap_parse_response() parse an IMAP response.
+
+    @param session   IMAP session
+    @param result    an IMAP response data structure will be allocated and
+      filled with the parsed response. The pointer to the
+      allocated data structure will be stored in result.
+
+    @return MAILIMAP_NO_ERROR if a line could be buffered.
+*/
+
+int mailimap_parse_response(mailimap * session,
+    struct mailimap_response ** result);
+
+/*
+    mailimap_set_progress_callback() set IMAP progression callbacks.
+
+    @param session           IMAP session
+    @param body_progr_fun    set callback function for a progression of an imap
+      call that involves the download of a significant amount of data.
+    @param items_progr_fun   set callback function for a progression of an imap
+      call that involves the download of information of several items.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_set_progress_callback(mailimap * session,
+                                    mailprogress_function * body_progr_fun,
+                                    mailprogress_function * items_progr_fun,
+                                    void * context);
+
+/*
+    mailimap_set_msg_att_handler() set a callback when a message information is
+      downloaded using FETCH.
+
+    @param session    IMAP session
+    @param handler    set a callback function. This function will be called
+      during the download of the response each time a new message information
+      has just been downloaded.
+    @param context    parameter that's passed to the callback function.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_set_msg_att_handler(mailimap * session,
+                                  mailimap_msg_att_handler * handler,
+                                  void * context);
+
+/*
+    mailimap_set_msg_body_handler() set a callback when a message body is
+      downloaded using FETCH.
+
+    @param session    IMAP session
+    @param handler    set a callback function. This function will be called
+      during the download of the response to process the message body
+      as data become available from the network.
+      This can be used, for example, for downloading big messages (or it attachments)
+      to the file without keeping it in memory.
+    @param context    parameter that's passed to the callback function.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_set_msg_body_handler(mailimap * session,
+                                   mailimap_msg_body_handler * handler,
+                                   void * context);
+
+/*
+    mailimap_set_timeout() set the network timeout of the IMAP session.
+
+    @param session    IMAP session
+    @param timeout    value of the timeout in seconds.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_set_timeout(mailimap * session, time_t timeout);;
+
+/*
+    mailimap_get_timeout() get the network timeout of the IMAP session.
+
+    @param session    IMAP session
+    @return the value of the timeout in seconds.
+*/
+
+LIBETPAN_EXPORT
+time_t mailimap_get_timeout(mailimap * session);
+
+/*
+    mailimap_set_logger() get the network timeout of the IMAP session.
+
+    @param session         IMAP session
+    @param logger          logger function. See mailstream_types.h to know possible log_type values.
+      str is the log, data received or data sent.
+    @param logger_context  parameter that is passed to the logger function.
+    @return the value of the timeout in seconds.
+*/
+
+LIBETPAN_EXPORT
+void mailimap_set_logger(mailimap * session, void (* logger)(mailimap * session, int log_type,
+    const char * str, size_t size, void * context), void * logger_context);
+
+#ifndef LIBETPAN_HAS_MAILIMAP_163_WORKAROUND
+  #define LIBETPAN_HAS_MAILIMAP_163_WORKAROUND	1
+#endif
+
+LIBETPAN_EXPORT
+int mailimap_is_163_workaround_enabled(mailimap * session);
+    
+LIBETPAN_EXPORT    
+void mailimap_set_163_workaround_enabled(mailimap * session, int enabled);
+
+#ifndef LIBETPAN_HAS_MAILIMAP_RAMBLER_WORKAROUND
+  #define LIBETPAN_HAS_MAILIMAP_RAMBLER_WORKAROUND	1
+#endif
+
+/*
+    Enable workaround for Rambler IMAP server.
+
+    Occasionally, for large attachments (~20MB) Rambler returns wrong length of the literal.
+    Since this workaround is not completely free from false positives, by default is is off.
+
+    It is proposed to enable it only during downloading large attachments from Rambler:
+
+    @code
+    if (encoding is (base64 or uuencode) and server is rambler.ru) {
+        mailimap_set_rambler_workaround_enabled(imap, 1);
+            … fetch part ...
+        mailimap_set_rambler_workaround_enabled(imap, 0);
+    }
+    @endcode
+*/
+
+LIBETPAN_EXPORT
+int mailimap_is_rambler_workaround_enabled(mailimap * session);
+
+LIBETPAN_EXPORT
+void mailimap_set_rambler_workaround_enabled(mailimap * session, int enabled);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 68 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_compress.h

@@ -0,0 +1,68 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef MAILIMAP_COMPRESS_H
+
+#define MAILIMAP_COMPRESS_H
+
+#include <libetpan/mailimap_types.h>
+
+/*
+   mailimap_compress()
+
+   This function will request IMAP compression by sending
+   a COMPRESS command. It will also change the stream connection to
+   a compressed stream (mailstream_compress).
+
+   @param session IMAP session
+
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+     MAILIMAP_NO_ERROR codes
+ */
+
+LIBETPAN_EXPORT
+int mailimap_compress(mailimap * session);
+
+/*
+   mailimap_has_compress_deflate()
+
+   This function will return 1 if compression deflate is available
+   on the server else it will return 0.
+
+   @param session IMAP session
+
+   @return returns 1 if compression deflate is available on the server.
+ */
+
+LIBETPAN_EXPORT
+int mailimap_has_compress_deflate(mailimap * session);
+
+#endif

+ 111 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_extension.h

@@ -0,0 +1,111 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef MAILIMAP_EXTENSION_H
+
+#define MAILIMAP_EXTENSION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimap_types.h>
+#include <libetpan/mailimap_extension_types.h>
+
+/*
+  you add a (static) mailimap_extension_api to the list of extensions
+  by calling register. making the list of
+  extensions contain all extensions statically may prove detrimental
+  to speed if you have many extensions and don't need any of them.
+  as unregistering single extensions does not really make any sense,
+  it's not provided - just an unregister_all which is primarily used
+  to free the clist on exit.
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_extension_register(struct mailimap_extension_api * extension);
+
+LIBETPAN_EXPORT
+void
+mailimap_extension_unregister_all(void);
+
+/*
+  this is called as the main parser wrapper for all extensions.
+  it gos through the list of registered extensions and calls
+  all of the extensions' parsers looking for one that doesn't
+  return MAILIMAP_ERROR_PARSE.
+*/
+LIBETPAN_EXPORT
+int
+mailimap_extension_data_parse(int calling_parser,
+        mailstream * fd, MMAPString * buffer, struct mailimap_parser_context * parser_ctx,
+        size_t * indx, struct mailimap_extension_data ** result,
+        size_t progr_rate,
+        progress_function * progr_fun);
+
+LIBETPAN_EXPORT
+struct mailimap_extension_data *
+mailimap_extension_data_new(struct mailimap_extension_api * extension,
+        int type, void * data);
+
+/*
+  wrapper for the extensions' free. calls the correct extension's free
+  based on data->extension.
+*/
+LIBETPAN_EXPORT
+void
+mailimap_extension_data_free(struct
+        mailimap_extension_data * data);
+
+/*
+  stores the ext_data in the session (only needed for extensions
+  that embed directly into response-data).
+*/
+void mailimap_extension_data_store(mailimap * session,
+    struct mailimap_extension_data ** ext_data);
+
+/*
+  return 1 if the extension of the given name is supported.
+  the name is searched in the capabilities.
+*/
+
+LIBETPAN_EXPORT
+int mailimap_has_extension(mailimap * session, const char * extension_name);
+
+LIBETPAN_EXPORT
+int mailimap_has_authentication(mailimap * session, const char * authentication_name);
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 114 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_extension_types.h

@@ -0,0 +1,114 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2014 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef MAILIMAP_EXTENSION_TYPES_H
+
+#define MAILIMAP_EXTENSION_TYPES_H
+
+#include <libetpan/mailstream.h>
+
+struct mailimap_extension_data;
+
+/*
+  this is the list of known extensions with the purpose to
+  get integer identifers for the extensions.
+*/
+
+enum {
+  MAILIMAP_EXTENSION_ANNOTATEMORE,  /* the annotatemore-draft */
+  MAILIMAP_EXTENSION_ACL,           /* the acl capability */
+  MAILIMAP_EXTENSION_UIDPLUS,       /* UIDPLUS */
+  MAILIMAP_EXTENSION_QUOTA,         /* quota */
+  MAILIMAP_EXTENSION_NAMESPACE,     /* namespace */
+  MAILIMAP_EXTENSION_XLIST,         /* XLIST (Gmail and Zimbra have this) */
+  MAILIMAP_EXTENSION_XGMLABELS,     /* X-GM-LABELS (Gmail) */
+  MAILIMAP_EXTENSION_XGMMSGID,      /* X-GM-MSGID (Gmail) */
+  MAILIMAP_EXTENSION_XGMTHRID,      /* X-GM-THRID (Gmail) */
+  MAILIMAP_EXTENSION_ID,            /* ID */
+  MAILIMAP_EXTENSION_ENABLE,        /* ENABLE */
+  MAILIMAP_EXTENSION_CONDSTORE,     /* CONDSTORE */
+  MAILIMAP_EXTENSION_QRESYNC,       /* QRESYNC */
+  MAILIMAP_EXTENSION_SORT           /* SORT */
+};
+
+
+/*
+  this is a list of extended parser functions. The extended parser
+  passes its identifier to the extension parser.
+*/
+
+enum {
+  MAILIMAP_EXTENDED_PARSER_RESPONSE_DATA,
+  MAILIMAP_EXTENDED_PARSER_RESP_TEXT_CODE,
+  MAILIMAP_EXTENDED_PARSER_MAILBOX_DATA,
+  MAILIMAP_EXTENDED_PARSER_FETCH_DATA,
+  MAILIMAP_EXTENDED_PARSER_STATUS_ATT
+};
+
+/*
+  this is the extension interface. each extension consists
+  of a initial parser and an initial free. the parser is
+  passed the calling parser's identifier. based on this
+  identifier the initial parser can then decide which
+  actual parser to call. free has mailimap_extension_data
+  as parameter. if you look at mailimap_extension_data
+  you'll see that it contains "type" as one of its
+  elements. thus an extension's initial free can call
+  the correct actual free to free its data.
+*/
+struct mailimap_extension_api {
+  char * ext_name;
+  int ext_id; /* use -1 if this is an extension outside libetpan */
+
+  int (* ext_parser)(int calling_parser, mailstream * fd,
+            MMAPString * buffer, struct mailimap_parser_context * parser_ctx, size_t * indx,
+            struct mailimap_extension_data ** result,
+            size_t progr_rate,
+            progress_function * progr_fun);
+
+  void (* ext_free)(struct mailimap_extension_data * ext_data);
+};
+
+/*
+  mailimap_extension_data is a wrapper for values parsed by extensions
+
+  - extension is an identifier for the extension that parsed the value.
+
+  - type is an identifier for the real type of the data.
+
+  - data is a pointer to the real data.
+*/
+struct mailimap_extension_data {
+  struct mailimap_extension_api * ext_extension;
+  int ext_type;
+  void * ext_data;
+};
+
+#endif

+ 71 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_helper.h

@@ -0,0 +1,71 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimap_helper.h,v 1.12 2006/06/07 15:10:01 smarinier Exp $
+ */
+
+#ifndef MAILIMAP_HELPER_H
+
+#define MAILIMAP_HELPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimap_types.h>
+
+LIBETPAN_EXPORT
+int mailimap_fetch_rfc822(mailimap * session,
+			  uint32_t msgid, char ** result);
+
+LIBETPAN_EXPORT
+int mailimap_fetch_rfc822_header(mailimap * session,
+				 uint32_t msgid, char ** result);
+
+LIBETPAN_EXPORT
+int mailimap_fetch_envelope(mailimap * session,
+			    uint32_t first, uint32_t last,
+			    clist ** result);
+
+LIBETPAN_EXPORT
+int mailimap_append_simple(mailimap * session, const char * mailbox,
+			   const char * content, size_t size);
+
+LIBETPAN_EXPORT
+int mailimap_login_simple(mailimap * session,
+			  const char * userid, const char * password);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 64 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_id.h

@@ -0,0 +1,64 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2011 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef MAILIMAP_ID_H
+
+#define MAILIMAP_ID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailimap_extension.h>
+#include <libetpan/mailimap_id_types.h>
+
+LIBETPAN_EXPORT extern struct mailimap_extension_api mailimap_extension_id;
+
+LIBETPAN_EXPORT
+int mailimap_has_id(mailimap * session);
+
+LIBETPAN_EXPORT
+int mailimap_id(mailimap * session, struct mailimap_id_params_list * client_identification,
+                struct mailimap_id_params_list ** result);
+
+/* Helpers */
+
+/* result must be freed */
+LIBETPAN_EXPORT
+int mailimap_id_basic(mailimap * session, const char * name, const char * version,
+                      char ** p_server_name, char ** p_server_version);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 72 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_id_types.h

@@ -0,0 +1,72 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2014 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef MAILIMAP_ID_TYPES_H
+
+#define MAILIMAP_ID_TYPES_H
+
+#include <libetpan/clist.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct mailimap_id_params_list {
+  clist * /* struct mailimap_id_param */ idpa_list;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_id_params_list * mailimap_id_params_list_new(clist * items);
+
+LIBETPAN_EXPORT
+void mailimap_id_params_list_free(struct mailimap_id_params_list * list);
+
+struct mailimap_id_param {
+  char * idpa_name;
+  char * idpa_value;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_id_param * mailimap_id_param_new(char * name, char * value);
+
+LIBETPAN_EXPORT
+void mailimap_id_param_free(struct mailimap_id_param * param);
+
+LIBETPAN_EXPORT
+struct mailimap_id_params_list * mailimap_id_params_list_new_empty(void);
+
+LIBETPAN_EXPORT
+int mailimap_id_params_list_add_name_value(struct mailimap_id_params_list * list, char * name, char * value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 102 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_oauth2.h

@@ -0,0 +1,102 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2014 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef MAILIMAP_OAUTH2_H
+
+#define MAILIMAP_OAUTH2_H
+
+#include <libetpan/mailimap_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+   mailimap_oauth2_authenticate()
+   Authenticates the client using using an oauth2 token.
+   To gather a deeper understanding of the OAuth2 aunthentication
+   process refer to: https://developers.google.com/gmail/xoauth2_protocol
+   For a quick start you may follow this brief set of steps:
+   1. Set up a profile for your app in the Google 
+      API Console: https://code.google.com/apis/console
+   2. With your recently obtained client_id and secret 
+      load the following URL (everything goes ina single line):
+      https://accounts.google.com/o/oauth2/auth?client_id=[YOUR_CLIENT_ID]&
+          redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&
+          response_type=code&scope=https%3A%2F%2Fmail.google.com%2F%20email&
+          &access_type=offline
+   3. The user most follow instructions to authorize application access
+      to Gmail.
+   4. After the user hits the "Accept" button it will be redirected to another
+      page where the access token will be issued.
+   5. Now from the app we need and authorization token, to get one we issue a POST request
+      the following URL: https://accounts.google.com/o/oauth2/token using these parameters:
+      client_id: This is the client id we got from step 1
+      client_secret: Client secret as we got it from step 1
+      code: This is the code we received in step 4
+      redirect_uri: This is a redirect URI where the access token will be sent, for non 
+       web applications this is usually urn:ietf:wg:oauth:2.0:oob (as we got from step 1)
+      grant_type: Always use the authorization_code parameter to retrieve an access and refresh tokens
+   6. After step 5 completes we receive a JSON object similar to:
+       {
+         "access_token":"1/fFAGRNJru1FTz70BzhT3Zg",
+         "refresh_token":"1/fFAGRNJrufoiWEGIWEFJFJF",
+         "expires_in":3920,
+         "token_type":"Bearer"
+       }
+      The above output gives us the access_token, now we need to also retrieve the user's e-mail, 
+      to do that we need to perform an HTTP GET request to Google's UserInfo API using this URL:
+       https://www.googleapis.com/oauth2/v1/userinfo?access_token=[YOUR_ACCESS_TOKEN]
+      this will return the following JSON output:
+       {
+        "id": "00000000000002222220000000",
+        "email": "email@example.com",
+        "verified_email": true
+       }
+   @param session       IMAP session
+   @param auth_user     Authentication user (tipically an e-mail address, depends on server)
+   @param access_token  OAuth2 access token
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+   MAILIMAP_NO_ERROR codes
+  */
+
+LIBETPAN_EXPORT
+int mailimap_oauth2_authenticate(mailimap * session, const char * auth_user,
+    const char * access_token);
+
+LIBETPAN_EXPORT
+int mailimap_has_xoauth2(mailimap * session);
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+		

+ 67 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_socket.h

@@ -0,0 +1,67 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimap_socket.h,v 1.16 2006/12/26 13:13:24 hoa Exp $
+ */
+
+#ifndef MAILIMAP_SOCKET_H
+
+#define MAILIMAP_SOCKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+
+#include <libetpan/mailimap_types.h>
+
+LIBETPAN_EXPORT
+int mailimap_socket_connect_voip(mailimap * f, const char * server, uint16_t port, int voip_enabled);
+
+LIBETPAN_EXPORT
+int mailimap_socket_connect(mailimap * f, const char * server, uint16_t port);
+
+LIBETPAN_EXPORT
+int mailimap_socket_starttls(mailimap * f);
+
+LIBETPAN_EXPORT
+int mailimap_socket_starttls_with_callback(mailimap * f,
+    void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 102 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_sort.h

@@ -0,0 +1,102 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2011 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef libetpan_mailimap_sort_h
+#define libetpan_mailimap_sort_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailimap_extension.h>
+#include <libetpan/mailimap_sort_types.h>
+  
+  LIBETPAN_EXPORT
+  extern struct mailimap_extension_api mailimap_extension_sort;
+  
+  
+  /*
+   mailimap_sort()
+   
+   All mails that match the given criteria will be returned
+   their numbers sorted by the given sorting criteria in the result list.
+   
+   @param session  IMAP session
+   @param charset  This indicates the charset of the strings that appears
+   in the searching criteria
+   @param key      This is the searching criteria
+   @param result   The result is a clist of (uint32_t *) and will be
+   stored in (* result).
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+   MAILIMAP_NO_ERROR codes
+   */
+  
+  LIBETPAN_EXPORT
+  int
+  mailimap_sort(mailimap * session, const char * charset,
+                struct mailimap_sort_key * key, struct mailimap_search_key * searchkey,
+                clist ** result);
+  
+  /*
+   mailimap_uid_sort()
+   
+   
+   All mails that match the given criteria will be returned
+   their unique identifiers sorted by the given sorting criteria in the result list.
+   
+   @param session    IMAP session
+   @param charset    This indicates the charset of the strings that appears
+   in the searching criteria
+   @param key        This is the sorting criteria
+   @param searchkey  This is the searching criteria
+   @param result     The result is a clist of (uint32_t *) and will be
+   stored in (* result).
+   
+   @return the return code is one of MAILIMAP_ERROR_XXX or
+   MAILIMAP_NO_ERROR codes
+   */
+  
+  LIBETPAN_EXPORT
+  int
+  mailimap_uid_sort(mailimap * session, const char * charset,
+                    struct mailimap_sort_key * key, struct mailimap_search_key * searchkey,
+                    clist ** result);
+
+  LIBETPAN_EXPORT
+  void mailimap_sort_result_free(clist * search_result);
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 121 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_sort_types.h

@@ -0,0 +1,121 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2011 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef MAILIMAP_SORT_TYPES_H
+
+#define MAILIMAP_SORT_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  
+#ifndef WIN32
+#include <inttypes.h>
+#endif
+  
+#include "mailimap_types.h"
+  
+  /* this is the condition of the SORT operation */
+  
+  enum {
+    MAILIMAP_SORT_KEY_ARRIVAL,
+    MAILIMAP_SORT_KEY_CC,
+    MAILIMAP_SORT_KEY_DATE,
+    MAILIMAP_SORT_KEY_FROM,
+    MAILIMAP_SORT_KEY_SIZE,
+    MAILIMAP_SORT_KEY_SUBJECT,
+    MAILIMAP_SORT_KEY_TO,
+    MAILIMAP_SORT_KEY_MULTIPLE
+  };
+  
+  struct mailimap_sort_key {
+    int sortk_type;
+    int sortk_is_reverse;
+    clist * sortk_multiple; /* list of (struct mailimap_sort_key *) */
+  };
+  
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new(int sortk_type,
+                        int is_reverse,
+                        clist * sortk_multiple);
+  
+  LIBETPAN_EXPORT
+  void mailimap_sort_key_free(struct mailimap_sort_key * key);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_arrival(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_cc(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_date(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_from(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_size(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_subject(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_to(int is_reverse);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_multiple(clist * keys);
+  
+  LIBETPAN_EXPORT
+  struct mailimap_sort_key *
+  mailimap_sort_key_new_multiple_empty(void);
+  
+  LIBETPAN_EXPORT
+  int
+  mailimap_sort_key_multiple_add(struct mailimap_sort_key * keys,
+                                 struct mailimap_sort_key * key_item);
+
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 68 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_ssl.h

@@ -0,0 +1,68 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimap_ssl.h,v 1.16 2006/12/26 13:13:24 hoa Exp $
+ */
+
+#ifndef MAILIMAP_SSL_H
+
+#define MAILIMAP_SSL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+
+#include <libetpan/mailimap_types.h>
+
+LIBETPAN_EXPORT
+int mailimap_ssl_connect(mailimap * f, const char * server, uint16_t port);
+
+LIBETPAN_EXPORT
+int mailimap_ssl_connect_voip(mailimap * f, const char * server, uint16_t port, int voip_enabled);
+
+LIBETPAN_EXPORT
+int mailimap_ssl_connect_with_callback(mailimap * f, const char * server, uint16_t port,
+    void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data);
+
+LIBETPAN_EXPORT
+int mailimap_ssl_connect_voip_with_callback(mailimap * f, const char * server, uint16_t port, int voip_enabled,
+    void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 3604 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_types.h

@@ -0,0 +1,3604 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimap_types.h,v 1.34 2011/01/06 00:09:52 hoa Exp $
+ */
+
+/*
+  IMAP4rev1 grammar
+
+   address         = "(" addr-name SP addr-adl SP addr-mailbox SP
+                     addr-host ")"
+
+   addr-adl        = nstring
+                       ; Holds route from [RFC-822] route-addr if
+                       ; non-NIL
+
+   addr-host       = nstring
+                       ; NIL indicates [RFC-822] group syntax.
+                       ; Otherwise, holds [RFC-822] domain name
+
+   addr-mailbox    = nstring
+                       ; NIL indicates end of [RFC-822] group; if
+                       ; non-NIL and addr-host is NIL, holds
+                       ; [RFC-822] group name.
+                       ; Otherwise, holds [RFC-822] local-part
+                       ; after removing [RFC-822] quoting
+
+
+
+   addr-name       = nstring
+                       ; If non-NIL, holds phrase from [RFC-822]
+                       ; mailbox after removing [RFC-822] quoting
+
+   append          = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP
+                     literal
+
+   astring         = 1*ASTRING-CHAR / string
+
+   ASTRING-CHAR   = ATOM-CHAR / resp-specials
+
+   atom            = 1*ATOM-CHAR
+
+   ATOM-CHAR       = <any CHAR except atom-specials>
+
+   atom-specials   = "(" / ")" / "{" / SP / CTL / list-wildcards /
+                     quoted-specials / resp-specials
+
+   authenticate    = "AUTHENTICATE" SP auth-type *(CRLF base64)
+
+   auth-type       = atom
+                       ; Defined by [SASL]
+
+   base64          = *(4base64-char) [base64-terminal]
+
+   base64-char     = ALPHA / DIGIT / "+" / "/"
+                       ; Case-sensitive
+
+   base64-terminal = (2base64-char "==") / (3base64-char "=")
+
+   body            = "(" (body-type-1part / body-type-mpart) ")"
+
+   body-extension  = nstring / number /
+                      "(" body-extension *(SP body-extension) ")"
+                       ; Future expansion.  Client implementations
+                       ; MUST accept body-extension fields.  Server
+                       ; implementations MUST NOT generate
+                       ; body-extension fields except as defined by
+                       ; future standard or standards-track
+                       ; revisions of this specification.
+
+   body-ext-1part  = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang
+                     *(SP body-extension)]]
+                       ; MUST NOT be returned on non-extensible
+                       ; "BODY" fetch
+
+
+   body-ext-mpart  = body-fld-param [SP body-fld-dsp [SP body-fld-lang
+                     *(SP body-extension)]]
+                       ; MUST NOT be returned on non-extensible
+                       ; "BODY" fetch
+
+   body-fields     = body-fld-param SP body-fld-id SP body-fld-desc SP
+                     body-fld-enc SP body-fld-octets
+
+   body-fld-desc   = nstring
+
+   body-fld-dsp    = "(" string SP body-fld-param ")" / nil
+
+   body-fld-enc    = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/
+                     "QUOTED-PRINTABLE") DQUOTE) / string
+
+   body-fld-id     = nstring
+
+   body-fld-lang   = nstring / "(" string *(SP string) ")"
+
+   body-fld-lines  = number
+
+   body-fld-md5    = nstring
+
+   body-fld-octets = number
+
+   body-fld-param  = "(" string SP string *(SP string SP string) ")" / nil
+
+   body-type-1part = (body-type-basic / body-type-msg / body-type-text)
+                     [SP body-ext-1part]
+
+   body-type-basic = media-basic SP body-fields
+                       ; MESSAGE subtype MUST NOT be "RFC822"
+
+   body-type-mpart = 1*body SP media-subtype
+                     [SP body-ext-mpart]
+
+   body-type-msg   = media-message SP body-fields SP envelope
+                     SP body SP body-fld-lines
+
+   body-type-text  = media-text SP body-fields SP body-fld-lines
+
+   capability      = ("AUTH=" auth-type) / atom
+                       ; New capabilities MUST begin with "X" or be
+                       ; registered with IANA as standard or
+                       ; standards-track
+
+
+   capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev1"
+                     *(SP capability)
+                       ; IMAP4rev1 servers which offer RFC 1730
+                       ; compatibility MUST list "IMAP4" as the first
+                       ; capability.
+
+   CHAR8           = %x01-ff
+                       ; any OCTET except NUL, %x00
+
+   command         = tag SP (command-any / command-auth / command-nonauth /
+                     command-select) CRLF
+                       ; Modal based on state
+
+   command-any     = "CAPABILITY" / "LOGOUT" / "NOOP" / x-command
+                       ; Valid in all states
+
+   command-auth    = append / create / delete / examine / list / lsub /
+                     rename / select / status / subscribe / unsubscribe
+                       ; Valid only in Authenticated or Selected state
+
+   command-nonauth = login / authenticate
+                       ; Valid only when in Not Authenticated state
+
+   command-select  = "CHECK" / "CLOSE" / "EXPUNGE" / copy / fetch / store /
+                     uid / search
+                       ; Valid only when in Selected state
+
+   continue-req    = "+" SP (resp-text / base64) CRLF
+
+   copy            = "COPY" SP set SP mailbox
+
+   create          = "CREATE" SP mailbox
+                       ; Use of INBOX gives a NO error
+
+   date            = date-text / DQUOTE date-text DQUOTE
+
+   date-day        = 1*2DIGIT
+                       ; Day of month
+
+   date-day-fixed  = (SP DIGIT) / 2DIGIT
+                       ; Fixed-format version of date-day
+
+   date-month      = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
+                     "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
+
+   date-text       = date-day "-" date-month "-" date-year
+
+   date-year       = 4DIGIT
+
+   date-time       = DQUOTE date-day-fixed "-" date-month "-" date-year
+                     SP time SP zone DQUOTE
+
+   delete          = "DELETE" SP mailbox
+                       ; Use of INBOX gives a NO error
+
+   digit-nz        = %x31-39
+                       ; 1-9
+
+   envelope        = "(" env-date SP env-subject SP env-from SP env-sender SP
+                     env-reply-to SP env-to SP env-cc SP env-bcc SP
+                     env-in-reply-to SP env-message-id ")"
+
+   env-bcc         = "(" 1*address ")" / nil
+
+   env-cc          = "(" 1*address ")" / nil
+
+   env-date        = nstring
+
+   env-from        = "(" 1*address ")" / nil
+
+   env-in-reply-to = nstring
+
+   env-message-id  = nstring
+
+   env-reply-to    = "(" 1*address ")" / nil
+
+   env-sender      = "(" 1*address ")" / nil
+
+   env-subject     = nstring
+
+   env-to          = "(" 1*address ")" / nil
+
+   examine         = "EXAMINE" SP mailbox
+
+   fetch           = "FETCH" SP set SP ("ALL" / "FULL" / "FAST" / fetch-att /
+                     "(" fetch-att *(SP fetch-att) ")")
+
+   fetch-att       = "ENVELOPE" / "FLAGS" / "INTERNALDATE" /
+                     "RFC822" [".HEADER" / ".SIZE" / ".TEXT"] /
+                     "BODY" ["STRUCTURE"] / "UID" /
+                     "BODY" [".PEEK"] section ["<" number "." nz-number ">"]
+
+   flag            = "\Answered" / "\Flagged" / "\Deleted" /
+                     "\Seen" / "\Draft" / flag-keyword / flag-extension
+                       ; Does not include "\Recent"
+
+   flag-extension  = "\" atom
+                       ; Future expansion.  Client implementations
+                       ; MUST accept flag-extension flags.  Server
+                       ; implementations MUST NOT generate
+                       ; flag-extension flags except as defined by
+                       ; future standard or standards-track
+                       ; revisions of this specification.
+
+   flag-fetch      = flag / "\Recent"
+
+   flag-keyword    = atom
+
+   flag-list       = "(" [flag *(SP flag)] ")"
+
+   flag-perm       = flag / "\*"
+
+   greeting        = "*" SP (resp-cond-auth / resp-cond-bye) CRLF
+
+   header-fld-name = astring
+
+   header-list     = "(" header-fld-name *(SP header-fld-name) ")"
+
+   list            = "LIST" SP mailbox SP list-mailbox
+
+   list-mailbox    = 1*list-char / string
+
+   list-char       = ATOM-CHAR / list-wildcards / resp-specials
+
+   list-wildcards  = "%" / "*"
+
+   literal         = "{" number "}" CRLF *CHAR8
+                       ; Number represents the number of CHAR8s
+
+   login           = "LOGIN" SP userid SP password
+
+   lsub            = "LSUB" SP mailbox SP list-mailbox
+
+   mailbox         = "INBOX" / astring
+                       ; INBOX is case-insensitive.  All case variants of
+                       ; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX
+                       ; not as an astring.  An astring which consists of
+                       ; the case-insensitive sequence "I" "N" "B" "O" "X"
+                       ; is considered to be INBOX and not an astring.
+                       ;  Refer to section 5.1 for further
+                       ; semantic details of mailbox names.
+
+   mailbox-data    =  "FLAGS" SP flag-list / "LIST" SP mailbox-list /
+                      "LSUB" SP mailbox-list / "SEARCH" *(SP nz-number) /
+                      "STATUS" SP mailbox SP "("
+                      [status-att SP number *(SP status-att SP number)] ")" /
+                      number SP "EXISTS" / number SP "RECENT"
+
+   mailbox-list    = "(" [mbx-list-flags] ")" SP
+                      (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox
+
+   mbx-list-flags  = *(mbx-list-oflag SP) mbx-list-sflag
+                     *(SP mbx-list-oflag) /
+                     mbx-list-oflag *(SP mbx-list-oflag)
+
+   mbx-list-oflag  = "\Noinferiors" / flag-extension
+                       ; Other flags; multiple possible per LIST response
+
+   mbx-list-sflag  = "\Noselect" / "\Marked" / "\Unmarked"
+                       ; Selectability flags; only one per LIST response
+
+   media-basic     = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / "MESSAGE" /
+                     "VIDEO") DQUOTE) / string) SP media-subtype
+                       ; Defined in [MIME-IMT]
+
+   media-message   = DQUOTE "MESSAGE" DQUOTE SP DQUOTE "RFC822" DQUOTE
+                       ; Defined in [MIME-IMT]
+
+   media-subtype   = string
+                       ; Defined in [MIME-IMT]
+
+   media-text      = DQUOTE "TEXT" DQUOTE SP media-subtype
+                       ; Defined in [MIME-IMT]
+
+   message-data    = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att))
+
+   msg-att         = "(" (msg-att-dynamic / msg-att-static)
+                      *(SP (msg-att-dynamic / msg-att-static)) ")"
+
+   msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")"
+                       ; MAY change for a message
+
+   msg-att-static  = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time /
+                     "RFC822" [".HEADER" / ".TEXT"] SP nstring /
+                     "RFC822.SIZE" SP number / "BODY" ["STRUCTURE"] SP body /
+                     "BODY" section ["<" number ">"] SP nstring /
+                     "UID" SP uniqueid
+                       ; MUST NOT change for a message
+
+   nil             = "NIL"
+
+   nstring         = string / nil
+
+   number          = 1*DIGIT
+                       ; Unsigned 32-bit integer
+                       ; (0 <= n < 4,294,967,296)
+
+   nz-number       = digit-nz *DIGIT
+                       ; Non-zero unsigned 32-bit integer
+                       ; (0 < n < 4,294,967,296)
+
+   password        = astring
+
+   quoted          = DQUOTE *QUOTED-CHAR DQUOTE
+
+   QUOTED-CHAR     = <any TEXT-CHAR except quoted-specials> /
+                     "\" quoted-specials
+
+   quoted-specials = DQUOTE / "\"
+
+   rename          = "RENAME" SP mailbox SP mailbox
+                       ; Use of INBOX as a destination gives a NO error
+
+   response        = *(continue-req / response-data) response-done
+
+   response-data   = "*" SP (resp-cond-state / resp-cond-bye /
+                     mailbox-data / message-data / capability-data) CRLF
+
+   response-done   = response-tagged / response-fatal
+
+   response-fatal  = "*" SP resp-cond-bye CRLF
+                       ; Server closes connection immediately
+
+   response-tagged = tag SP resp-cond-state CRLF
+
+   resp-cond-auth  = ("OK" / "PREAUTH") SP resp-text
+                       ; Authentication condition
+
+   resp-cond-bye   = "BYE" SP resp-text
+
+   resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text
+                       ; Status condition
+
+   resp-specials   = "]"
+
+   resp-text       = ["[" resp-text-code "]" SP] text
+
+   resp-text-code  = "ALERT" /
+                     "BADCHARSET" [SP "(" astring *(SP astring) ")" ] /
+                     capability-data / "PARSE" /
+                     "PERMANENTFLAGS" SP "(" [flag-perm *(SP flag-perm)] ")" /
+                     "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
+                     "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number /
+                     "UNSEEN" SP nz-number /
+                     atom [SP 1*<any TEXT-CHAR except "]">]
+
+   search          = "SEARCH" [SP "CHARSET" SP astring] 1*(SP search-key)
+                       ; CHARSET argument to MUST be registered with IANA
+
+   search-key      = "ALL" / "ANSWERED" / "BCC" SP astring /
+                     "BEFORE" SP date / "BODY" SP astring /
+                     "CC" SP astring / "DELETED" / "FLAGGED" /
+                     "FROM" SP astring / "KEYWORD" SP flag-keyword / "NEW" /
+                     "OLD" / "ON" SP date / "RECENT" / "SEEN" /
+                     "SINCE" SP date / "SUBJECT" SP astring /
+                     "TEXT" SP astring / "TO" SP astring /
+                     "UNANSWERED" / "UNDELETED" / "UNFLAGGED" /
+                     "UNKEYWORD" SP flag-keyword / "UNSEEN" /
+                       ; Above this line were in [IMAP2]
+                     "DRAFT" / "HEADER" SP header-fld-name SP astring /
+                     "LARGER" SP number / "NOT" SP search-key /
+                     "OR" SP search-key SP search-key /
+                     "SENTBEFORE" SP date / "SENTON" SP date /
+                     "SENTSINCE" SP date / "SMALLER" SP number /
+                     "UID" SP set / "UNDRAFT" / set /
+                     "(" search-key *(SP search-key) ")"
+
+   section         = "[" [section-spec] "]"
+
+   section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list /
+                     "TEXT"
+                       ; top-level or MESSAGE/RFC822 part
+
+   section-part    = nz-number *("." nz-number)
+                       ; body part nesting
+
+   section-spec    = section-msgtext / (section-part ["." section-text])
+
+   section-text    = section-msgtext / "MIME"
+                       ; text other than actual body part (headers, etc.)
+
+   select          = "SELECT" SP mailbox
+
+   sequence-num    = nz-number / "*"
+                       ; * is the largest number in use.  For message
+                       ; sequence numbers, it is the number of messages
+                       ; in the mailbox.  For unique identifiers, it is
+                       ; the unique identifier of the last message in
+                       ; the mailbox.
+
+   set             = sequence-num / (sequence-num ":" sequence-num) /
+                     (set "," set)
+                       ; Identifies a set of messages.  For message
+                       ; sequence numbers, these are consecutive
+                       ; numbers from 1 to the number of messages in
+                       ; the mailbox
+                       ; Comma delimits individual numbers, colon
+                       ; delimits between two numbers inclusive.
+                       ; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13,
+                       ; 14,15 for a mailbox with 15 messages.
+
+
+   status          = "STATUS" SP mailbox SP "(" status-att *(SP status-att) ")"
+
+   status-att      = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" /
+                     "UNSEEN"
+
+   store           = "STORE" SP set SP store-att-flags
+
+   store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP
+                     (flag-list / (flag *(SP flag)))
+
+   string          = quoted / literal
+
+   subscribe       = "SUBSCRIBE" SP mailbox
+
+   tag             = 1*<any ASTRING-CHAR except "+">
+
+   text            = 1*TEXT-CHAR
+
+   TEXT-CHAR       = <any CHAR except CR and LF>
+
+   time            = 2DIGIT ":" 2DIGIT ":" 2DIGIT
+                       ; Hours minutes seconds
+
+   uid             = "UID" SP (copy / fetch / search / store)
+                       ; Unique identifiers used instead of message
+                       ; sequence numbers
+
+   uniqueid        = nz-number
+                       ; Strictly ascending
+
+   unsubscribe     = "UNSUBSCRIBE" SP mailbox
+
+   userid          = astring
+
+   x-command       = "X" atom <experimental command arguments>
+
+   zone            = ("+" / "-") 4DIGIT
+                       ; Signed four-digit value of hhmm representing
+                       ; hours and minutes east of Greenwich (that is,
+                       ; the amount that the given time differs from
+                       ; Universal Time).  Subtracting the timezone
+                       ; from the given time will give the UT form.
+                       ; The Universal Time zone is "+0000".
+*/
+
+
+#ifndef MAILIMAP_TYPES_H
+
+#define MAILIMAP_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailstream.h>
+#include <libetpan/clist.h>
+#include <stdbool.h>
+
+
+/*
+  IMPORTANT NOTE:
+  
+  All allocation functions will take as argument allocated data
+  and will store these data in the structure they will allocate.
+  Data should be persistant during all the use of the structure
+  and will be freed by the free function of the structure
+
+  allocation functions will return NULL on failure
+*/
+
+
+/*
+  mailimap_address represents a mail address
+
+  - personal_name is the name to display in an address
+    '"name"' in '"name" <address@domain>', should be allocated
+    with a malloc()
+  
+  - source_route is the source-route information in the
+    mail address (RFC 822), should be allocated with a malloc()
+
+  - mailbox_name is the name of the mailbox 'address' in
+    '"name" <address@domain>', should be allocated with a malloc()
+
+  - host_name is the name of the host 'domain' in
+    '"name" <address@domain>', should be allocated with a malloc()
+
+  if mailbox_name is not NULL and host_name is NULL, this is the name
+  of a group, the next addresses in the list are elements of the group
+  until we reach an address with a NULL mailbox_name.
+*/
+
+struct mailimap_address {
+  char * ad_personal_name; /* can be NULL */
+  char * ad_source_route;  /* can be NULL */
+  char * ad_mailbox_name;  /* can be NULL */
+  char * ad_host_name;     /* can be NULL */
+};
+
+
+LIBETPAN_EXPORT
+struct mailimap_address *
+mailimap_address_new(char * ad_personal_name, char * ad_source_route,
+		     char * ad_mailbox_name, char * ad_host_name);
+
+LIBETPAN_EXPORT
+void mailimap_address_free(struct mailimap_address * addr);
+
+
+/* this is the type of MIME body parsed by IMAP server */
+
+enum {
+  MAILIMAP_BODY_ERROR,
+  MAILIMAP_BODY_1PART, /* single part */
+  MAILIMAP_BODY_MPART  /* multi-part */
+};
+
+/*
+  mailimap_body represent a MIME body parsed by IMAP server
+
+  - type is the type of the MIME part (single part or multipart)
+
+  - body_1part is defined if this is a single part
+
+  - body_mpart is defined if this is a multipart
+*/
+
+struct mailimap_body {
+  int bd_type;
+  /* can be MAILIMAP_BODY_1PART or MAILIMAP_BODY_MPART */
+  union {
+    struct mailimap_body_type_1part * bd_body_1part; /* can be NULL */
+    struct mailimap_body_type_mpart * bd_body_mpart; /* can be NULL */
+  } bd_data;
+};
+
+
+LIBETPAN_EXPORT
+struct mailimap_body *
+mailimap_body_new(int bd_type,
+		  struct mailimap_body_type_1part * bd_body_1part,
+		  struct mailimap_body_type_mpart * bd_body_mpart);
+
+LIBETPAN_EXPORT
+void mailimap_body_free(struct mailimap_body * body);
+
+
+
+/*
+  this is the type of MIME body extension
+*/
+
+enum {
+  MAILIMAP_BODY_EXTENSION_ERROR,
+  MAILIMAP_BODY_EXTENSION_NSTRING, /* string */
+  MAILIMAP_BODY_EXTENSION_NUMBER,  /* number */
+  MAILIMAP_BODY_EXTENSION_LIST     /* list of
+                                      (struct mailimap_body_extension *) */
+};
+
+/*
+  mailimap_body_extension is a future extension header field value
+
+  - type is the type of the body extension (string, number or
+    list of extension)
+
+  - nstring is a string value if the type is string
+
+  - number is a integer value if the type is number
+
+  - list is a list of body extension if the type is a list
+*/
+
+struct mailimap_body_extension {
+  int ext_type;
+  /*
+    can be MAILIMAP_BODY_EXTENSION_NSTRING, MAILIMAP_BODY_EXTENSION_NUMBER
+    or MAILIMAP_BODY_EXTENSION_LIST
+  */
+  union {
+    char * ext_nstring;    /* can be NULL */
+    uint32_t ext_number;
+    clist * ext_body_extension_list;
+    /* list of (struct mailimap_body_extension *) */
+    /* can be NULL */
+  } ext_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_extension *
+mailimap_body_extension_new(int ext_type, char * ext_nstring,
+    uint32_t ext_number,
+    clist * ext_body_extension_list);
+
+LIBETPAN_EXPORT
+void mailimap_body_extension_free(struct mailimap_body_extension * be);
+
+
+/*
+  mailimap_body_ext_1part is the extended result part of a single part
+  bodystructure.
+  
+  - body_md5 is the value of the Content-MD5 header field, should be 
+    allocated with malloc()
+
+  - body_disposition is the value of the Content-Disposition header field
+
+  - body_language is the value of the Content-Language header field
+  
+  - body_extension_list is the list of extension fields value.
+*/
+
+struct mailimap_body_ext_1part {
+  char * bd_md5;   /* can be NULL */
+  struct mailimap_body_fld_dsp * bd_disposition; /* can be NULL */
+  struct mailimap_body_fld_lang * bd_language;   /* can be NULL */
+  char * bd_loc; /* can be NULL */
+  
+  clist * bd_extension_list; /* list of (struct mailimap_body_extension *) */
+                               /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_ext_1part *
+mailimap_body_ext_1part_new(char * bd_md5,
+			    struct mailimap_body_fld_dsp * bd_disposition,
+			    struct mailimap_body_fld_lang * bd_language,
+          char * bd_loc,
+			    clist * bd_extension_list);
+
+
+LIBETPAN_EXPORT
+void
+mailimap_body_ext_1part_free(struct mailimap_body_ext_1part * body_ext_1part);
+
+
+/*
+  mailimap_body_ext_mpart is the extended result part of a multipart
+  bodystructure.
+
+  - body_parameter is the list of parameters of Content-Type header field
+  
+  - body_disposition is the value of Content-Disposition header field
+
+  - body_language is the value of Content-Language header field
+
+  - body_extension_list is the list of extension fields value.
+*/
+
+struct mailimap_body_ext_mpart {
+  struct mailimap_body_fld_param * bd_parameter; /* can be NULL */
+  struct mailimap_body_fld_dsp * bd_disposition; /* can be NULL */
+  struct mailimap_body_fld_lang * bd_language;   /* can be NULL */
+  char * bd_loc; /* can be NULL */
+  clist * bd_extension_list; /* list of (struct mailimap_body_extension *) */
+                               /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_ext_mpart *
+mailimap_body_ext_mpart_new(struct mailimap_body_fld_param * bd_parameter,
+			    struct mailimap_body_fld_dsp * bd_disposition,
+			    struct mailimap_body_fld_lang * bd_language,
+          char * bd_loc,
+			    clist * bd_extension_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_ext_mpart_free(struct mailimap_body_ext_mpart * body_ext_mpart);
+
+
+/*
+  mailimap_body_fields is the MIME fields of a MIME part.
+  
+  - body_parameter is the list of parameters of Content-Type header field
+
+  - body_id is the value of Content-ID header field, should be allocated
+    with malloc()
+
+  - body_description is the value of Content-Description header field,
+    should be allocated with malloc()
+
+  - body_encoding is the value of Content-Transfer-Encoding header field
+  
+  - body_disposition is the value of Content-Disposition header field
+
+  - body_size is the size of the MIME part
+*/
+
+struct mailimap_body_fields {
+  struct mailimap_body_fld_param * bd_parameter; /* can be NULL */
+  char * bd_id;                                  /* can be NULL */
+  char * bd_description;                         /* can be NULL */
+  struct mailimap_body_fld_enc * bd_encoding;    /* != NULL */
+  uint32_t bd_size;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_fields *
+mailimap_body_fields_new(struct mailimap_body_fld_param * bd_parameter,
+			 char * bd_id,
+			 char * bd_description,
+			 struct mailimap_body_fld_enc * bd_encoding,
+			 uint32_t bd_size);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_fields_free(struct mailimap_body_fields * body_fields);
+
+
+
+/*
+  mailimap_body_fld_dsp is the parsed value of the Content-Disposition field
+
+  - disposition_type is the type of Content-Disposition
+    (usually attachment or inline), should be allocated with malloc()
+
+  - attributes is the list of Content-Disposition attributes
+*/
+
+struct mailimap_body_fld_dsp {
+  char * dsp_type;                     /* != NULL */
+  struct mailimap_body_fld_param * dsp_attributes; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_fld_dsp *
+mailimap_body_fld_dsp_new(char * dsp_type,
+    struct mailimap_body_fld_param * dsp_attributes);
+
+LIBETPAN_EXPORT
+void mailimap_body_fld_dsp_free(struct mailimap_body_fld_dsp * bfd);
+
+
+
+/* these are the different parsed values for Content-Transfer-Encoding */
+
+enum {
+  MAILIMAP_BODY_FLD_ENC_7BIT,             /* 7bit */
+  MAILIMAP_BODY_FLD_ENC_8BIT,             /* 8bit */
+  MAILIMAP_BODY_FLD_ENC_BINARY,           /* binary */
+  MAILIMAP_BODY_FLD_ENC_BASE64,           /* base64 */
+  MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE, /* quoted-printable */
+  MAILIMAP_BODY_FLD_ENC_OTHER             /* other */
+};
+
+/*
+  mailimap_body_fld_enc is a parsed value for Content-Transfer-Encoding
+
+  - type is the kind of Content-Transfer-Encoding, this can be
+    MAILIMAP_BODY_FLD_ENC_7BIT, MAILIMAP_BODY_FLD_ENC_8BIT,
+    MAILIMAP_BODY_FLD_ENC_BINARY, MAILIMAP_BODY_FLD_ENC_BASE64,
+    MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE or MAILIMAP_BODY_FLD_ENC_OTHER
+
+  - in case of MAILIMAP_BODY_FLD_ENC_OTHER, this value is defined,
+    should be allocated with malloc()
+*/
+
+struct mailimap_body_fld_enc {
+  int enc_type;
+  char * enc_value; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_fld_enc *
+mailimap_body_fld_enc_new(int enc_type, char * enc_value);
+
+LIBETPAN_EXPORT
+void mailimap_body_fld_enc_free(struct mailimap_body_fld_enc * bfe);
+
+
+/* this is the type of Content-Language header field value */
+
+enum {
+  MAILIMAP_BODY_FLD_LANG_ERROR,  /* error parse */
+  MAILIMAP_BODY_FLD_LANG_SINGLE, /* single value */
+  MAILIMAP_BODY_FLD_LANG_LIST    /* list of values */
+};
+
+/*
+  mailimap_body_fld_lang is the parsed value of the Content-Language field
+
+  - type is the type of content, this can be MAILIMAP_BODY_FLD_LANG_SINGLE
+    if this is a single value or MAILIMAP_BODY_FLD_LANG_LIST if there are
+    several values
+
+  - single is the single value if the type is MAILIMAP_BODY_FLD_LANG_SINGLE,
+    should be allocated with malloc()
+
+  - list is the list of value if the type is MAILIMAP_BODY_FLD_LANG_LIST,
+    all elements of the list should be allocated with malloc()
+*/
+
+struct mailimap_body_fld_lang {
+  int lg_type;
+  union {
+    char * lg_single; /* can be NULL */
+    clist * lg_list; /* list of string (char *), can be NULL */
+  } lg_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_fld_lang *
+mailimap_body_fld_lang_new(int lg_type, char * lg_single, clist * lg_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_fld_lang_free(struct mailimap_body_fld_lang * fld_lang);
+
+
+
+/*
+  mailimap_single_body_fld_param is a body field parameter
+  
+  - name is the name of the parameter, should be allocated with malloc()
+  
+  - value is the value of the parameter, should be allocated with malloc()
+*/
+
+struct mailimap_single_body_fld_param {
+  char * pa_name;  /* != NULL */
+  char * pa_value; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_single_body_fld_param *
+mailimap_single_body_fld_param_new(char * pa_name, char * pa_value);
+
+LIBETPAN_EXPORT
+void
+mailimap_single_body_fld_param_free(struct mailimap_single_body_fld_param * p);
+
+
+/*
+  mailmap_body_fld_param is a list of parameters
+  
+  - list is the list of parameters.
+*/
+
+struct mailimap_body_fld_param {
+  clist * pa_list; /* list of (struct mailimap_single_body_fld_param *) */
+                /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_fld_param *
+mailimap_body_fld_param_new(clist * pa_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_fld_param_free(struct mailimap_body_fld_param * fld_param);
+
+
+/*
+  this is the kind of single part: a text part
+  (when Content-Type is text/xxx), a message part (when Content-Type is
+  message/rfc2822) or a basic part (others than multpart/xxx)
+*/
+
+enum {
+  MAILIMAP_BODY_TYPE_1PART_ERROR, /* parse error */
+  MAILIMAP_BODY_TYPE_1PART_BASIC, /* others then multipart/xxx */
+  MAILIMAP_BODY_TYPE_1PART_MSG,   /* message/rfc2822 */
+  MAILIMAP_BODY_TYPE_1PART_TEXT   /* text/xxx */
+};
+
+
+/*
+  mailimap_body_type_1part is 
+
+  - type is the kind of single part, this can be
+  MAILIMAP_BODY_TYPE_1PART_BASIC, MAILIMAP_BODY_TYPE_1PART_MSG or
+  MAILIMAP_BODY_TYPE_1PART_TEXT.
+
+  - body_type_basic is the basic part when type is
+    MAILIMAP_BODY_TYPE_1PART_BASIC
+
+  - body_type_msg is the message part when type is
+    MAILIMAP_BODY_TYPE_1PART_MSG
+    
+  - body_type_text is the text part when type is
+    MAILIMAP_BODY_TYPE_1PART_TEXT
+*/
+
+struct mailimap_body_type_1part {
+  int bd_type;
+  union {
+    struct mailimap_body_type_basic * bd_type_basic; /* can be NULL */
+    struct mailimap_body_type_msg * bd_type_msg;     /* can be NULL */
+    struct mailimap_body_type_text * bd_type_text;   /* can be NULL */
+  } bd_data;
+  struct mailimap_body_ext_1part * bd_ext_1part;   /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_type_1part *
+mailimap_body_type_1part_new(int bd_type,
+    struct mailimap_body_type_basic * bd_type_basic,
+    struct mailimap_body_type_msg * bd_type_msg,
+    struct mailimap_body_type_text * bd_type_text,
+    struct mailimap_body_ext_1part * bd_ext_1part);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_type_1part_free(struct mailimap_body_type_1part * bt1p);
+
+
+
+/*
+  mailimap_body_type_basic is a basic field (with Content-Type other
+  than multipart/xxx, message/rfc2822 and text/xxx
+
+  - media_basic will be the MIME type of the part
+  
+  - body_fields will be the parsed fields of the MIME part
+*/
+
+struct mailimap_body_type_basic {
+  struct mailimap_media_basic * bd_media_basic; /* != NULL */
+  struct mailimap_body_fields * bd_fields; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_type_basic *
+mailimap_body_type_basic_new(struct mailimap_media_basic * bd_media_basic,
+			     struct mailimap_body_fields * bd_fields);
+
+LIBETPAN_EXPORT
+void mailimap_body_type_basic_free(struct mailimap_body_type_basic *
+				   body_type_basic);
+
+/*
+  mailimap_body_type_mpart is a MIME multipart.
+
+  - body_list is the list of sub-parts.
+
+  - media_subtype is the subtype of the multipart (for example
+    in multipart/alternative, this is "alternative")
+    
+  - body_ext_mpart is the extended fields of the MIME multipart
+*/
+
+struct mailimap_body_type_mpart {
+  clist * bd_list; /* list of (struct mailimap_body *) */
+                     /* != NULL */
+  char * bd_media_subtype; /* != NULL */
+  struct mailimap_body_ext_mpart * bd_ext_mpart; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_type_mpart *
+mailimap_body_type_mpart_new(clist * bd_list, char * bd_media_subtype,
+    struct mailimap_body_ext_mpart * bd_ext_mpart);
+
+LIBETPAN_EXPORT
+void mailimap_body_type_mpart_free(struct mailimap_body_type_mpart *
+    body_type_mpart);
+
+/*
+  mailimap_body_type_msg is a MIME message part
+
+  - body_fields is the MIME fields of the MIME message part
+
+  - envelope is the list of parsed RFC 822 fields of the MIME message
+
+  - body is the sub-part of the message
+
+  - body_lines is the number of lines of the message part
+*/
+
+struct mailimap_body_type_msg {
+  struct mailimap_body_fields * bd_fields; /* != NULL */
+  struct mailimap_envelope * bd_envelope;       /* != NULL */
+  struct mailimap_body * bd_body;               /* != NULL */
+  uint32_t bd_lines;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_type_msg *
+mailimap_body_type_msg_new(struct mailimap_body_fields * bd_fields,
+			   struct mailimap_envelope * bd_envelope,
+			   struct mailimap_body * bd_body,
+			   uint32_t bd_lines);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_type_msg_free(struct mailimap_body_type_msg * body_type_msg);
+
+
+
+/*
+  mailimap_body_type_text is a single MIME part where Content-Type is text/xxx
+
+  - media-text is the subtype of the text part (for example, in "text/plain",
+    this is "plain", should be allocated with malloc()
+
+  - body_fields is the MIME fields of the MIME message part
+
+  - body_lines is the number of lines of the message part
+*/
+
+struct mailimap_body_type_text {
+  char * bd_media_text;                         /* != NULL */
+  struct mailimap_body_fields * bd_fields; /* != NULL */
+  uint32_t bd_lines;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_body_type_text *
+mailimap_body_type_text_new(char * bd_media_text,
+    struct mailimap_body_fields * bd_fields,
+    uint32_t bd_lines);
+
+LIBETPAN_EXPORT
+void
+mailimap_body_type_text_free(struct mailimap_body_type_text * body_type_text);
+
+
+
+/* this is the type of capability field */
+
+enum {
+  MAILIMAP_CAPABILITY_AUTH_TYPE, /* when the capability is an
+                                      authentication type */
+  MAILIMAP_CAPABILITY_NAME       /* other type of capability */
+};
+
+/*
+  mailimap_capability is a capability of the IMAP server
+
+  - type is the type of capability, this is either a authentication type
+    (MAILIMAP_CAPABILITY_AUTH_TYPE) or an other type of capability
+    (MAILIMAP_CAPABILITY_NAME)
+
+  - auth_type is a type of authentication "name" in "AUTH=name",
+    auth_type can be for example "PLAIN", when this is an authentication type,
+    should be allocated with malloc()
+
+  - name is a type of capability when this is not an authentication type,
+    should be allocated with malloc()
+*/
+
+struct mailimap_capability {
+  int cap_type;
+  union {
+    char * cap_auth_type; /* can be NULL */
+    char * cap_name;      /* can be NULL */
+  } cap_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_capability *
+mailimap_capability_new(int cap_type, char * cap_auth_type, char * cap_name);
+
+LIBETPAN_EXPORT
+void mailimap_capability_free(struct mailimap_capability * c);
+
+
+
+
+/*
+  mailimap_capability_data is a list of capability
+
+  - list is the list of capability
+*/
+
+struct mailimap_capability_data {
+  clist * cap_list; /* list of (struct mailimap_capability *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_capability_data *
+mailimap_capability_data_new(clist * cap_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_capability_data_free(struct mailimap_capability_data * cap_data);
+
+
+
+/* this is the type of continue request data */
+
+enum {
+  MAILIMAP_CONTINUE_REQ_ERROR,  /* on parse error */ 
+  MAILIMAP_CONTINUE_REQ_TEXT,   /* when data is a text response */
+  MAILIMAP_CONTINUE_REQ_BASE64  /* when data is a base64 response */
+};
+
+/*
+  mailimap_continue_req is a continue request (a response prefixed by "+")
+
+  - type is the type of continue request response
+    MAILIMAP_CONTINUE_REQ_TEXT (when information data is text),
+    MAILIMAP_CONTINUE_REQ_BASE64 (when information data is base64)
+  
+  - text is the information of type text in case of text data
+
+  - base64 is base64 encoded data in the other case, should be allocated
+    with malloc()
+*/
+
+struct mailimap_continue_req {
+  int cr_type;
+  union {
+    struct mailimap_resp_text * cr_text; /* can be NULL */
+    char * cr_base64;                    /* can be NULL */
+  } cr_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_continue_req *
+mailimap_continue_req_new(int cr_type, struct mailimap_resp_text * cr_text,
+			  char * cr_base64);
+
+LIBETPAN_EXPORT
+void mailimap_continue_req_free(struct mailimap_continue_req * cont_req);
+
+
+/*
+  mailimap_date_time is a date
+  
+  - day is the day of month (1 to 31)
+
+  - month (1 to 12)
+
+  - year (4 digits)
+
+  - hour (0 to 23)
+  
+  - min (0 to 59)
+
+  - sec (0 to 59)
+
+  - zone (this is the decimal value that we can read, for example:
+    for "-0200", the value is -200)
+*/
+
+struct mailimap_date_time {
+  int dt_day;
+  int dt_month;
+  int dt_year;
+  int dt_hour;
+  int dt_min;
+  int dt_sec;
+  int dt_zone;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_date_time *
+mailimap_date_time_new(int dt_day, int dt_month, int dt_year, int dt_hour,
+		       int dt_min, int dt_sec, int dt_zone);
+
+LIBETPAN_EXPORT
+void mailimap_date_time_free(struct mailimap_date_time * date_time);
+
+
+
+/*
+  mailimap_envelope is the list of fields that can be parsed by
+  the IMAP server.
+
+  - date is the (non-parsed) content of the "Date" header field,
+    should be allocated with malloc()
+  
+  - subject is the subject of the message, should be allocated with
+    malloc()
+  
+  - sender is the the parsed content of the "Sender" field
+
+  - reply-to is the parsed content of the "Reply-To" field
+
+  - to is the parsed content of the "To" field
+
+  - cc is the parsed content of the "Cc" field
+  
+  - bcc is the parsed content of the "Bcc" field
+  
+  - in_reply_to is the content of the "In-Reply-To" field,
+    should be allocated with malloc()
+
+  - message_id is the content of the "Message-ID" field,
+    should be allocated with malloc()
+*/
+
+struct mailimap_envelope {
+  char * env_date;                             /* can be NULL */
+  char * env_subject;                          /* can be NULL */
+  struct mailimap_env_from * env_from;         /* can be NULL */
+  struct mailimap_env_sender * env_sender;     /* can be NULL */
+  struct mailimap_env_reply_to * env_reply_to; /* can be NULL */
+  struct mailimap_env_to * env_to;             /* can be NULL */
+  struct mailimap_env_cc * env_cc;             /* can be NULL */
+  struct mailimap_env_bcc * env_bcc;           /* can be NULL */
+  char * env_in_reply_to;                      /* can be NULL */
+  char * env_message_id;                       /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_envelope *
+mailimap_envelope_new(char * env_date, char * env_subject,
+		      struct mailimap_env_from * env_from,
+		      struct mailimap_env_sender * env_sender,
+		      struct mailimap_env_reply_to * env_reply_to,
+		      struct mailimap_env_to * env_to,
+		      struct mailimap_env_cc* env_cc,
+		      struct mailimap_env_bcc * env_bcc,
+		      char * env_in_reply_to, char * env_message_id);
+
+LIBETPAN_EXPORT
+void mailimap_envelope_free(struct mailimap_envelope * env);
+
+
+
+/*
+  mailimap_env_bcc is the parsed "Bcc" field
+  
+  - list is the list of addresses
+*/
+
+struct mailimap_env_bcc {
+  clist * bcc_list; /* list of (struct mailimap_address *), can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_env_bcc * mailimap_env_bcc_new(clist * bcc_list);
+
+LIBETPAN_EXPORT
+void mailimap_env_bcc_free(struct mailimap_env_bcc * env_bcc);
+
+
+/*
+  mailimap_env_cc is the parsed "Cc" field
+  
+  - list is the list of addresses
+*/
+
+struct mailimap_env_cc {
+  clist * cc_list; /* list of (struct mailimap_address *), can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_env_cc * mailimap_env_cc_new(clist * cc_list);
+
+LIBETPAN_EXPORT
+void mailimap_env_cc_free(struct mailimap_env_cc * env_cc);
+
+
+
+/*
+  mailimap_env_from is the parsed "From" field
+  
+  - list is the list of addresses
+*/
+
+struct mailimap_env_from {
+  clist * frm_list; /* list of (struct mailimap_address *) */
+                /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_env_from * mailimap_env_from_new(clist * frm_list);
+
+LIBETPAN_EXPORT
+void mailimap_env_from_free(struct mailimap_env_from * env_from);
+
+
+
+/*
+  mailimap_env_reply_to is the parsed "Reply-To" field
+  
+  - list is the list of addresses
+*/
+
+struct mailimap_env_reply_to {
+  clist * rt_list; /* list of (struct mailimap_address *), can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_env_reply_to * mailimap_env_reply_to_new(clist * rt_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_env_reply_to_free(struct mailimap_env_reply_to * env_reply_to);
+
+
+
+/*
+  mailimap_env_sender is the parsed "Sender" field
+  
+  - list is the list of addresses
+*/
+
+struct mailimap_env_sender {
+  clist * snd_list; /* list of (struct mailimap_address *), can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_env_sender * mailimap_env_sender_new(clist * snd_list);
+
+LIBETPAN_EXPORT
+void mailimap_env_sender_free(struct mailimap_env_sender * env_sender);
+
+
+
+/*
+  mailimap_env_to is the parsed "To" field
+  
+  - list is the list of addresses
+*/
+
+struct mailimap_env_to {
+  clist * to_list; /* list of (struct mailimap_address *), can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_env_to * mailimap_env_to_new(clist * to_list);
+
+LIBETPAN_EXPORT
+void mailimap_env_to_free(struct mailimap_env_to * env_to);
+
+
+/* this is the type of flag */
+
+enum {
+  MAILIMAP_FLAG_ANSWERED,  /* \Answered flag */
+  MAILIMAP_FLAG_FLAGGED,   /* \Flagged flag */
+  MAILIMAP_FLAG_DELETED,   /* \Deleted flag */
+  MAILIMAP_FLAG_SEEN,      /* \Seen flag */
+  MAILIMAP_FLAG_DRAFT,     /* \Draft flag */
+  MAILIMAP_FLAG_KEYWORD,   /* keyword flag */
+  MAILIMAP_FLAG_EXTENSION  /* \extension flag */
+};
+
+
+/*
+  mailimap_flag is a message flag (that we can associate with a message)
+  
+  - type is the type of the flag, MAILIMAP_FLAG_XXX
+
+  - keyword is the flag when the flag is of keyword type,
+    should be allocated with malloc()
+  
+  - extension is the flag when the flag is of extension type, should be
+    allocated with malloc()
+*/
+
+struct mailimap_flag {
+  int fl_type;
+  union {
+    char * fl_keyword;   /* can be NULL */
+    char * fl_extension; /* can be NULL */
+  } fl_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new(int fl_type,
+    char * fl_keyword, char * fl_extension);
+
+LIBETPAN_EXPORT
+void mailimap_flag_free(struct mailimap_flag * f);
+
+
+
+
+/* this is the type of flag */
+
+enum {
+  MAILIMAP_FLAG_FETCH_ERROR,  /* on parse error */
+  MAILIMAP_FLAG_FETCH_RECENT, /* \Recent flag */
+  MAILIMAP_FLAG_FETCH_OTHER   /* other type of flag */
+};
+
+/*
+  mailimap_flag_fetch is a message flag (when we fetch it)
+
+  - type is the type of flag fetch
+  
+  - flag is the flag when this is not a \Recent flag
+*/
+
+struct mailimap_flag_fetch {
+  int fl_type;
+  struct mailimap_flag * fl_flag; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_flag_fetch *
+mailimap_flag_fetch_new(int fl_type, struct mailimap_flag * fl_flag);
+
+LIBETPAN_EXPORT
+void mailimap_flag_fetch_free(struct mailimap_flag_fetch * flag_fetch);
+
+
+
+
+/* this is the type of flag */
+
+enum {
+  MAILIMAP_FLAG_PERM_ERROR, /* on parse error */
+  MAILIMAP_FLAG_PERM_FLAG,  /* to specify that usual flags can be changed */
+  MAILIMAP_FLAG_PERM_ALL    /* to specify that new flags can be created */
+};
+
+
+/*
+  mailimap_flag_perm is a flag returned in case of PERMANENTFLAGS response
+  
+  - type is the type of returned PERMANENTFLAGS, it can be
+    MAILIMAP_FLAG_PERM_FLAG (the given flag can be changed permanently) or
+    MAILIMAP_FLAG_PERM_ALL (new flags can be created)
+  
+  - flag is the given flag when type is MAILIMAP_FLAG_PERM_FLAG
+*/
+
+struct mailimap_flag_perm {
+  int fl_type;
+  struct mailimap_flag * fl_flag; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_flag_perm *
+mailimap_flag_perm_new(int fl_type, struct mailimap_flag * fl_flag);
+
+LIBETPAN_EXPORT
+void mailimap_flag_perm_free(struct mailimap_flag_perm * flag_perm);
+
+
+/*
+  mailimap_flag_list is a list of flags
+  
+  - list is a list of flags
+*/
+
+struct mailimap_flag_list {
+  clist * fl_list; /* list of (struct mailimap_flag *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_flag_list *
+mailimap_flag_list_new(clist * fl_list);
+
+LIBETPAN_EXPORT
+void mailimap_flag_list_free(struct mailimap_flag_list * flag_list);
+
+
+
+
+/* this is the type of greeting response */
+
+enum {
+  MAILIMAP_GREETING_RESP_COND_ERROR, /* on parse error */
+  MAILIMAP_GREETING_RESP_COND_AUTH,  /* when connection is accepted */
+  MAILIMAP_GREETING_RESP_COND_BYE    /* when connection is refused */
+};
+
+/*
+  mailimap_greeting is the response returned on connection
+
+  - type is the type of response on connection, either
+  MAILIMAP_GREETING_RESP_COND_AUTH if connection is accepted or
+  MAIMIMAP_GREETING_RESP_COND_BYE if connection is refused
+*/
+
+struct mailimap_greeting {
+  int gr_type;
+  union {
+    struct mailimap_resp_cond_auth * gr_auth; /* can be NULL */
+    struct mailimap_resp_cond_bye * gr_bye;   /* can be NULL */
+  } gr_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_greeting *
+mailimap_greeting_new(int gr_type,
+    struct mailimap_resp_cond_auth * gr_auth,
+    struct mailimap_resp_cond_bye * gr_bye);
+
+LIBETPAN_EXPORT
+void mailimap_greeting_free(struct mailimap_greeting * greeting);
+
+
+/*
+  mailimap_header_list is a list of headers that can be specified when
+  we want to fetch fields
+
+  - list is a list of header names, each header name should be allocated
+    with malloc()
+*/
+
+struct mailimap_header_list {
+  clist * hdr_list; /* list of astring (char *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_header_list *
+mailimap_header_list_new(clist * hdr_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_header_list_free(struct mailimap_header_list * header_list);
+
+
+
+/* this is the type of mailbox STATUS that can be returned */
+
+enum {
+  MAILIMAP_STATUS_ATT_MESSAGES,      /* when requesting the number of
+                                        messages */
+  MAILIMAP_STATUS_ATT_RECENT,        /* when requesting the number of
+                                        recent messages */
+  MAILIMAP_STATUS_ATT_UIDNEXT,       /* when requesting the next unique
+                                        identifier */
+  MAILIMAP_STATUS_ATT_UIDVALIDITY,   /* when requesting the validity of
+                                        message unique identifiers*/
+  MAILIMAP_STATUS_ATT_UNSEEN,        /* when requesting the number of
+                                        unseen messages */
+  MAILIMAP_STATUS_ATT_HIGHESTMODSEQ, /* when requesting the highest
+                                        mod-sequence value of all messages in
+                                        the mailbox */
+  MAILIMAP_STATUS_ATT_EXTENSION
+};
+
+/*
+  mailimap_status_info is a returned information when a STATUS of 
+  a mailbox is requested
+
+  - att is the type of mailbox STATUS, the value can be 
+    MAILIMAP_STATUS_ATT_MESSAGES, MAILIMAP_STATUS_ATT_RECENT,
+    MAILIMAP_STATUS_ATT_UIDNEXT, MAILIMAP_STATUS_ATT_UIDVALIDITY,
+    MAILIMAP_STATUS_ATT_UNSEEN or MAILIMAP_STATUS_ATT_EXTENSION
+
+  - value is the value of the given information
+  
+  - st_ext_data is the data of the extension.
+*/
+
+struct mailimap_status_info {
+  int st_att;
+  uint32_t st_value;
+  struct mailimap_extension_data * st_ext_data; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_status_info *
+  mailimap_status_info_new(int st_att, uint32_t st_value,
+  struct mailimap_extension_data * st_ext_data);
+
+LIBETPAN_EXPORT
+void mailimap_status_info_free(struct mailimap_status_info * info);
+
+
+
+/*
+  mailimap_mailbox_data_status is the list of information returned
+  when a STATUS of a mailbox is requested
+
+  - mailbox is the name of the mailbox, should be allocated with malloc()
+  
+  - status_info_list is the list of information returned
+*/
+
+struct mailimap_mailbox_data_status {
+  char * st_mailbox;
+  clist * st_info_list; /* list of (struct mailimap_status_info *) */
+                            /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_mailbox_data_status *
+mailimap_mailbox_data_status_new(char * st_mailbox,
+    clist * st_info_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_mailbox_data_status_free(struct mailimap_mailbox_data_status * info);
+
+
+
+/* this is the type of mailbox information that is returned */
+
+enum {
+  MAILIMAP_MAILBOX_DATA_ERROR,  /* on parse error */
+  MAILIMAP_MAILBOX_DATA_FLAGS,  /* flag that are applicable to the mailbox */
+  MAILIMAP_MAILBOX_DATA_LIST,   /* this is a mailbox in the list of mailboxes
+                                   returned on LIST command*/
+  MAILIMAP_MAILBOX_DATA_LSUB,   /* this is a mailbox in the list of
+                                   subscribed mailboxes returned on LSUB
+                                   command */
+  MAILIMAP_MAILBOX_DATA_SEARCH, /* this is a list of messages numbers or
+                                   unique identifiers returned
+                                   on a SEARCH command*/
+  MAILIMAP_MAILBOX_DATA_STATUS, /* this is the list of information returned
+                                   on a STATUS command */
+  MAILIMAP_MAILBOX_DATA_EXISTS, /* this is the number of messages in the
+                                   mailbox */
+  MAILIMAP_MAILBOX_DATA_RECENT, /* this is the number of recent messages
+                                   in the mailbox */
+  MAILIMAP_MAILBOX_DATA_EXTENSION_DATA  /* this mailbox-data stores data
+                                           returned by an extension */
+};
+
+/*
+  mailimap_mailbox_data is an information related to a mailbox
+  
+  - type is the type of mailbox_data that is filled, the value of this field
+    can be MAILIMAP_MAILBOX_DATA_FLAGS, MAILIMAP_MAILBOX_DATA_LIST,
+    MAILIMAP_MAILBOX_DATA_LSUB, MAILIMAP_MAILBOX_DATA_SEARCH,
+    MAILIMAP_MAILBOX_DATA_STATUS, MAILIMAP_MAILBOX_DATA_EXISTS
+    or MAILIMAP_MAILBOX_DATA_RECENT.
+
+  - flags is the flags that are applicable to the mailbox when
+    type is MAILIMAP_MAILBOX_DATA_FLAGS
+
+  - list is a mailbox in the list of mailboxes returned on LIST command
+    when type is MAILIMAP_MAILBOX_DATA_LIST
+
+  - lsub is a mailbox in the list of subscribed mailboxes returned on
+    LSUB command when type is MAILIMAP_MAILBOX_DATA_LSUB
+
+  - search is a list of messages numbers or unique identifiers returned
+    on SEARCH command when type MAILIMAP_MAILBOX_DATA_SEARCH, each element
+    should be allocated with malloc()
+
+  - status is a list of information returned on STATUS command when
+    type is MAILIMAP_MAILBOX_DATA_STATUS
+
+  - exists is the number of messages in the mailbox when type
+    is MAILIMAP_MAILBOX_DATA_EXISTS
+
+  - recent is the number of recent messages in the mailbox when type
+    is MAILIMAP_MAILBOX_DATA_RECENT
+*/
+
+struct mailimap_mailbox_data {
+  int mbd_type;
+  union {
+    struct mailimap_flag_list * mbd_flags;   /* can be NULL */
+    struct mailimap_mailbox_list * mbd_list; /* can be NULL */
+    struct mailimap_mailbox_list * mbd_lsub; /* can be NULL */
+    clist * mbd_search;  /* list of nz-number (uint32_t *), can be NULL */
+    struct mailimap_mailbox_data_status *  mbd_status; /* can be NULL */
+    uint32_t mbd_exists;
+    uint32_t mbd_recent;
+    struct mailimap_extension_data * mbd_extension; /* can be NULL */
+  } mbd_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_mailbox_data *
+mailimap_mailbox_data_new(int mbd_type, struct mailimap_flag_list * mbd_flags,
+    struct mailimap_mailbox_list * mbd_list,
+    struct mailimap_mailbox_list * mbd_lsub,
+    clist * mbd_search,
+    struct mailimap_mailbox_data_status * mbd_status,
+    uint32_t mbd_exists,
+    uint32_t mbd_recent,
+    struct mailimap_extension_data * mbd_extension);
+
+LIBETPAN_EXPORT
+void
+mailimap_mailbox_data_free(struct mailimap_mailbox_data * mb_data);
+
+
+
+/* this is the type of mailbox flags */
+
+enum {
+  MAILIMAP_MBX_LIST_FLAGS_SFLAG,    /* mailbox single flag - a flag in
+                                       {\NoSelect, \Marked, \Unmarked} */
+  MAILIMAP_MBX_LIST_FLAGS_NO_SFLAG  /* mailbox other flag -  mailbox flag
+                                       other than \NoSelect \Marked and
+                                       \Unmarked) */
+};
+
+/* this is a single flag type */
+
+enum {
+  MAILIMAP_MBX_LIST_SFLAG_ERROR,
+  MAILIMAP_MBX_LIST_SFLAG_MARKED,
+  MAILIMAP_MBX_LIST_SFLAG_NOSELECT,
+  MAILIMAP_MBX_LIST_SFLAG_UNMARKED
+};
+
+/*
+  mailimap_mbx_list_flags is a mailbox flag
+
+  - type is the type of mailbox flag, it can be MAILIMAP_MBX_LIST_FLAGS_SFLAG,
+    or MAILIMAP_MBX_LIST_FLAGS_NO_SFLAG.
+
+  - oflags is a list of "mailbox other flag"
+  
+  - sflag is a mailbox single flag
+*/
+
+struct mailimap_mbx_list_flags {
+  int mbf_type;
+  clist * mbf_oflags; /* list of
+                         (struct mailimap_mbx_list_oflag *), != NULL */
+  int mbf_sflag;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_mbx_list_flags *
+mailimap_mbx_list_flags_new(int mbf_type,
+    clist * mbf_oflags, int mbf_sflag);
+
+LIBETPAN_EXPORT
+void
+mailimap_mbx_list_flags_free(struct mailimap_mbx_list_flags * mbx_list_flags);
+
+
+
+/* this is the type of the mailbox other flag */
+
+enum {
+  MAILIMAP_MBX_LIST_OFLAG_ERROR,       /* on parse error */
+  MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS, /* \NoInferior flag */
+  MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT     /* other flag */
+};
+
+/*
+  mailimap_mbx_list_oflag is a mailbox other flag
+
+  - type can be MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS when this is 
+    a \NoInferior flag or MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT
+
+  - flag_ext is set when MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT and is
+    an extension flag, should be allocated with malloc()
+*/
+
+struct mailimap_mbx_list_oflag {
+  int of_type;
+  char * of_flag_ext; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_mbx_list_oflag *
+mailimap_mbx_list_oflag_new(int of_type, char * of_flag_ext);
+
+LIBETPAN_EXPORT
+void
+mailimap_mbx_list_oflag_free(struct mailimap_mbx_list_oflag * oflag);
+
+
+
+/*
+  mailimap_mailbox_list is a list of mailbox flags
+
+  - mb_flag is a list of mailbox flags
+
+  - delimiter is the delimiter of the mailbox path
+
+  - mb is the name of the mailbox, should be allocated with malloc()
+*/
+
+struct mailimap_mailbox_list {
+  struct mailimap_mbx_list_flags * mb_flag; /* can be NULL */
+  char mb_delimiter;
+  char * mb_name; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_mailbox_list *
+mailimap_mailbox_list_new(struct mailimap_mbx_list_flags * mbx_flags,
+    char mb_delimiter, char * mb_name);
+
+LIBETPAN_EXPORT
+void
+mailimap_mailbox_list_free(struct mailimap_mailbox_list * mb_list);
+
+
+
+/* this is the MIME type */
+
+enum {
+  MAILIMAP_MEDIA_BASIC_APPLICATION, /* application/xxx */
+  MAILIMAP_MEDIA_BASIC_AUDIO,       /* audio/xxx */
+  MAILIMAP_MEDIA_BASIC_IMAGE,       /* image/xxx */
+  MAILIMAP_MEDIA_BASIC_MESSAGE,     /* message/xxx */
+  MAILIMAP_MEDIA_BASIC_VIDEO,       /* video/xxx */
+  MAILIMAP_MEDIA_BASIC_OTHER        /* for all other cases */
+};
+
+
+/*
+  mailimap_media_basic is the MIME type
+
+  - type can be MAILIMAP_MEDIA_BASIC_APPLICATION, MAILIMAP_MEDIA_BASIC_AUDIO,
+    MAILIMAP_MEDIA_BASIC_IMAGE, MAILIMAP_MEDIA_BASIC_MESSAGE,
+    MAILIMAP_MEDIA_BASIC_VIDEO or MAILIMAP_MEDIA_BASIC_OTHER
+
+  - basic_type is defined when type is MAILIMAP_MEDIA_BASIC_OTHER, should
+    be allocated with malloc()
+
+  - subtype is the subtype of the MIME type, for example, this is
+    "data" in "application/data", should be allocated with malloc()
+*/
+
+struct mailimap_media_basic {
+  int med_type;
+  char * med_basic_type; /* can be NULL */
+  char * med_subtype;    /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_media_basic *
+mailimap_media_basic_new(int med_type,
+    char * med_basic_type, char * med_subtype);
+
+LIBETPAN_EXPORT
+void
+mailimap_media_basic_free(struct mailimap_media_basic * media_basic);
+
+
+
+/* this is the type of message data */
+
+enum {
+  MAILIMAP_MESSAGE_DATA_ERROR,
+  MAILIMAP_MESSAGE_DATA_EXPUNGE,
+  MAILIMAP_MESSAGE_DATA_FETCH
+};
+
+/*
+  mailimap_message_data is an information related to a message
+
+  - number is the number or the unique identifier of the message
+  
+  - type is the type of information, this value can be
+    MAILIMAP_MESSAGE_DATA_EXPUNGE or MAILIMAP_MESSAGE_DATA_FETCH
+    
+  - msg_att is the message data
+*/
+
+struct mailimap_message_data {
+  uint32_t mdt_number;
+  int mdt_type;
+  struct mailimap_msg_att * mdt_msg_att; /* can be NULL */
+                                     /* if type = EXPUNGE, can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_message_data *
+mailimap_message_data_new(uint32_t mdt_number, int mdt_type,
+    struct mailimap_msg_att * mdt_msg_att);
+
+LIBETPAN_EXPORT
+void
+mailimap_message_data_free(struct mailimap_message_data * msg_data);
+
+
+
+/* this the type of the message attributes */
+
+enum {
+  MAILIMAP_MSG_ATT_ITEM_ERROR,   /* on parse error */
+  MAILIMAP_MSG_ATT_ITEM_DYNAMIC, /* dynamic message attributes (flags) */
+  MAILIMAP_MSG_ATT_ITEM_STATIC,  /* static messages attributes
+                                    (message content) */
+  MAILIMAP_MSG_ATT_ITEM_EXTENSION /* extension data */
+};
+
+/*
+  mailimap_msg_att_item is a message attribute
+
+  - type is the type of message attribute, the value can be
+    MAILIMAP_MSG_ATT_ITEM_DYNAMIC, MAILIMAP_MSG_ATT_ITEM_STATIC or MAILIMAP_MSG_ATT_ITEM_EXTENSION
+  
+  - att_dyn is a dynamic message attribute when type is
+    MAILIMAP_MSG_ATT_ITEM_DYNAMIC
+
+  - att_static is a static message attribute when type is
+    MAILIMAP_MSG_ATT_ITEM_STATIC
+ 
+  - att_extension_data is an extension data.
+*/
+
+struct mailimap_msg_att_item {
+  int att_type;
+  union {
+    struct mailimap_msg_att_dynamic * att_dyn;   /* can be NULL */
+    struct mailimap_msg_att_static * att_static; /* can be NULL */
+    struct mailimap_extension_data * att_extension_data; /* can be NULL */
+  } att_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_msg_att_item *
+mailimap_msg_att_item_new(int att_type,
+    struct mailimap_msg_att_dynamic * att_dyn,
+    struct mailimap_msg_att_static * att_static,
+    struct mailimap_extension_data * att_extension_data);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_item_free(struct mailimap_msg_att_item * item);
+
+
+/*
+  mailimap_msg_att is a list of attributes
+  
+  - list is a list of message attributes
+
+  - number is the message number or unique identifier, this field
+    has been added for implementation purpose
+*/
+
+struct mailimap_msg_att {
+  clist * att_list; /* list of (struct mailimap_msg_att_item *) */
+                /* != NULL */
+  uint32_t att_number; /* extra field to store the message number,
+		     used for mailimap */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_msg_att * mailimap_msg_att_new(clist * att_list);
+
+LIBETPAN_EXPORT
+void mailimap_msg_att_free(struct mailimap_msg_att * msg_att);
+
+
+/*
+  mailimap_msg_att_dynamic is a dynamic message attribute
+  
+  - list is a list of flags (that have been fetched)
+*/
+
+struct mailimap_msg_att_dynamic {
+  clist * att_list; /* list of (struct mailimap_flag_fetch *) */
+  /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_msg_att_dynamic *
+mailimap_msg_att_dynamic_new(clist * att_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_dynamic_free(struct mailimap_msg_att_dynamic * msg_att_dyn);
+
+
+
+/*
+  mailimap_msg_att_body_section is a MIME part content
+  
+  - section is the location of the MIME part in the message
+  
+  - origin_octet is the offset of the requested part of the MIME part
+  
+  - body_part is the content or partial content of the MIME part,
+    should be allocated through a MMAPString
+
+  - length is the size of the content
+*/
+
+struct mailimap_msg_att_body_section {
+  struct mailimap_section * sec_section; /* != NULL */
+  uint32_t sec_origin_octet;
+  char * sec_body_part; /* can be NULL */
+  size_t sec_length;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_msg_att_body_section *
+mailimap_msg_att_body_section_new(struct mailimap_section * section,
+    uint32_t sec_origin_octet,
+    char * sec_body_part,
+    size_t sec_length);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_body_section_free(struct mailimap_msg_att_body_section * 
+    msg_att_body_section);
+
+
+
+/*
+  this is the type of static message attribute
+*/
+
+enum {
+  MAILIMAP_MSG_ATT_ERROR,         /* on parse error */
+  MAILIMAP_MSG_ATT_ENVELOPE,      /* this is the fields that can be
+                                    parsed by the server */
+  MAILIMAP_MSG_ATT_INTERNALDATE,  /* this is the message date kept
+                                     by the server */
+  MAILIMAP_MSG_ATT_RFC822,        /* this is the message content
+                                     (header and body) */
+  MAILIMAP_MSG_ATT_RFC822_HEADER, /* this is the message header */
+  MAILIMAP_MSG_ATT_RFC822_TEXT,   /* this is the message text part */
+  MAILIMAP_MSG_ATT_RFC822_SIZE,   /* this is the size of the message content */
+  MAILIMAP_MSG_ATT_BODY,          /* this is the MIME description of
+                                     the message */
+  MAILIMAP_MSG_ATT_BODYSTRUCTURE, /* this is the MIME description of the
+                                     message with additional information */
+  MAILIMAP_MSG_ATT_BODY_SECTION,  /* this is a MIME part content */
+  MAILIMAP_MSG_ATT_UID            /* this is the message unique identifier */
+};
+
+/*
+  mailimap_msg_att_static is a given part of the message
+  
+  - type is the type of the static message attribute, the value can be 
+    MAILIMAP_MSG_ATT_ENVELOPE, MAILIMAP_MSG_ATT_INTERNALDATE,
+    MAILIMAP_MSG_ATT_RFC822, MAILIMAP_MSG_ATT_RFC822_HEADER,
+    MAILIMAP_MSG_ATT_RFC822_TEXT, MAILIMAP_MSG_ATT_RFC822_SIZE,
+    MAILIMAP_MSG_ATT_BODY, MAILIMAP_MSG_ATT_BODYSTRUCTURE,
+    MAILIMAP_MSG_ATT_BODY_SECTION, MAILIMAP_MSG_ATT_UID
+
+  - env is the headers parsed by the server if type is
+    MAILIMAP_MSG_ATT_ENVELOPE
+
+  - internal_date is the date of message kept by the server if type is
+    MAILIMAP_MSG_ATT_INTERNALDATE
+
+  - rfc822 is the message content if type is MAILIMAP_MSG_ATT_RFC822,
+    should be allocated through a MMAPString
+
+  - rfc822_header is the message header if type is
+    MAILIMAP_MSG_ATT_RFC822_HEADER, should be allocated through a MMAPString
+
+  - rfc822_text is the message text part if type is
+    MAILIMAP_MSG_ATT_RFC822_TEXT, should be allocated through a MMAPString
+
+  - rfc822_size is the message size if type is MAILIMAP_MSG_ATT_SIZE
+
+  - body is the MIME description of the message
+
+  - bodystructure is the MIME description of the message with additional
+    information
+
+  - body_section is a MIME part content
+
+  - uid is a unique message identifier
+*/
+
+struct mailimap_msg_att_static {
+  int att_type;
+  union {
+    struct mailimap_envelope * att_env;            /* can be NULL */
+    struct mailimap_date_time * att_internal_date; /* can be NULL */
+    struct {
+      char * att_content; /* can be NULL */
+      size_t att_length;
+    } att_rfc822;        
+    struct {
+      char * att_content; /* can be NULL */
+      size_t att_length;
+    } att_rfc822_header;
+    struct {
+      char * att_content; /* can be NULL */
+      size_t att_length;
+    } att_rfc822_text;
+    uint32_t att_rfc822_size;
+    struct mailimap_body * att_bodystructure; /* can be NULL */
+    struct mailimap_body * att_body;          /* can be NULL */
+    struct mailimap_msg_att_body_section * att_body_section; /* can be NULL */
+    uint32_t att_uid;
+  } att_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_msg_att_static *
+mailimap_msg_att_static_new(int att_type, struct mailimap_envelope * att_env,
+    struct mailimap_date_time * att_internal_date,
+    char * att_rfc822,
+    char * att_rfc822_header,
+    char * att_rfc822_text,
+    size_t att_length,
+    uint32_t att_rfc822_size,
+    struct mailimap_body * att_bodystructure,
+    struct mailimap_body * att_body,
+    struct mailimap_msg_att_body_section * att_body_section,
+    uint32_t att_uid);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_static_free(struct mailimap_msg_att_static * item);
+
+
+
+/* this is the type of a response element */
+
+enum {
+  MAILIMAP_RESP_ERROR,     /* on parse error */
+  MAILIMAP_RESP_CONT_REQ,  /* continuation request */
+  MAILIMAP_RESP_RESP_DATA  /* response data */
+};
+
+/*
+  mailimap_cont_req_or_resp_data is a response element
+  
+  - type is the type of response, the value can be MAILIMAP_RESP_CONT_REQ
+    or MAILIMAP_RESP_RESP_DATA
+
+  - cont_req is a continuation request
+
+  - resp_data is a reponse data
+*/
+
+struct mailimap_cont_req_or_resp_data {
+  int rsp_type;
+  union {
+    struct mailimap_continue_req * rsp_cont_req;   /* can be NULL */
+    struct mailimap_response_data * rsp_resp_data; /* can be NULL */
+  } rsp_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_cont_req_or_resp_data *
+mailimap_cont_req_or_resp_data_new(int rsp_type,
+    struct mailimap_continue_req * rsp_cont_req,
+    struct mailimap_response_data * rsp_resp_data);
+
+LIBETPAN_EXPORT
+void
+mailimap_cont_req_or_resp_data_free(struct mailimap_cont_req_or_resp_data *
+				    cont_req_or_resp_data);
+
+
+/*
+  mailimap_response is a list of response elements
+
+  - cont_req_or_resp_data_list is a list of response elements
+
+  - resp_done is an ending response element
+*/
+
+struct mailimap_response {
+  clist * rsp_cont_req_or_resp_data_list;
+  /* list of (struct mailiap_cont_req_or_resp_data *) */
+                                   /* can be NULL */
+  struct mailimap_response_done * rsp_resp_done; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_response *
+mailimap_response_new(clist * rsp_cont_req_or_resp_data_list,
+    struct mailimap_response_done * rsp_resp_done);
+
+LIBETPAN_EXPORT
+void
+mailimap_response_free(struct mailimap_response * resp);
+
+
+
+/* this is the type of an untagged response */
+
+enum {
+  MAILIMAP_RESP_DATA_TYPE_ERROR,           /* on parse error */
+  MAILIMAP_RESP_DATA_TYPE_COND_STATE,      /* condition state response */
+  MAILIMAP_RESP_DATA_TYPE_COND_BYE,        /* BYE response (server is about
+                                              to close the connection) */
+  MAILIMAP_RESP_DATA_TYPE_MAILBOX_DATA,    /* response related to a mailbox */
+  MAILIMAP_RESP_DATA_TYPE_MESSAGE_DATA,    /* response related to a message */
+  MAILIMAP_RESP_DATA_TYPE_CAPABILITY_DATA, /* capability information */
+  MAILIMAP_RESP_DATA_TYPE_EXTENSION_DATA   /* data parsed by extension */
+};
+
+/*
+  mailimap_reponse_data is an untagged response
+
+  - type is the type of the untagged response, it can be
+    MAILIMAP_RESP_DATA_COND_STATE, MAILIMAP_RESP_DATA_COND_BYE,
+    MAILIMAP_RESP_DATA_MAILBOX_DATA, MAILIMAP_RESP_DATA_MESSAGE_DATA
+    or MAILIMAP_RESP_DATA_CAPABILITY_DATA
+
+  - cond_state is a condition state response
+
+  - bye is a BYE response (server is about to close the connection)
+  
+  - mailbox_data is a response related to a mailbox
+
+  - message_data is a response related to a message
+
+  - capability is information about capabilities
+*/
+
+struct mailimap_response_data {
+  int rsp_type;
+  union {
+    struct mailimap_resp_cond_state * rsp_cond_state;      /* can be NULL */
+    struct mailimap_resp_cond_bye * rsp_bye;               /* can be NULL */
+    struct mailimap_mailbox_data * rsp_mailbox_data;       /* can be NULL */
+    struct mailimap_message_data * rsp_message_data;       /* can be NULL */
+    struct mailimap_capability_data * rsp_capability_data; /* can be NULL */
+    struct mailimap_extension_data * rsp_extension_data;   /* can be NULL */
+  } rsp_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_response_data *
+mailimap_response_data_new(int rsp_type,
+    struct mailimap_resp_cond_state * rsp_cond_state,
+    struct mailimap_resp_cond_bye * rsp_bye,
+    struct mailimap_mailbox_data * rsp_mailbox_data,
+    struct mailimap_message_data * rsp_message_data,
+    struct mailimap_capability_data * rsp_capability_data,
+    struct mailimap_extension_data * rsp_extension_data);
+
+LIBETPAN_EXPORT
+void
+mailimap_response_data_free(struct mailimap_response_data * resp_data);
+
+
+
+/* this is the type of an ending response */
+
+enum {
+  MAILIMAP_RESP_DONE_TYPE_ERROR,  /* on parse error */
+  MAILIMAP_RESP_DONE_TYPE_TAGGED, /* tagged response */
+  MAILIMAP_RESP_DONE_TYPE_FATAL   /* fatal error response */
+};
+
+/*
+  mailimap_response_done is an ending response
+
+  - type is the type of the ending response
+
+  - tagged is a tagged response
+
+  - fatal is a fatal error response
+*/
+
+struct mailimap_response_done {
+  int rsp_type;
+  union {
+    struct mailimap_response_tagged * rsp_tagged; /* can be NULL */
+    struct mailimap_response_fatal * rsp_fatal;   /* can be NULL */
+  } rsp_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_response_done *
+mailimap_response_done_new(int rsp_type,
+    struct mailimap_response_tagged * rsp_tagged,
+    struct mailimap_response_fatal * rsp_fatal);
+
+LIBETPAN_EXPORT
+void mailimap_response_done_free(struct mailimap_response_done *
+				 resp_done);
+
+
+/*
+  mailimap_response_fatal is a fatal error response
+
+  - bye is a BYE response text
+*/
+
+struct mailimap_response_fatal {
+  struct mailimap_resp_cond_bye * rsp_bye; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_response_fatal *
+mailimap_response_fatal_new(struct mailimap_resp_cond_bye * rsp_bye);
+
+LIBETPAN_EXPORT
+void mailimap_response_fatal_free(struct mailimap_response_fatal * resp_fatal);
+
+
+
+/*
+  mailimap_response_tagged is a tagged response
+
+  - tag is the sent tag, should be allocated with malloc()
+
+  - cond_state is a condition state response
+*/
+
+struct mailimap_response_tagged {
+  char * rsp_tag; /* != NULL */
+  struct mailimap_resp_cond_state * rsp_cond_state; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_response_tagged *
+mailimap_response_tagged_new(char * rsp_tag,
+    struct mailimap_resp_cond_state * rsp_cond_state);
+
+LIBETPAN_EXPORT
+void
+mailimap_response_tagged_free(struct mailimap_response_tagged * tagged);
+
+
+/* this is the type of an authentication condition response */
+
+enum {
+  MAILIMAP_RESP_COND_AUTH_ERROR,   /* on parse error */
+  MAILIMAP_RESP_COND_AUTH_OK,      /* authentication is needed */
+  MAILIMAP_RESP_COND_AUTH_PREAUTH  /* authentication is not needed */
+};
+
+/*
+  mailimap_resp_cond_auth is an authentication condition response
+
+  - type is the type of the authentication condition response,
+    the value can be MAILIMAP_RESP_COND_AUTH_OK or
+    MAILIMAP_RESP_COND_AUTH_PREAUTH
+
+  - text is a text response
+*/
+
+struct mailimap_resp_cond_auth {
+  int rsp_type;
+  struct mailimap_resp_text * rsp_text; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_resp_cond_auth *
+mailimap_resp_cond_auth_new(int rsp_type,
+    struct mailimap_resp_text * rsp_text);
+
+LIBETPAN_EXPORT
+void
+mailimap_resp_cond_auth_free(struct mailimap_resp_cond_auth * cond_auth);
+
+
+
+/*
+  mailimap_resp_cond_bye is a BYE response
+
+  - text is a text response
+*/
+
+struct mailimap_resp_cond_bye {
+  struct mailimap_resp_text * rsp_text; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_resp_cond_bye *
+mailimap_resp_cond_bye_new(struct mailimap_resp_text * rsp_text);
+
+LIBETPAN_EXPORT
+void
+mailimap_resp_cond_bye_free(struct mailimap_resp_cond_bye * cond_bye);
+
+
+
+/* this is the type of a condition state response */
+
+enum {
+  MAILIMAP_RESP_COND_STATE_OK,
+  MAILIMAP_RESP_COND_STATE_NO,
+  MAILIMAP_RESP_COND_STATE_BAD
+};
+
+/*
+  mailimap_resp_cond_state is a condition state reponse
+  
+  - type is the type of the condition state response
+
+  - text is a text response
+*/
+
+struct mailimap_resp_cond_state {
+  int rsp_type;
+  struct mailimap_resp_text * rsp_text; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_resp_cond_state *
+mailimap_resp_cond_state_new(int rsp_type,
+    struct mailimap_resp_text * rsp_text);
+
+LIBETPAN_EXPORT
+void
+mailimap_resp_cond_state_free(struct mailimap_resp_cond_state * cond_state);
+
+
+
+/*
+  mailimap_resp_text is a text response
+
+  - resp_code is a response code
+  
+  - text is a human readable text, should be allocated with malloc()
+*/
+
+struct mailimap_resp_text {
+  struct mailimap_resp_text_code * rsp_code; /* can be NULL */
+  char * rsp_text; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_resp_text *
+mailimap_resp_text_new(struct mailimap_resp_text_code * resp_code,
+		       char * rsp_text);
+
+LIBETPAN_EXPORT
+void mailimap_resp_text_free(struct mailimap_resp_text * resp_text);
+
+
+
+/* this is the type of the response code */
+
+enum {
+  MAILIMAP_RESP_TEXT_CODE_ALERT,           /* ALERT response */
+  MAILIMAP_RESP_TEXT_CODE_BADCHARSET,      /* BADCHARSET response */
+  MAILIMAP_RESP_TEXT_CODE_CAPABILITY_DATA, /* CAPABILITY response */
+  MAILIMAP_RESP_TEXT_CODE_PARSE,           /* PARSE response */
+  MAILIMAP_RESP_TEXT_CODE_PERMANENTFLAGS,  /* PERMANENTFLAGS response */
+  MAILIMAP_RESP_TEXT_CODE_READ_ONLY,       /* READONLY response */
+  MAILIMAP_RESP_TEXT_CODE_READ_WRITE,      /* READWRITE response */
+  MAILIMAP_RESP_TEXT_CODE_TRY_CREATE,      /* TRYCREATE response */
+  MAILIMAP_RESP_TEXT_CODE_UIDNEXT,         /* UIDNEXT response */
+  MAILIMAP_RESP_TEXT_CODE_UIDVALIDITY,     /* UIDVALIDITY response */
+  MAILIMAP_RESP_TEXT_CODE_UNSEEN,          /* UNSEEN response */
+  MAILIMAP_RESP_TEXT_CODE_OTHER,           /* other type of response */
+  MAILIMAP_RESP_TEXT_CODE_EXTENSION        /* extension response */
+};
+
+/*
+  mailimap_resp_text_code is a response code
+  
+  - type is the type of the response code, the value can be
+    MAILIMAP_RESP_TEXT_CODE_ALERT, MAILIMAP_RESP_TEXT_CODE_BADCHARSET,
+    MAILIMAP_RESP_TEXT_CODE_CAPABILITY_DATA, MAILIMAP_RESP_TEXT_CODE_PARSE,
+    MAILIMAP_RESP_TEXT_CODE_PERMANENTFLAGS, MAILIMAP_RESP_TEXT_CODE_READ_ONLY,
+    MAILIMAP_RESP_TEXT_CODE_READ_WRITE, MAILIMAP_RESP_TEXT_CODE_TRY_CREATE,
+    MAILIMAP_RESP_TEXT_CODE_UIDNEXT, MAILIMAP_RESP_TEXT_CODE_UIDVALIDITY,
+    MAILIMAP_RESP_TEXT_CODE_UNSEEN or MAILIMAP_RESP_TEXT_CODE_OTHER
+    
+  - badcharset is a list of charsets if type
+    is MAILIMAP_RESP_TEXT_CODE_BADCHARSET, each element should be
+    allocated with malloc()
+
+  - cap_data is a list of capabilities
+
+  - perm_flags is a list of flags, this is the flags that can be changed
+    permanently on the messages of the mailbox.
+
+  - uidnext is the next unique identifier of a message
+  
+  - uidvalidity is the unique identifier validity value
+
+  - first_unseen is the number of the first message without the \Seen flag
+  
+  - atom is a keyword for an extension response code, should be allocated
+    with malloc()
+
+  - atom_value is the data related with the extension response code,
+    should be allocated with malloc()
+*/
+
+struct mailimap_resp_text_code {
+  int rc_type;
+  union {
+    clist * rc_badcharset; /* list of astring (char *) */
+    /* can be NULL */
+    struct mailimap_capability_data * rc_cap_data; /* != NULL */
+    clist * rc_perm_flags; /* list of (struct mailimap_flag_perm *) */
+    /* can be NULL */
+    uint32_t rc_uidnext;
+    uint32_t rc_uidvalidity;
+    uint32_t rc_first_unseen;
+    struct {
+      char * atom_name;  /* can be NULL */
+      char * atom_value; /* can be NULL */
+    } rc_atom;
+    struct mailimap_extension_data * rc_ext_data; /* can be NULL */
+  } rc_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_resp_text_code *
+mailimap_resp_text_code_new(int rc_type, clist * rc_badcharset,
+    struct mailimap_capability_data * rc_cap_data,
+    clist * rc_perm_flags,
+    uint32_t rc_uidnext, uint32_t rc_uidvalidity,
+    uint32_t rc_first_unseen, char * rc_atom, char * rc_atom_value,
+    struct mailimap_extension_data * rc_ext_data);
+
+LIBETPAN_EXPORT
+void
+mailimap_resp_text_code_free(struct mailimap_resp_text_code * resp_text_code);
+
+
+/*
+  mailimap_section is a MIME part section identifier
+
+  section_spec is the MIME section identifier
+*/
+
+struct mailimap_section {
+  struct mailimap_section_spec * sec_spec; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new(struct mailimap_section_spec * sec_spec);
+
+LIBETPAN_EXPORT
+void mailimap_section_free(struct mailimap_section * section);
+
+
+/* this is the type of the message/rfc822 part description */
+
+enum {
+  MAILIMAP_SECTION_MSGTEXT_HEADER,            /* header fields part of the
+                                                 message */
+  MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS,     /* given header fields of the
+                                                 message */
+  MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS_NOT, /* header fields of the
+                                                 message except the given */
+  MAILIMAP_SECTION_MSGTEXT_TEXT               /* text part  */
+};
+
+/*
+  mailimap_section_msgtext is a message/rfc822 part description
+  
+  - type is the type of the content part and the value can be
+    MAILIMAP_SECTION_MSGTEXT_HEADER, MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS,
+    MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS_NOT
+    or MAILIMAP_SECTION_MSGTEXT_TEXT
+
+  - header_list is the list of headers when type is
+    MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS or
+    MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS_NOT
+*/
+
+struct mailimap_section_msgtext {
+  int sec_type;
+  struct mailimap_header_list * sec_header_list; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_section_msgtext *
+mailimap_section_msgtext_new(int sec_type,
+    struct mailimap_header_list * sec_header_list);
+
+LIBETPAN_EXPORT
+void
+mailimap_section_msgtext_free(struct mailimap_section_msgtext * msgtext);
+
+
+
+/*
+  mailimap_section_part is the MIME part location in a message
+  
+  - section_id is a list of number index of the sub-part in the mail structure,
+    each element should be allocated with malloc()
+
+*/
+
+struct mailimap_section_part {
+  clist * sec_id; /* list of nz-number (uint32_t *) */
+                      /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_section_part *
+mailimap_section_part_new(clist * sec_id);
+
+LIBETPAN_EXPORT
+void
+mailimap_section_part_free(struct mailimap_section_part * section_part);
+
+
+
+/* this is the type of section specification */
+
+enum {
+  MAILIMAP_SECTION_SPEC_SECTION_MSGTEXT, /* if requesting data of the root
+                                            MIME message/rfc822 part */
+  MAILIMAP_SECTION_SPEC_SECTION_PART     /* location of the MIME part
+                                            in the message */
+};
+
+/*
+  mailimap_section_spec is a section specification
+
+  - type is the type of the section specification, the value can be
+    MAILIMAP_SECTION_SPEC_SECTION_MSGTEXT or
+    MAILIMAP_SECTION_SPEC_SECTION_PART
+
+  - section_msgtext is a message/rfc822 part description if type is
+    MAILIMAP_SECTION_SPEC_SECTION_MSGTEXT
+
+  - section_part is a body part location in the message if type is
+    MAILIMAP_SECTION_SPEC_SECTION_PART
+  
+  - section_text is a body part location for a given MIME part,
+    this can be NULL if the body of the part is requested (and not
+    the MIME header).
+*/
+
+struct mailimap_section_spec {
+  int sec_type;
+  union {
+    struct mailimap_section_msgtext * sec_msgtext; /* can be NULL */
+    struct mailimap_section_part * sec_part;       /* can be NULL */
+  } sec_data;
+  struct mailimap_section_text * sec_text;       /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_section_spec *
+mailimap_section_spec_new(int sec_type,
+    struct mailimap_section_msgtext * sec_msgtext,
+    struct mailimap_section_part * sec_part,
+    struct mailimap_section_text * sec_text);
+
+LIBETPAN_EXPORT
+void
+mailimap_section_spec_free(struct mailimap_section_spec * section_spec);
+
+
+
+/* this is the type of body part location for a given MIME part */
+
+enum {
+  MAILIMAP_SECTION_TEXT_ERROR,           /* on parse error **/
+  MAILIMAP_SECTION_TEXT_SECTION_MSGTEXT, /* if the MIME type is
+                                            message/rfc822, headers or text
+                                            can be requested */
+  MAILIMAP_SECTION_TEXT_MIME             /* for all MIME types,
+                                            MIME headers can be requested */
+};
+
+/*
+  mailimap_section_text is the body part location for a given MIME part
+
+  - type can be MAILIMAP_SECTION_TEXT_SECTION_MSGTEXT or
+    MAILIMAP_SECTION_TEXT_MIME
+
+  - section_msgtext is the part of the MIME part when MIME type is
+    message/rfc822 than can be requested, when type is
+    MAILIMAP_TEXT_SECTION_MSGTEXT
+*/
+
+struct mailimap_section_text {
+  int sec_type;
+  struct mailimap_section_msgtext * sec_msgtext; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_section_text *
+mailimap_section_text_new(int sec_type,
+    struct mailimap_section_msgtext * sec_msgtext);
+
+LIBETPAN_EXPORT
+void
+mailimap_section_text_free(struct mailimap_section_text * section_text);
+
+
+
+
+
+
+
+
+
+
+/* ************************************************************************* */
+/* the following part concerns only the IMAP command that are sent */
+
+
+/*
+  mailimap_set_item is a message set
+
+  - first is the first message of the set
+  - last is the last message of the set
+
+  this can be message numbers of message unique identifiers
+*/
+
+struct mailimap_set_item {
+  uint32_t set_first;
+  uint32_t set_last;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_set_item *
+mailimap_set_item_new(uint32_t set_first, uint32_t set_last);
+
+LIBETPAN_EXPORT
+void mailimap_set_item_free(struct mailimap_set_item * set_item);
+
+
+
+/*
+  set is a list of message sets
+
+  - list is a list of message sets
+*/
+
+struct mailimap_set {
+  clist * set_list; /* list of (struct mailimap_set_item *) */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_set * mailimap_set_new(clist * list);
+
+LIBETPAN_EXPORT
+void mailimap_set_free(struct mailimap_set * set);
+
+
+/*
+  mailimap_date is a date
+
+  - day is the day in the month (1 to 31)
+
+  - month (1 to 12)
+
+  - year (4 digits)
+*/
+
+struct mailimap_date {
+  int dt_day;
+  int dt_month;
+  int dt_year;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_date *
+mailimap_date_new(int dt_day, int dt_month, int dt_year);
+
+LIBETPAN_EXPORT
+void mailimap_date_free(struct mailimap_date * date);
+
+
+
+
+/* this is the type of fetch attribute for a given message */
+
+enum {
+  MAILIMAP_FETCH_ATT_ENVELOPE,          /* to fetch the headers parsed by
+                                           the IMAP server */
+  MAILIMAP_FETCH_ATT_FLAGS,             /* to fetch the flags */
+  MAILIMAP_FETCH_ATT_INTERNALDATE,      /* to fetch the date of the message
+                                           kept by the server */
+  MAILIMAP_FETCH_ATT_RFC822,            /* to fetch the entire message */
+  MAILIMAP_FETCH_ATT_RFC822_HEADER,     /* to fetch the headers */
+  MAILIMAP_FETCH_ATT_RFC822_SIZE,       /* to fetch the size */
+  MAILIMAP_FETCH_ATT_RFC822_TEXT,       /* to fetch the text part */
+  MAILIMAP_FETCH_ATT_BODY,              /* to fetch the MIME structure */
+  MAILIMAP_FETCH_ATT_BODYSTRUCTURE,     /* to fetch the MIME structure with
+                                           additional information */
+  MAILIMAP_FETCH_ATT_UID,               /* to fetch the unique identifier */
+  MAILIMAP_FETCH_ATT_BODY_SECTION,      /* to fetch a given part */
+  MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION, /* to fetch a given part without
+                                           marking the message as read */
+  MAILIMAP_FETCH_ATT_EXTENSION
+};
+
+
+/*
+  mailimap_fetch_att is the description of the fetch attribute
+
+  - type is the type of fetch attribute, the value can be
+    MAILIMAP_FETCH_ATT_ENVELOPE, MAILIMAP_FETCH_ATT_FLAGS,
+    MAILIMAP_FETCH_ATT_INTERNALDATE, MAILIMAP_FETCH_ATT_RFC822,
+    MAILIMAP_FETCH_ATT_RFC822_HEADER, MAILIMAP_FETCH_ATT_RFC822_SIZE,
+    MAILIMAP_FETCH_ATT_RFC822_TEXT, MAILIMAP_FETCH_ATT_BODY,
+    MAILIMAP_FETCH_ATT_BODYSTRUCTURE, MAILIMAP_FETCH_ATT_UID,
+    MAILIMAP_FETCH_ATT_BODY_SECTION, MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION,
+    MAILIMAP_FETCH_ATT_EXTENSION
+
+  - section is the location of the part to fetch if type is
+    MAILIMAP_FETCH_ATT_BODY_SECTION or MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION
+
+  - offset is the first byte to fetch in the given part
+
+  - size is the maximum size of the part to fetch
+ 
+  - att_extension: keyword to send when MAILIMAP_FETCH_ATT_EXTENSION is used
+*/
+
+struct mailimap_fetch_att {
+  int att_type;
+  struct mailimap_section * att_section;
+  uint32_t att_offset;
+  uint32_t att_size;
+  char * att_extension; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new(int att_type, struct mailimap_section * att_section,
+		       uint32_t att_offset, uint32_t att_size, char * att_extension);
+
+
+LIBETPAN_EXPORT
+void mailimap_fetch_att_free(struct mailimap_fetch_att * fetch_att);
+
+
+/* this is the type of a FETCH operation */
+
+enum {
+  MAILIMAP_FETCH_TYPE_ALL,            /* equivalent to (FLAGS INTERNALDATE
+                                         RFC822.SIZE ENVELOPE) */
+  MAILIMAP_FETCH_TYPE_FULL,           /* equivalent to (FLAGS INTERNALDATE
+                                         RFC822.SIZE ENVELOPE BODY) */
+  MAILIMAP_FETCH_TYPE_FAST,           /* equivalent to (FLAGS INTERNALDATE
+                                         RFC822.SIZE) */
+  MAILIMAP_FETCH_TYPE_FETCH_ATT,      /* when there is only of fetch
+                                         attribute */
+  MAILIMAP_FETCH_TYPE_FETCH_ATT_LIST  /* when there is a list of fetch
+                                         attributes */
+};
+
+/*
+  mailimap_fetch_type is the description of the FETCH operation
+
+  - type can be MAILIMAP_FETCH_TYPE_ALL, MAILIMAP_FETCH_TYPE_FULL,
+    MAILIMAP_FETCH_TYPE_FAST, MAILIMAP_FETCH_TYPE_FETCH_ATT or
+    MAILIMAP_FETCH_TYPE_FETCH_ATT_LIST
+
+  - fetch_att is a fetch attribute if type is MAILIMAP_FETCH_TYPE_FETCH_ATT
+
+  - fetch_att_list is a list of fetch attributes if type is
+    MAILIMAP_FETCH_TYPE_FETCH_ATT_LIST
+*/
+
+struct mailimap_fetch_type {
+  int ft_type;
+  union {
+    struct mailimap_fetch_att * ft_fetch_att;
+    clist * ft_fetch_att_list; /* list of (struct mailimap_fetch_att *) */
+  } ft_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new(int ft_type,
+    struct mailimap_fetch_att * ft_fetch_att,
+    clist * ft_fetch_att_list);
+
+
+LIBETPAN_EXPORT
+void mailimap_fetch_type_free(struct mailimap_fetch_type * fetch_type);
+
+
+
+/*
+  mailimap_store_att_flags is the description of the STORE operation
+  (change flags of a message)
+
+  - sign can be 0 (set flag), +1 (add flag) or -1 (remove flag)
+
+  - silent has a value of 1 if the flags are changed with no server
+    response
+
+  - flag_list is the list of flags to change
+*/
+
+struct mailimap_store_att_flags {
+  int fl_sign;
+  int fl_silent;
+  struct mailimap_flag_list * fl_flag_list;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new(int fl_sign, int fl_silent,
+			     struct mailimap_flag_list * fl_flag_list);
+
+LIBETPAN_EXPORT
+void mailimap_store_att_flags_free(struct mailimap_store_att_flags *
+    store_att_flags);
+
+
+
+/* this is the condition of the SEARCH operation */
+
+enum {
+  MAILIMAP_SEARCH_KEY_ALL,        /* all messages */
+  MAILIMAP_SEARCH_KEY_ANSWERED,   /* messages with the flag \Answered */
+  MAILIMAP_SEARCH_KEY_BCC,        /* messages whose Bcc field contains the
+                                     given string */
+  MAILIMAP_SEARCH_KEY_BEFORE,     /* messages whose internal date is earlier
+                                     than the specified date */
+  MAILIMAP_SEARCH_KEY_BODY,       /* message that contains the given string
+                                     (in header and text parts) */
+  MAILIMAP_SEARCH_KEY_CC,         /* messages whose Cc field contains the
+                                     given string */
+  MAILIMAP_SEARCH_KEY_DELETED,    /* messages with the flag \Deleted */
+  MAILIMAP_SEARCH_KEY_FLAGGED,    /* messages with the flag \Flagged */ 
+  MAILIMAP_SEARCH_KEY_FROM,       /* messages whose From field contains the
+                                     given string */
+  MAILIMAP_SEARCH_KEY_KEYWORD,    /* messages with the flag keyword set */
+  MAILIMAP_SEARCH_KEY_NEW,        /* messages with the flag \Recent and not
+                                     the \Seen flag */
+  MAILIMAP_SEARCH_KEY_OLD,        /* messages that do not have the
+                                     \Recent flag set */
+  MAILIMAP_SEARCH_KEY_ON,         /* messages whose internal date is the
+                                     specified date */
+  MAILIMAP_SEARCH_KEY_RECENT,     /* messages with the flag \Recent */
+  MAILIMAP_SEARCH_KEY_SEEN,       /* messages with the flag \Seen */
+  MAILIMAP_SEARCH_KEY_SINCE,      /* messages whose internal date is later
+                                     than specified date */
+  MAILIMAP_SEARCH_KEY_SUBJECT,    /* messages whose Subject field contains the
+                                     given string */
+  MAILIMAP_SEARCH_KEY_TEXT,       /* messages whose text part contains the
+                                     given string */
+  MAILIMAP_SEARCH_KEY_TO,         /* messages whose To field contains the
+                                     given string */
+  MAILIMAP_SEARCH_KEY_UNANSWERED, /* messages with no flag \Answered */
+  MAILIMAP_SEARCH_KEY_UNDELETED,  /* messages with no flag \Deleted */
+  MAILIMAP_SEARCH_KEY_UNFLAGGED,  /* messages with no flag \Flagged */
+  MAILIMAP_SEARCH_KEY_UNKEYWORD,  /* messages with no flag keyword */ 
+  MAILIMAP_SEARCH_KEY_UNSEEN,     /* messages with no flag \Seen */
+  MAILIMAP_SEARCH_KEY_DRAFT,      /* messages with no flag \Draft */
+  MAILIMAP_SEARCH_KEY_HEADER,     /* messages whose given field 
+                                     contains the given string */
+  MAILIMAP_SEARCH_KEY_LARGER,     /* messages whose size is larger then
+                                     the given size */
+  MAILIMAP_SEARCH_KEY_NOT,        /* not operation of the condition */
+  MAILIMAP_SEARCH_KEY_OR,         /* or operation between two conditions */
+  MAILIMAP_SEARCH_KEY_SENTBEFORE, /* messages whose date given in Date header
+                                     is earlier than the specified date */
+  MAILIMAP_SEARCH_KEY_SENTON,     /* messages whose date given in Date header
+                                     is the specified date */
+  MAILIMAP_SEARCH_KEY_SENTSINCE,  /* messages whose date given in Date header
+                                     is later than specified date */
+  MAILIMAP_SEARCH_KEY_SMALLER,    /* messages whose size is smaller than
+                                     the given size */
+  MAILIMAP_SEARCH_KEY_UID,        /* messages whose unique identifiers are
+                                     in the given range */
+  MAILIMAP_SEARCH_KEY_UNDRAFT,    /* messages with no flag \Draft */
+  MAILIMAP_SEARCH_KEY_SET,        /* messages whose number (or unique
+                                     identifiers in case of UID SEARCH) are
+                                     in the given range */
+  MAILIMAP_SEARCH_KEY_MULTIPLE,   /* the boolean operator between the
+                                     conditions is AND */
+  MAILIMAP_SEARCH_KEY_MODSEQ,     /* mod sequence */
+  MAILIMAP_SEARCH_KEY_XGMTHRID,   /* Gmail thread id */
+  MAILIMAP_SEARCH_KEY_XGMMSGID,   /* Gmail Message id */
+  MAILIMAP_SEARCH_KEY_XGMRAW      /* Gmail RAW expression */
+};
+
+/*
+  mailimap_search_key is the condition on the messages to return
+  
+  - type is the type of the condition
+
+  - bcc is the text to search in the Bcc field when type is
+    MAILIMAP_SEARCH_KEY_BCC, should be allocated with malloc()
+
+  - before is a date when type is MAILIMAP_SEARCH_KEY_BEFORE
+
+  - body is the text to search in the message when type is
+    MAILIMAP_SEARCH_KEY_BODY, should be allocated with malloc()
+
+  - cc is the text to search in the Cc field when type is
+    MAILIMAP_SEARCH_KEY_CC, should be allocated with malloc()
+  
+  - from is the text to search in the From field when type is
+    MAILIMAP_SEARCH_KEY_FROM, should be allocated with malloc()
+
+  - keyword is the keyword flag name when type is MAILIMAP_SEARCH_KEY_KEYWORD,
+    should be allocated with malloc()
+
+  - on is a date when type is MAILIMAP_SEARCH_KEY_ON
+
+  - since is a date when type is MAILIMAP_SEARCH_KEY_SINCE
+  
+  - subject is the text to search in the Subject field when type is
+    MAILIMAP_SEARCH_KEY_SUBJECT, should be allocated with malloc()
+
+  - text is the text to search in the text part of the message when
+    type is MAILIMAP_SEARCH_KEY_TEXT, should be allocated with malloc()
+
+  - to is the text to search in the To field when type is
+    MAILIMAP_SEARCH_KEY_TO, should be allocated with malloc()
+
+  - unkeyword is the keyword flag name when type is
+    MAILIMAP_SEARCH_KEY_UNKEYWORD, should be allocated with malloc()
+
+  - header_name is the header name when type is MAILIMAP_SEARCH_KEY_HEADER,
+    should be allocated with malloc()
+
+  - header_value is the text to search in the given header when type is
+    MAILIMAP_SEARCH_KEY_HEADER, should be allocated with malloc()
+
+  - larger is a size when type is MAILIMAP_SEARCH_KEY_LARGER
+
+  - not is a condition when type is MAILIMAP_SEARCH_KEY_NOT
+
+  - or1 is a condition when type is MAILIMAP_SEARCH_KEY_OR
+
+  - or2 is a condition when type is MAILIMAP_SEARCH_KEY_OR
+  
+  - sentbefore is a date when type is MAILIMAP_SEARCH_KEY_SENTBEFORE
+
+  - senton is a date when type is MAILIMAP_SEARCH_KEY_SENTON
+
+  - sentsince is a date when type is MAILIMAP_SEARCH_KEY_SENTSINCE
+
+  - smaller is a size when type is MAILIMAP_SEARCH_KEY_SMALLER
+
+  - uid is a set of messages when type is MAILIMAP_SEARCH_KEY_UID
+
+  - set is a set of messages when type is MAILIMAP_SEARCH_KEY_SET
+ 
+  - xgmthrid is a number of the gmail thread id when type is MAILIMAP_SEARCH_KEY_XGMTHRID
+    use mailimap_search_key_new_xgmthrid() for this key
+ 
+  - xgmmsgid is a gmail message id expression when type is MAILIMAP_SEARCH_KEY_XGMMSGID
+   use mailimap_search_key_new_xgmmsgid() for this key
+
+  - xgmraw is a raw gmail search expression when type is MAILIMAP_SEARCH_KEY_XGMRAW
+    use mailimap_search_key_new_xgmraw() for this key
+ 
+  - multiple is a set of message when type is MAILIMAP_SEARCH_KEY_MULTIPLE
+*/
+
+enum {
+	MAILIMAP_SEARCH_KEY_MODSEQ_ENTRY_TYPE_REQ_PRIV,
+	MAILIMAP_SEARCH_KEY_MODSEQ_ENTRY_TYPE_REQ_SHARED,
+	MAILIMAP_SEARCH_KEY_MODSEQ_ENTRY_TYPE_REQ_ALL,
+};
+
+struct mailimap_search_key {
+  int sk_type;
+  union {
+    char * sk_bcc;
+    struct mailimap_date * sk_before;
+    char * sk_body;
+    char * sk_cc;
+    char * sk_from;
+    char * sk_keyword;
+    struct mailimap_date * sk_on;
+    struct mailimap_date * sk_since;
+    char * sk_subject;
+    char * sk_text;
+    char * sk_to;
+    char * sk_unkeyword;
+    struct {
+      char * sk_header_name;
+      char * sk_header_value;
+    } sk_header;
+    uint32_t sk_larger;
+    struct mailimap_search_key * sk_not;
+    struct {
+      struct mailimap_search_key * sk_or1;
+      struct mailimap_search_key * sk_or2;
+    } sk_or;
+    struct mailimap_date * sk_sentbefore;
+    struct mailimap_date * sk_senton;
+    struct mailimap_date * sk_sentsince;
+    uint32_t sk_smaller;
+    struct mailimap_set * sk_uid;
+    struct mailimap_set * sk_set;
+    uint64_t sk_xgmthrid;
+    uint64_t sk_xgmmsgid;
+    char * sk_xgmraw;
+    clist * sk_multiple; /* list of (struct mailimap_search_key *) */
+    struct {
+      struct mailimap_flag * sk_entry_name;
+      int sk_entry_type_req;
+      uint64_t sk_modseq_valzer;
+    } sk_modseq;
+  } sk_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new(int sk_type,
+    char * sk_bcc, struct mailimap_date * sk_before, char * sk_body,
+    char * sk_cc, char * sk_from, char * sk_keyword,
+    struct mailimap_date * sk_on, struct mailimap_date * sk_since,
+    char * sk_subject, char * sk_text, char * sk_to,
+    char * sk_unkeyword, char * sk_header_name,
+    char * sk_header_value, uint32_t sk_larger,
+    struct mailimap_search_key * sk_not,
+    struct mailimap_search_key * sk_or1,
+    struct mailimap_search_key * sk_or2,
+    struct mailimap_date * sk_sentbefore,
+    struct mailimap_date * sk_senton,
+    struct mailimap_date * sk_sentsince,
+    uint32_t sk_smaller, struct mailimap_set * sk_uid,
+    struct mailimap_set * sk_set, clist * sk_multiple);
+  
+/*
+  this function creates a condition structure to match messages with
+  the given gmail thread id
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_xgmthrid(uint64_t sk_xgmthrid);
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_xgmmsgid(uint64_t sk_xgmmsgid);
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_xgmraw(char * sk_xgmraw);
+
+LIBETPAN_EXPORT
+void mailimap_search_key_free(struct mailimap_search_key * key);
+
+/*
+  mailimap_status_att_list is a list of mailbox STATUS request type
+
+  - list is a list of mailbox STATUS request type
+    (value of elements in the list can be MAILIMAP_STATUS_ATT_MESSAGES,
+    MAILIMAP_STATUS_ATT_RECENT, MAILIMAP_STATUS_ATT_UIDNEXT,
+    MAILIMAP_STATUS_ATT_UIDVALIDITY or MAILIMAP_STATUS_ATT_UNSEEN),
+    each element should be allocated with malloc()
+*/
+
+struct mailimap_status_att_list {
+  clist * att_list; /* list of (uint32_t *) */
+};
+
+LIBETPAN_EXPORT
+struct mailimap_status_att_list *
+mailimap_status_att_list_new(clist * att_list);
+
+LIBETPAN_EXPORT
+void mailimap_status_att_list_free(struct mailimap_status_att_list *
+    status_att_list);
+
+
+
+
+/* internal use functions */
+
+
+LIBETPAN_EXPORT
+uint32_t * mailimap_number_alloc_new(uint32_t number);
+
+LIBETPAN_EXPORT
+void mailimap_number_alloc_free(uint32_t * pnumber);
+
+
+LIBETPAN_EXPORT
+void mailimap_addr_host_free(char * addr_host);
+
+LIBETPAN_EXPORT
+void mailimap_addr_mailbox_free(char * addr_mailbox);
+
+LIBETPAN_EXPORT
+void mailimap_addr_adl_free(char * addr_adl);
+
+LIBETPAN_EXPORT
+void mailimap_addr_name_free(char * addr_name);
+
+LIBETPAN_EXPORT
+void mailimap_astring_free(char * astring);
+
+LIBETPAN_EXPORT
+void mailimap_atom_free(char * atom);
+
+LIBETPAN_EXPORT
+void mailimap_auth_type_free(char * auth_type);
+
+LIBETPAN_EXPORT
+void mailimap_base64_free(char * base64);
+
+LIBETPAN_EXPORT
+void mailimap_body_fld_desc_free(char * body_fld_desc);
+
+LIBETPAN_EXPORT
+void mailimap_body_fld_id_free(char * body_fld_id);
+
+LIBETPAN_EXPORT
+void mailimap_body_fld_md5_free(char * body_fld_md5);
+
+LIBETPAN_EXPORT
+void mailimap_body_fld_loc_free(char * body_fld_loc);
+
+LIBETPAN_EXPORT
+void mailimap_env_date_free(char * date);
+
+LIBETPAN_EXPORT
+void mailimap_env_in_reply_to_free(char * in_reply_to);
+
+LIBETPAN_EXPORT
+void mailimap_env_message_id_free(char * message_id);
+
+LIBETPAN_EXPORT
+void mailimap_env_subject_free(char * subject);
+
+LIBETPAN_EXPORT
+void mailimap_flag_extension_free(char * flag_extension);
+
+LIBETPAN_EXPORT
+void mailimap_flag_keyword_free(char * flag_keyword);
+
+LIBETPAN_EXPORT
+void
+mailimap_header_fld_name_free(char * header_fld_name);
+
+LIBETPAN_EXPORT
+void mailimap_literal_free(char * literal);
+
+LIBETPAN_EXPORT
+void mailimap_mailbox_free(char * mailbox);
+
+LIBETPAN_EXPORT
+void
+mailimap_mailbox_data_search_free(clist * data_search);
+
+LIBETPAN_EXPORT
+void mailimap_media_subtype_free(char * media_subtype);
+
+LIBETPAN_EXPORT
+void mailimap_media_text_free(char * media_text);
+
+LIBETPAN_EXPORT
+void mailimap_msg_att_envelope_free(struct mailimap_envelope * env);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_internaldate_free(struct mailimap_date_time * date_time);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_rfc822_free(char * str);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_rfc822_header_free(char * str);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_rfc822_text_free(char * str);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_body_free(struct mailimap_body * body);
+
+LIBETPAN_EXPORT
+void
+mailimap_msg_att_bodystructure_free(struct mailimap_body * body);
+
+LIBETPAN_EXPORT
+void mailimap_nstring_free(char * str);
+
+LIBETPAN_EXPORT
+void
+mailimap_string_free(char * str);
+
+LIBETPAN_EXPORT
+void mailimap_tag_free(char * tag);
+
+LIBETPAN_EXPORT
+void mailimap_text_free(char * text);
+
+
+
+
+
+/* IMAP connection */
+
+/* this is the state of the IMAP connection */
+
+enum {
+  MAILIMAP_STATE_DISCONNECTED,
+  MAILIMAP_STATE_NON_AUTHENTICATED,
+  MAILIMAP_STATE_AUTHENTICATED,
+  MAILIMAP_STATE_SELECTED,
+  MAILIMAP_STATE_LOGOUT
+};
+
+/*
+  mailimap is an IMAP connection
+
+  - response is a human readable message returned with a reponse,
+    must be accessed read-only
+
+  - stream is the connection with the IMAP server
+
+  - stream_buffer is the buffer where the data to parse are stored
+
+  - state is the state of IMAP connection
+
+  - tag is the current tag being used in IMAP connection
+
+  - response_buffer is the buffer for response messages
+
+  - connection_info is the information returned in response
+    for the last command about the connection
+
+  - selection_info is the information returned in response
+    for the last command about the current selected mailbox
+
+  - response_info is the other information returned in response
+    for the last command
+*/
+
+typedef void mailimap_msg_att_handler(struct mailimap_msg_att * msg_att, void * context);
+
+typedef bool mailimap_msg_body_handler(int msg_att_type, struct mailimap_msg_att_body_section * section,
+                                       const char * bytes, size_t length, void * context);
+
+typedef struct mailimap mailimap;
+
+struct mailimap {
+  char * imap_response;
+  
+  /* internals */
+  mailstream * imap_stream;
+
+  size_t imap_progr_rate;
+  progress_function * imap_progr_fun;
+
+  MMAPString * imap_stream_buffer;
+  MMAPString * imap_response_buffer;
+
+  int imap_state;
+  int imap_tag;
+
+  struct mailimap_connection_info * imap_connection_info;
+  struct mailimap_selection_info * imap_selection_info;
+  struct mailimap_response_info * imap_response_info;
+  
+  struct {
+    void * sasl_conn;
+    const char * sasl_server_fqdn;
+    const char * sasl_login;
+    const char * sasl_auth_name;
+    const char * sasl_password;
+    const char * sasl_realm;
+    void * sasl_secret;
+  } imap_sasl;
+  
+  time_t imap_idle_timestamp;
+  time_t imap_idle_maxdelay;
+
+  mailprogress_function * imap_body_progress_fun;
+  mailprogress_function * imap_items_progress_fun;
+  void * imap_progress_context;
+  mailimap_msg_att_handler * imap_msg_att_handler;
+  void * imap_msg_att_handler_context;
+  mailimap_msg_body_handler * imap_msg_body_handler;
+  void * imap_msg_body_handler_context;
+
+  time_t imap_timeout;
+  
+  void (* imap_logger)(mailimap * session, int log_type, const char * str, size_t size, void * context);
+  void * imap_logger_context;
+  
+  int is_163_workaround_enabled;
+  int is_rambler_workaround_enabled;
+};
+
+
+
+/*
+  mailimap_connection_info is the information about the connection
+  
+  - capability is the list of capability of the IMAP server
+*/
+
+struct mailimap_connection_info {
+  struct mailimap_capability_data * imap_capability;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_connection_info *
+mailimap_connection_info_new(void);
+
+LIBETPAN_EXPORT
+void
+mailimap_connection_info_free(struct mailimap_connection_info * conn_info);
+
+
+/* this is the type of mailbox access */
+
+enum {
+  MAILIMAP_MAILBOX_READONLY,
+  MAILIMAP_MAILBOX_READWRITE
+};
+
+/*
+  mailimap_selection_info is information about the current selected mailbox
+
+  - perm_flags is a list of flags that can be changed permanently on the
+    messages of the mailbox
+
+  - perm is the access on the mailbox, value can be
+    MAILIMAP_MAILBOX_READONLY or MAILIMAP_MAILBOX_READWRITE
+
+  - uidnext is the next unique identifier
+
+  - uidvalidity is the unique identifiers validity
+
+  - first_unseen is the number of the first unseen message
+
+  - flags is a list of flags that can be used on the messages of
+    the mailbox
+
+  - exists is the number of messages in the mailbox
+  
+  - recent is the number of recent messages in the mailbox
+
+  - unseen is the number of unseen messages in the mailbox
+*/
+
+struct mailimap_selection_info {
+  clist * sel_perm_flags; /* list of (struct flag_perm *) */
+  int sel_perm;
+  uint32_t sel_uidnext;
+  uint32_t sel_uidvalidity;
+  uint32_t sel_first_unseen;
+  struct mailimap_flag_list * sel_flags;
+  uint32_t sel_exists;
+  uint32_t sel_recent;
+  uint32_t sel_unseen;
+  uint8_t  sel_has_exists:1;
+  uint8_t  sel_has_recent:1;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_selection_info *
+mailimap_selection_info_new(void);
+
+LIBETPAN_EXPORT
+void
+mailimap_selection_info_free(struct mailimap_selection_info * sel_info);
+
+
+/*
+  mailimap_response_info is the other information returned in the 
+  response for a command
+
+  - alert is the human readable text returned with ALERT response
+
+  - parse is the human readable text returned with PARSE response
+
+  - badcharset is a list of charset returned with a BADCHARSET response
+
+  - trycreate is set to 1 if a trycreate response was returned
+  
+  - mailbox_list is a list of mailboxes
+  
+  - mailbox_lsub is a list of subscribed mailboxes
+
+  - search_result is a list of message numbers or unique identifiers
+
+  - status is a STATUS response
+
+  - expunged is a list of message numbers
+
+  - fetch_list is a list of fetch response
+*/
+
+struct mailimap_response_info {
+  char * rsp_alert;
+  char * rsp_parse;
+  clist * rsp_badcharset; /* list of (char *) */
+  int rsp_trycreate;
+  clist * rsp_mailbox_list; /* list of (struct mailimap_mailbox_list *) */
+  clist * rsp_mailbox_lsub; /* list of (struct mailimap_mailbox_list *) */
+  clist * rsp_search_result; /* list of (uint32_t *) */
+  struct mailimap_mailbox_data_status * rsp_status;
+  clist * rsp_expunged; /* list of (uint32_t 32 *) */
+  clist * rsp_fetch_list; /* list of (struct mailimap_msg_att *) */
+  clist * rsp_extension_list; /* list of (struct mailimap_extension_data *) */
+  char * rsp_atom;
+  char * rsp_value;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_response_info *
+mailimap_response_info_new(void);
+
+LIBETPAN_EXPORT
+void
+mailimap_response_info_free(struct mailimap_response_info * resp_info);
+
+
+/* these are the possible returned error codes */
+
+enum {
+  MAILIMAP_NO_ERROR = 0,
+  MAILIMAP_NO_ERROR_AUTHENTICATED = 1,
+  MAILIMAP_NO_ERROR_NON_AUTHENTICATED = 2,
+  MAILIMAP_ERROR_BAD_STATE,
+  MAILIMAP_ERROR_STREAM,
+  MAILIMAP_ERROR_PARSE,
+  MAILIMAP_ERROR_CONNECTION_REFUSED,
+  MAILIMAP_ERROR_MEMORY,
+  MAILIMAP_ERROR_FATAL,
+  MAILIMAP_ERROR_PROTOCOL,
+  MAILIMAP_ERROR_DONT_ACCEPT_CONNECTION,
+  MAILIMAP_ERROR_APPEND,
+  MAILIMAP_ERROR_NOOP,
+  MAILIMAP_ERROR_LOGOUT,
+  MAILIMAP_ERROR_CAPABILITY,
+  MAILIMAP_ERROR_CHECK,
+  MAILIMAP_ERROR_CLOSE,
+  MAILIMAP_ERROR_EXPUNGE,
+  MAILIMAP_ERROR_COPY,
+  MAILIMAP_ERROR_UID_COPY,
+  MAILIMAP_ERROR_MOVE,
+  MAILIMAP_ERROR_UID_MOVE,
+  MAILIMAP_ERROR_CREATE,
+  MAILIMAP_ERROR_DELETE,
+  MAILIMAP_ERROR_EXAMINE,
+  MAILIMAP_ERROR_FETCH,
+  MAILIMAP_ERROR_UID_FETCH,
+  MAILIMAP_ERROR_LIST,
+  MAILIMAP_ERROR_LOGIN,
+  MAILIMAP_ERROR_LSUB,
+  MAILIMAP_ERROR_RENAME,
+  MAILIMAP_ERROR_SEARCH,
+  MAILIMAP_ERROR_UID_SEARCH,
+  MAILIMAP_ERROR_SELECT,
+  MAILIMAP_ERROR_STATUS,
+  MAILIMAP_ERROR_STORE,
+  MAILIMAP_ERROR_UID_STORE,
+  MAILIMAP_ERROR_SUBSCRIBE,
+  MAILIMAP_ERROR_UNSUBSCRIBE,
+  MAILIMAP_ERROR_STARTTLS,
+  MAILIMAP_ERROR_INVAL,
+  MAILIMAP_ERROR_EXTENSION,
+  MAILIMAP_ERROR_SASL,
+  MAILIMAP_ERROR_SSL,
+  MAILIMAP_ERROR_NEEDS_MORE_DATA,
+  MAILIMAP_ERROR_CUSTOM_COMMAND
+};
+
+/* information about parser context */
+
+struct mailimap_parser_context {
+  int is_rambler_workaround_enabled;
+
+  mailimap_msg_body_handler * msg_body_handler;
+  void * msg_body_handler_context;
+  struct mailimap_msg_att_body_section * msg_body_section;
+  int msg_body_att_type;
+  bool msg_body_parse_in_progress;
+};
+
+LIBETPAN_EXPORT
+struct mailimap_parser_context *
+mailimap_parser_context_new(mailimap * session);
+
+LIBETPAN_EXPORT
+void
+mailimap_parser_context_free(struct mailimap_parser_context * ctx);
+
+LIBETPAN_EXPORT
+int
+mailimap_parser_context_is_rambler_workaround_enabled(struct mailimap_parser_context * parser_ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

+ 849 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimap_types_helper.h

@@ -0,0 +1,849 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimap_types_helper.h,v 1.12 2008/02/20 22:15:52 hoa Exp $
+ */
+
+#ifndef MAILIMAP_TYPES_HELPER_H
+
+#define MAILIMAP_TYPES_HELPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimap_types.h>
+
+/*
+  IMPORTANT NOTE:
+  
+  All allocation functions will take as argument allocated data
+  and will store these data in the structure they will allocate.
+  Data should be persistant during all the use of the structure
+  and will be freed by the free function of the structure
+
+  allocation functions will return NULL on failure
+*/
+
+/*
+  this function creates a new set item with a single message
+  given by indx
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_set_item * mailimap_set_item_new_single(uint32_t indx);
+
+/*
+  this function creates a new set with one set item
+ */
+
+LIBETPAN_EXPORT
+struct mailimap_set *
+mailimap_set_new_single_item(struct mailimap_set_item * item);
+
+/*
+  this function creates a set with a single interval
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_set * mailimap_set_new_interval(uint32_t first, uint32_t last);
+
+/*
+  this function creates a set with a single message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_set * mailimap_set_new_single(uint32_t indx);
+
+/*
+  this function creates an empty set of messages
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_set * mailimap_set_new_empty(void);
+
+/*
+  this function adds a set item to the set of messages
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimap_set_add(struct mailimap_set * set,
+		struct mailimap_set_item * set_item);
+
+/*
+  this function adds an interval to the set
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimap_set_add_interval(struct mailimap_set * set,
+		uint32_t first, uint32_t last);
+
+/*
+  this function adds a single message to the set
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimap_set_add_single(struct mailimap_set * set,
+			 uint32_t indx);
+
+/*
+  this function creates a mailimap_section structure to request
+  the header of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section * mailimap_section_new_header(void);
+
+/*
+  this functions creates a mailimap_section structure to describe
+  a list of headers
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_header_fields(struct mailimap_header_list * header_list);
+
+/*
+  this functions creates a mailimap_section structure to describe headers
+  other than those given
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_header_fields_not(struct mailimap_header_list * header_list);
+
+/*
+  this function creates a mailimap_section structure to describe the
+  text of a message
+ */
+
+LIBETPAN_EXPORT
+struct mailimap_section * mailimap_section_new_text(void);
+
+/*
+  this function creates a mailimap_section structure to describe the 
+  content of a MIME part
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_part(struct mailimap_section_part * part);
+
+/*
+  this function creates a mailimap_section structure to describe the
+  MIME fields of a MIME part
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_part_mime(struct mailimap_section_part * part);
+
+/*
+  this function creates a mailimap_section structure to describe the
+  headers of a MIME part if the MIME type is a message/rfc822
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_part_header(struct mailimap_section_part * part);
+
+/*
+  this function creates a mailimap_section structure to describe
+  a list of headers of a MIME part if the MIME type is a message/rfc822
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_part_header_fields(struct mailimap_section_part *
+					part,
+					struct mailimap_header_list *
+					header_list);
+
+/*
+  this function creates a mailimap_section structure to describe
+  headers of a MIME part other than those given if the MIME type
+  is a message/rfc822
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_part_header_fields_not(struct mailimap_section_part
+					    * part,
+					    struct mailimap_header_list
+					    * header_list);
+
+/*
+  this function creates a mailimap_section structure to describe
+  text part of message if the MIME type is a message/rfc822
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_section *
+mailimap_section_new_part_text(struct mailimap_section_part * part);
+
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  envelope of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_envelope(void);
+
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  flags of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_flags(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  internal date of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_internaldate(void);
+
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  text part of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_rfc822(void);
+
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  header of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_rfc822_header(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  size of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_rfc822_size(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  envelope of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_rfc822_text(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  the MIME structure of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_body(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  the MIME structure of a message and additional MIME information
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_bodystructure(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  unique identifier of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_uid(void);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  a given section of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_body_section(struct mailimap_section * section);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  a given section of a message without marking it as read
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_body_peek_section(struct mailimap_section * section);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  a part of a section of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_body_section_partial(struct mailimap_section * section,
+					    uint32_t offset, uint32_t size);
+
+/*
+  this function creates a mailimap_fetch_att structure to request
+  a part of a section of a message without marking it as read
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+mailimap_fetch_att_new_body_peek_section_partial(struct mailimap_section * section,
+						 uint32_t offset, uint32_t size);
+
+/*
+ creates a mailimap_fetch_att extension
+*/
+    
+LIBETPAN_EXPORT
+struct mailimap_fetch_att *
+    mailimap_fetch_att_new_extension(char * ext_keyword);
+
+/*
+  this function creates a mailimap_fetch_type structure to request
+  (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) of a message
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new_all(void);
+
+/*
+  this function creates a mailimap_fetch_type structure to request
+  (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new_full(void);
+
+/*
+  this function creates a mailimap_fetch_type structure to request
+  (FLAGS INTERNALDATE RFC822.SIZE)
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new_fast(void);
+
+/*
+  this function creates a mailimap_fetch_type structure to request
+  the given fetch attribute
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new_fetch_att(struct mailimap_fetch_att * fetch_att);
+
+/*
+  this function creates a mailimap_fetch_type structure to request
+  the list of fetch attributes
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new_fetch_att_list(clist * fetch_att_list);
+
+/*
+  this function creates a mailimap_fetch_type structure
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_fetch_type *
+mailimap_fetch_type_new_fetch_att_list_empty(void);
+
+/*
+  this function adds a given fetch attribute to the mailimap_fetch
+  structure
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_fetch_type_new_fetch_att_list_add(struct mailimap_fetch_type *
+					   fetch_type,
+					   struct mailimap_fetch_att *
+					   fetch_att);
+
+/*
+  this function creates a store attribute to set the given flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new_set_flags(struct mailimap_flag_list * flags);
+
+/*
+  this function creates a store attribute to silently set the given flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new_set_flags_silent(struct mailimap_flag_list *
+					      flags);
+
+/*
+  this function creates a store attribute to add the given flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new_add_flags(struct mailimap_flag_list * flags);
+
+/*
+  this function creates a store attribute to add silently the given flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new_add_flags_silent(struct mailimap_flag_list *
+					      flags);
+
+/*
+  this function creates a store attribute to remove the given flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new_remove_flags(struct mailimap_flag_list * flags);
+
+/*
+  this function creates a store attribute to remove silently the given flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new_remove_flags_silent(struct mailimap_flag_list *
+						 flags);
+
+
+/*
+  this function creates a condition structure to match all messages
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_all(void);
+
+/*
+  this function creates a condition structure to match messages with Bcc field
+  
+  @param bcc this is the content of Bcc to match, it should be allocated
+    with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_bcc(char * sk_bcc);
+
+/*
+  this function creates a condition structure to match messages with
+  internal date
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_before(struct mailimap_date * sk_before);
+
+/*
+  this function creates a condition structure to match messages with
+  message content
+
+  @param body this is the content of the message to match, it should
+    be allocated with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_body(char * sk_body);
+
+/*
+  this function creates a condition structure to match messages with 
+  Cc field
+
+  
+  @param cc this is the content of Cc to match, it should be allocated
+    with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_cc(char * sk_cc);
+
+/*
+  this function creates a condition structure to match messages with 
+  From field
+
+  @param from this is the content of From to match, it should be allocated
+    with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_from(char * sk_from);
+
+/*
+  this function creates a condition structure to match messages with 
+  a flag given by keyword
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_keyword(char * sk_keyword);
+
+/*
+  this function creates a condition structure to match messages with
+  internal date
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_on(struct mailimap_date * sk_on);
+
+/*
+  this function creates a condition structure to match messages with
+  internal date
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_since(struct mailimap_date * sk_since);
+
+/*
+  this function creates a condition structure to match messages with 
+  Subject field
+
+  @param subject this is the content of Subject to match, it should
+    be allocated with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_subject(char * sk_subject);
+
+/*
+  this function creates a condition structure to match messages with
+  message text part
+
+  @param text this is the message text to match, it should
+    be allocated with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_text(char * sk_text);
+
+/*
+  this function creates a condition structure to match messages with 
+  To field
+
+  @param to this is the content of To to match, it should be allocated
+    with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_to(char * sk_to);
+
+/*
+  this function creates a condition structure to match messages with 
+  no a flag given by unkeyword
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_unkeyword(char * sk_unkeyword);
+
+/*
+  this function creates a condition structure to match messages with 
+  the given field
+
+  @param header_name this is the name of the field to match, it
+    should be allocated with malloc()
+
+  @param header_value this is the content, it should be allocated
+    with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_header(char * sk_header_name, char * sk_header_value);
+  
+/*
+  this function creates a condition structure to match messages with size
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_larger(uint32_t sk_larger);
+
+/*
+  this function creates a condition structure to match messages that
+  do not match the given condition
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_not(struct mailimap_search_key * sk_not);
+
+/*
+  this function creates a condition structure to match messages that
+  match one of the given conditions
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_or(struct mailimap_search_key * sk_or1,
+			   struct mailimap_search_key * sk_or2);
+
+/*
+  this function creates a condition structure to match messages
+  with Date field
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_sentbefore(struct mailimap_date * sk_sentbefore);
+
+/*
+  this function creates a condition structure to match messages
+  with Date field
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_senton(struct mailimap_date * sk_senton);
+
+/*
+  this function creates a condition structure to match messages
+  with Date field
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_sentsince(struct mailimap_date * sk_sentsince);
+
+/*
+  this function creates a condition structure to match messages with size
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_smaller(uint32_t sk_smaller);
+
+/*
+  this function creates a condition structure to match messages with unique
+  identifier
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_uid(struct mailimap_set * sk_uid);
+
+/*
+  this function creates a condition structure to match messages with number
+  or unique identifier (depending whether SEARCH or UID SEARCH is used)
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_set(struct mailimap_set * sk_set);
+
+/*
+  this function creates a condition structure to match messages that match
+  all the conditions given in the list
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_multiple(clist * sk_multiple);
+
+
+/*
+  same as previous but the list is empty
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_search_key *
+mailimap_search_key_new_multiple_empty(void);
+
+/*
+  this function adds a condition to the condition list
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_search_key_multiple_add(struct mailimap_search_key * keys,
+				 struct mailimap_search_key * key_item);
+
+
+
+/*
+  this function creates an empty list of flags
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag_list *
+mailimap_flag_list_new_empty(void);
+
+/*
+  this function adds a flag to the list of flags
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimap_flag_list_add(struct mailimap_flag_list * flag_list,
+				struct mailimap_flag * f);
+
+/*
+  this function creates a \Answered flag
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_answered(void);
+
+/*
+  this function creates a \Flagged flag
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_flagged(void);
+
+/*
+  this function creates a \Deleted flag
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_deleted(void);
+
+/*
+  this function creates a \Seen flag
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_seen(void);
+
+/*
+  this function creates a \Draft flag
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_draft(void);
+
+/*
+  this function creates a keyword flag
+
+  @param flag_keyword this should be allocated with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_flag_keyword(char * flag_keyword);
+
+
+/*
+  this function creates an extension flag
+
+  @param flag_extension this should be allocated with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_flag * mailimap_flag_new_flag_extension(char * flag_extension);
+
+/*
+  this function creates an empty list of status attributes
+*/
+
+LIBETPAN_EXPORT
+struct mailimap_status_att_list * mailimap_status_att_list_new_empty(void);
+
+/*
+  this function adds status attributes to the list
+
+  @return MAILIMAP_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int
+mailimap_status_att_list_add(struct mailimap_status_att_list * sa_list,
+			     int status_att);
+
+/* return mailimap_section_part from a given mailimap_body */
+
+LIBETPAN_EXPORT
+int mailimap_get_section_part_from_body(struct mailimap_body * root_part,
+    struct mailimap_body * part,
+    struct mailimap_section_part ** result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 368 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf.h

@@ -0,0 +1,368 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimf.h,v 1.28 2008/05/27 10:07:55 hoa Exp $
+ */
+
+#ifndef MAILIMF_H
+
+#define MAILIMF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimf_types.h>
+#include <libetpan/mailimf_write_generic.h>
+#include <libetpan/mailimf_write_file.h>
+#include <libetpan/mailimf_write_mem.h>
+#include <libetpan/mailimf_types_helper.h>
+
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#	include <sys/types.h>
+#endif
+
+/*
+  mailimf_message_parse will parse the given message
+  
+  @param message this is a string containing the message content
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the message in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_message_parse(const char * message, size_t length,
+			  size_t * indx,
+			  struct mailimf_message ** result);
+
+/*
+  mailimf_body_parse will parse the given text part of a message
+  
+  @param message this is a string containing the message text part
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the message text part in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_body_parse(const char * message, size_t length,
+		       size_t * indx,
+		       struct mailimf_body ** result);
+
+/*
+  mailimf_fields_parse will parse the given header fields
+  
+  @param message this is a string containing the header fields
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the header fields in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_fields_parse(const char * message, size_t length,
+			 size_t * indx,
+			 struct mailimf_fields ** result);
+
+/*
+  mailimf_mailbox_list_parse will parse the given mailbox list
+  
+  @param message this is a string containing the mailbox list
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the mailbox list in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int
+mailimf_mailbox_list_parse(const char * message, size_t length,
+			   size_t * indx,
+			   struct mailimf_mailbox_list ** result);
+
+/*
+  mailimf_address_list_parse will parse the given address list
+  
+  @param message this is a string containing the address list
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the address list in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int
+mailimf_address_list_parse(const char * message, size_t length,
+			   size_t * indx,
+			   struct mailimf_address_list ** result);
+
+/*
+  mailimf_address_parse will parse the given address
+  
+  @param message this is a string containing the address
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the address in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_address_parse(const char * message, size_t length,
+			  size_t * indx,
+			  struct mailimf_address ** result);
+
+/*
+  mailimf_mailbox_parse will parse the given address
+  
+  @param message this is a string containing the mailbox
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the mailbox in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_mailbox_parse(const char * message, size_t length,
+			  size_t * indx,
+			  struct mailimf_mailbox ** result);
+
+/*
+  mailimf_date_time_parse will parse the given RFC 2822 date
+  
+  @param message this is a string containing the date
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the date in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_date_time_parse(const char * message, size_t length,
+			    size_t * indx,
+			    struct mailimf_date_time ** result);
+
+/*
+  mailimf_envelope_fields_parse will parse the given fields (Date,
+  From, Sender, Reply-To, To, Cc, Bcc, Message-ID, In-Reply-To,
+  References and Subject)
+  
+  @param message this is a string containing the header fields
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the header fields in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int mailimf_envelope_fields_parse(const char * message, size_t length,
+				  size_t * indx,
+				  struct mailimf_fields ** result);
+
+/*
+  mailimf_ignore_field_parse will skip the given field
+  
+  @param message this is a string containing the header field
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the header field in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+
+LIBETPAN_EXPORT
+int mailimf_ignore_field_parse(const char * message, size_t length,
+			       size_t * indx);
+
+/*
+  mailimf_envelope_fields will parse the given fields (Date,
+  From, Sender, Reply-To, To, Cc, Bcc, Message-ID, In-Reply-To,
+  References and Subject), other fields will be added as optional
+  fields.
+  
+  @param message this is a string containing the header fields
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the header fields in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+
+LIBETPAN_EXPORT
+int
+mailimf_envelope_and_optional_fields_parse(const char * message, size_t length,
+					   size_t * indx,
+					   struct mailimf_fields ** result);
+
+/*
+  mailimf_envelope_fields will parse the given fields as optional
+  fields.
+  
+  @param message this is a string containing the header fields
+  @param length this is the size of the given string
+  @param indx this is a pointer to the start of the header fields in
+    the given string, (* indx) is modified to point at the end
+    of the parsed data
+  @param result the result of the parse operation is stored in
+    (* result)
+
+  @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
+*/
+LIBETPAN_EXPORT
+int
+mailimf_optional_fields_parse(const char * message, size_t length,
+			      size_t * indx,
+			      struct mailimf_fields ** result);
+
+
+/* internal use, exported for MIME */
+
+LIBETPAN_EXPORT
+int mailimf_fws_parse(const char * message, size_t length, size_t * indx);
+
+LIBETPAN_EXPORT
+int mailimf_cfws_parse(const char * message, size_t length,
+		       size_t * indx);
+
+LIBETPAN_EXPORT
+int mailimf_char_parse(const char * message, size_t length,
+		       size_t * indx, char token);
+
+LIBETPAN_EXPORT
+int mailimf_unstrict_char_parse(const char * message, size_t length,
+				size_t * indx, char token);
+
+LIBETPAN_EXPORT
+int mailimf_crlf_parse(const char * message, size_t length, size_t * indx);
+
+LIBETPAN_EXPORT
+int
+mailimf_custom_string_parse(const char * message, size_t length,
+			    size_t * indx, char ** result,
+			    int (* is_custom_char)(char));
+
+LIBETPAN_EXPORT
+int
+mailimf_token_case_insensitive_len_parse(const char * message, size_t length,
+					 size_t * indx, char * token,
+					 size_t token_length);
+
+#define mailimf_token_case_insensitive_parse(message, length, indx, token) \
+    mailimf_token_case_insensitive_len_parse(message, length, indx, token, \
+					     strlen(token))
+
+LIBETPAN_EXPORT
+int mailimf_quoted_string_parse(const char * message, size_t length,
+				size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int
+mailimf_number_parse(const char * message, size_t length,
+		     size_t * indx, uint32_t * result);
+
+LIBETPAN_EXPORT
+int mailimf_msg_id_parse(const char * message, size_t length,
+			 size_t * indx,
+			 char ** result);
+
+LIBETPAN_EXPORT
+int mailimf_msg_id_list_parse(const char * message, size_t length,
+			      size_t * indx, clist ** result);
+
+LIBETPAN_EXPORT
+int mailimf_word_parse(const char * message, size_t length,
+		       size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int mailimf_atom_parse(const char * message, size_t length,
+		       size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int mailimf_fws_atom_parse(const char * message, size_t length,
+			   size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int mailimf_fws_word_parse(const char * message, size_t length,
+                           size_t * indx, char ** result, int * p_missing_closing_quote);
+
+LIBETPAN_EXPORT
+int mailimf_fws_quoted_string_parse(const char * message, size_t length,
+				    size_t * indx, char ** result);
+
+/* exported for IMAP */
+
+LIBETPAN_EXPORT
+int mailimf_references_parse(const char * message, size_t length,
+			     size_t * indx,
+			     struct mailimf_references ** result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 864 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_types.h

@@ -0,0 +1,864 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+/*
+ * $Id: mailimf_types.h,v 1.34 2006/05/22 13:39:42 hoa Exp $
+ */
+
+#ifndef MAILIMF_TYPES_H
+
+#define MAILIMF_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/clist.h>
+#include <sys/types.h>
+
+/*
+  IMPORTANT NOTE:
+  
+  All allocation functions will take as argument allocated data
+  and will store these data in the structure they will allocate.
+  Data should be persistant during all the use of the structure
+  and will be freed by the free function of the structure
+
+  allocation functions will return NULL on failure
+*/
+
+/*
+  mailimf_date_time is a date
+  
+  - day is the day of month (1 to 31)
+
+  - month (1 to 12)
+
+  - year (4 digits)
+
+  - hour (0 to 23)
+
+  - min (0 to 59)
+
+  - sec (0 to 59)
+
+  - zone (this is the decimal value that we can read, for example:
+    for "-0200", the value is -200)
+*/
+
+struct mailimf_date_time {
+  int dt_day;
+  int dt_month;
+  int dt_year;
+  int dt_hour;
+  int dt_min;
+  int dt_sec;
+  int dt_zone;
+};
+
+LIBETPAN_EXPORT
+struct mailimf_date_time *
+mailimf_date_time_new(int dt_day, int dt_month, int dt_year,
+    int dt_hour, int dt_min, int dt_sec, int dt_zone);
+
+LIBETPAN_EXPORT
+void mailimf_date_time_free(struct mailimf_date_time * date_time);
+
+
+
+/* this is the type of address */
+
+enum {
+  MAILIMF_ADDRESS_ERROR,   /* on parse error */
+  MAILIMF_ADDRESS_MAILBOX, /* if this is a mailbox (mailbox@domain) */
+  MAILIMF_ADDRESS_GROUP    /* if this is a group
+                              (group_name: address1@domain1,
+                                  address2@domain2; ) */
+};
+
+/*
+  mailimf_address is an address
+
+  - type can be MAILIMF_ADDRESS_MAILBOX or MAILIMF_ADDRESS_GROUP
+
+  - mailbox is a mailbox if type is MAILIMF_ADDRESS_MAILBOX
+
+  - group is a group if type is MAILIMF_ADDRESS_GROUP
+*/
+
+struct mailimf_address {
+  int ad_type;
+  union {
+    struct mailimf_mailbox * ad_mailbox; /* can be NULL */
+    struct mailimf_group * ad_group;     /* can be NULL */
+  } ad_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimf_address *
+mailimf_address_new(int ad_type, struct mailimf_mailbox * ad_mailbox,
+    struct mailimf_group * ad_group);
+
+LIBETPAN_EXPORT
+void mailimf_address_free(struct mailimf_address * address);
+
+
+
+/*
+  mailimf_mailbox is a mailbox
+
+  - display_name is the name that will be displayed for this mailbox,
+    for example 'name' in '"name" <mailbox@domain>,
+    should be allocated with malloc()
+  
+  - addr_spec is the mailbox, for example 'mailbox@domain'
+    in '"name" <mailbox@domain>, should be allocated with malloc()
+*/
+
+struct mailimf_mailbox {
+  char * mb_display_name; /* can be NULL */
+  char * mb_addr_spec;    /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_mailbox *
+mailimf_mailbox_new(char * mb_display_name, char * mb_addr_spec);
+
+LIBETPAN_EXPORT
+void mailimf_mailbox_free(struct mailimf_mailbox * mailbox);
+
+
+
+/*
+  mailimf_group is a group
+
+  - display_name is the name that will be displayed for this group,
+    for example 'group_name' in
+    'group_name: address1@domain1, address2@domain2;', should be allocated
+    with malloc()
+
+  - mb_list is a list of mailboxes
+*/
+
+struct mailimf_group {
+  char * grp_display_name; /* != NULL */
+  struct mailimf_mailbox_list * grp_mb_list; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_group *
+mailimf_group_new(char * grp_display_name,
+    struct mailimf_mailbox_list * grp_mb_list);
+
+LIBETPAN_EXPORT
+void mailimf_group_free(struct mailimf_group * group);
+
+
+
+/*
+  mailimf_mailbox_list is a list of mailboxes
+
+  - list is a list of mailboxes
+*/
+
+struct mailimf_mailbox_list {
+  clist * mb_list; /* list of (struct mailimf_mailbox *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_mailbox_list *
+mailimf_mailbox_list_new(clist * mb_list);
+
+LIBETPAN_EXPORT
+void mailimf_mailbox_list_free(struct mailimf_mailbox_list * mb_list);
+
+
+
+/*
+  mailimf_address_list is a list of addresses
+
+  - list is a list of addresses
+*/
+
+struct mailimf_address_list {
+  clist * ad_list; /* list of (struct mailimf_address *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_address_list *
+mailimf_address_list_new(clist * ad_list);
+
+LIBETPAN_EXPORT
+void mailimf_address_list_free(struct mailimf_address_list * addr_list);
+
+
+
+
+
+/*
+  mailimf_body is the text part of a message
+  
+  - text is the beginning of the text part, it is a substring
+    of an other string
+
+  - size is the size of the text part
+*/
+
+struct mailimf_body {
+  const char * bd_text; /* != NULL */
+  size_t bd_size;
+};
+
+LIBETPAN_EXPORT
+struct mailimf_body * mailimf_body_new(const char * bd_text, size_t bd_size);
+
+LIBETPAN_EXPORT
+void mailimf_body_free(struct mailimf_body * body);
+
+
+
+
+/*
+  mailimf_message is the content of the message
+
+  - msg_fields is the header fields of the message
+  
+  - msg_body is the text part of the message
+*/
+
+struct mailimf_message {
+  struct mailimf_fields * msg_fields; /* != NULL */
+  struct mailimf_body * msg_body;     /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_message *
+mailimf_message_new(struct mailimf_fields * msg_fields,
+    struct mailimf_body * msg_body);
+
+LIBETPAN_EXPORT
+void mailimf_message_free(struct mailimf_message * message);
+
+
+
+
+/*
+  mailimf_fields is a list of header fields
+
+  - fld_list is a list of header fields
+*/
+
+struct mailimf_fields {
+  clist * fld_list; /* list of (struct mailimf_field *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_fields * mailimf_fields_new(clist * fld_list);
+
+LIBETPAN_EXPORT
+void mailimf_fields_free(struct mailimf_fields * fields);
+
+
+
+/* this is a type of field */
+
+enum {
+  MAILIMF_FIELD_NONE,           /* on parse error */
+  MAILIMF_FIELD_RETURN_PATH,    /* Return-Path */
+  MAILIMF_FIELD_RESENT_DATE,    /* Resent-Date */
+  MAILIMF_FIELD_RESENT_FROM,    /* Resent-From */
+  MAILIMF_FIELD_RESENT_SENDER,  /* Resent-Sender */
+  MAILIMF_FIELD_RESENT_TO,      /* Resent-To */
+  MAILIMF_FIELD_RESENT_CC,      /* Resent-Cc */
+  MAILIMF_FIELD_RESENT_BCC,     /* Resent-Bcc */
+  MAILIMF_FIELD_RESENT_MSG_ID,  /* Resent-Message-ID */
+  MAILIMF_FIELD_ORIG_DATE,      /* Date */
+  MAILIMF_FIELD_FROM,           /* From */
+  MAILIMF_FIELD_SENDER,         /* Sender */
+  MAILIMF_FIELD_REPLY_TO,       /* Reply-To */
+  MAILIMF_FIELD_TO,             /* To */
+  MAILIMF_FIELD_CC,             /* Cc */
+  MAILIMF_FIELD_BCC,            /* Bcc */
+  MAILIMF_FIELD_MESSAGE_ID,     /* Message-ID */
+  MAILIMF_FIELD_IN_REPLY_TO,    /* In-Reply-To */
+  MAILIMF_FIELD_REFERENCES,     /* References */
+  MAILIMF_FIELD_SUBJECT,        /* Subject */
+  MAILIMF_FIELD_COMMENTS,       /* Comments */
+  MAILIMF_FIELD_KEYWORDS,       /* Keywords */
+  MAILIMF_FIELD_OPTIONAL_FIELD  /* other field */
+};
+
+/*
+  mailimf_field is a field
+
+  - fld_type is the type of the field
+
+  - fld_data.fld_return_path is the parsed content of the Return-Path
+    field if type is MAILIMF_FIELD_RETURN_PATH
+
+  - fld_data.fld_resent_date is the parsed content of the Resent-Date field
+    if type is MAILIMF_FIELD_RESENT_DATE
+
+  - fld_data.fld_resent_from is the parsed content of the Resent-From field
+
+  - fld_data.fld_resent_sender is the parsed content of the Resent-Sender field
+
+  - fld_data.fld_resent_to is the parsed content of the Resent-To field
+
+  - fld_data.fld_resent_cc is the parsed content of the Resent-Cc field
+
+  - fld_data.fld_resent_bcc is the parsed content of the Resent-Bcc field
+
+  - fld_data.fld_resent_msg_id is the parsed content of the Resent-Message-ID
+    field
+
+  - fld_data.fld_orig_date is the parsed content of the Date field
+
+  - fld_data.fld_from is the parsed content of the From field
+
+  - fld_data.fld_sender is the parsed content of the Sender field
+
+  - fld_data.fld_reply_to is the parsed content of the Reply-To field
+
+  - fld_data.fld_to is the parsed content of the To field
+
+  - fld_data.fld_cc is the parsed content of the Cc field
+
+  - fld_data.fld_bcc is the parsed content of the Bcc field
+
+  - fld_data.fld_message_id is the parsed content of the Message-ID field
+
+  - fld_data.fld_in_reply_to is the parsed content of the In-Reply-To field
+
+  - fld_data.fld_references is the parsed content of the References field
+
+  - fld_data.fld_subject is the content of the Subject field
+
+  - fld_data.fld_comments is the content of the Comments field
+
+  - fld_data.fld_keywords is the parsed content of the Keywords field
+
+  - fld_data.fld_optional_field is an other field and is not parsed
+*/
+
+#define LIBETPAN_MAILIMF_FIELD_UNION
+
+struct mailimf_field {
+  int fld_type;
+  union {
+    struct mailimf_return * fld_return_path;              /* can be NULL */
+    struct mailimf_orig_date * fld_resent_date;    /* can be NULL */
+    struct mailimf_from * fld_resent_from;         /* can be NULL */
+    struct mailimf_sender * fld_resent_sender;     /* can be NULL */
+    struct mailimf_to * fld_resent_to;             /* can be NULL */
+    struct mailimf_cc * fld_resent_cc;             /* can be NULL */
+    struct mailimf_bcc * fld_resent_bcc;           /* can be NULL */
+    struct mailimf_message_id * fld_resent_msg_id; /* can be NULL */
+    struct mailimf_orig_date * fld_orig_date;             /* can be NULL */
+    struct mailimf_from * fld_from;                       /* can be NULL */
+    struct mailimf_sender * fld_sender;                   /* can be NULL */
+    struct mailimf_reply_to * fld_reply_to;               /* can be NULL */
+    struct mailimf_to * fld_to;                           /* can be NULL */
+    struct mailimf_cc * fld_cc;                           /* can be NULL */
+    struct mailimf_bcc * fld_bcc;                         /* can be NULL */
+    struct mailimf_message_id * fld_message_id;           /* can be NULL */
+    struct mailimf_in_reply_to * fld_in_reply_to;         /* can be NULL */
+    struct mailimf_references * fld_references;           /* can be NULL */
+    struct mailimf_subject * fld_subject;                 /* can be NULL */
+    struct mailimf_comments * fld_comments;               /* can be NULL */
+    struct mailimf_keywords * fld_keywords;               /* can be NULL */
+    struct mailimf_optional_field * fld_optional_field;   /* can be NULL */
+  } fld_data;
+};
+
+LIBETPAN_EXPORT
+struct mailimf_field *
+mailimf_field_new(int fld_type,
+    struct mailimf_return * fld_return_path,
+    struct mailimf_orig_date * fld_resent_date,
+    struct mailimf_from * fld_resent_from,
+    struct mailimf_sender * fld_resent_sender,
+    struct mailimf_to * fld_resent_to,
+    struct mailimf_cc * fld_resent_cc,
+    struct mailimf_bcc * fld_resent_bcc,
+    struct mailimf_message_id * fld_resent_msg_id,
+    struct mailimf_orig_date * fld_orig_date,
+    struct mailimf_from * fld_from,
+    struct mailimf_sender * fld_sender,
+    struct mailimf_reply_to * fld_reply_to,
+    struct mailimf_to * fld_to,
+    struct mailimf_cc * fld_cc,
+    struct mailimf_bcc * fld_bcc,
+    struct mailimf_message_id * fld_message_id,
+    struct mailimf_in_reply_to * fld_in_reply_to,
+    struct mailimf_references * fld_references,
+    struct mailimf_subject * fld_subject,
+    struct mailimf_comments * fld_comments,
+    struct mailimf_keywords * fld_keywords,
+    struct mailimf_optional_field * fld_optional_field);
+
+LIBETPAN_EXPORT
+void mailimf_field_free(struct mailimf_field * field);
+
+
+
+/*
+  mailimf_orig_date is the parsed Date field
+
+  - date_time is the parsed date
+*/
+
+struct mailimf_orig_date {
+  struct mailimf_date_time * dt_date_time; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_orig_date * mailimf_orig_date_new(struct mailimf_date_time *
+    dt_date_time);
+
+LIBETPAN_EXPORT
+void mailimf_orig_date_free(struct mailimf_orig_date * orig_date);
+
+
+
+
+/*
+  mailimf_from is the parsed From field
+
+  - mb_list is the parsed mailbox list
+*/
+
+struct mailimf_from {
+  struct mailimf_mailbox_list * frm_mb_list; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_from *
+mailimf_from_new(struct mailimf_mailbox_list * frm_mb_list);
+
+LIBETPAN_EXPORT
+void mailimf_from_free(struct mailimf_from * from);
+
+
+
+/*
+  mailimf_sender is the parsed Sender field
+
+  - snd_mb is the parsed mailbox
+*/
+
+struct mailimf_sender {
+  struct mailimf_mailbox * snd_mb; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_sender * mailimf_sender_new(struct mailimf_mailbox * snd_mb);
+
+LIBETPAN_EXPORT
+void mailimf_sender_free(struct mailimf_sender * sender);
+
+
+
+
+/*
+  mailimf_reply_to is the parsed Reply-To field
+
+  - rt_addr_list is the parsed address list
+ */
+
+struct mailimf_reply_to {
+  struct mailimf_address_list * rt_addr_list; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_reply_to *
+mailimf_reply_to_new(struct mailimf_address_list * rt_addr_list);
+
+LIBETPAN_EXPORT
+void mailimf_reply_to_free(struct mailimf_reply_to * reply_to);
+
+
+
+
+/*
+  mailimf_to is the parsed To field
+  
+  - to_addr_list is the parsed address list
+*/
+
+struct mailimf_to {
+  struct mailimf_address_list * to_addr_list; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_to * mailimf_to_new(struct mailimf_address_list * to_addr_list);
+
+LIBETPAN_EXPORT
+void mailimf_to_free(struct mailimf_to * to);
+
+
+
+
+/*
+  mailimf_cc is the parsed Cc field
+
+  - cc_addr_list is the parsed addres list
+*/
+
+struct mailimf_cc {
+  struct mailimf_address_list * cc_addr_list; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_cc * mailimf_cc_new(struct mailimf_address_list * cc_addr_list);
+
+LIBETPAN_EXPORT
+void mailimf_cc_free(struct mailimf_cc * cc);
+
+
+
+
+/*
+  mailimf_bcc is the parsed Bcc field
+
+  - bcc_addr_list is the parsed addres list
+*/
+
+struct mailimf_bcc {
+  struct mailimf_address_list * bcc_addr_list; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_bcc *
+mailimf_bcc_new(struct mailimf_address_list * bcc_addr_list);
+
+LIBETPAN_EXPORT
+void mailimf_bcc_free(struct mailimf_bcc * bcc);
+
+
+
+/*
+  mailimf_message_id is the parsed Message-ID field
+  
+  - mid_value is the message identifier
+*/
+
+struct mailimf_message_id {
+  char * mid_value; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_message_id * mailimf_message_id_new(char * mid_value);
+
+LIBETPAN_EXPORT
+void mailimf_message_id_free(struct mailimf_message_id * message_id);
+
+
+
+
+/*
+  mailimf_in_reply_to is the parsed In-Reply-To field
+
+  - mid_list is the list of message identifers
+*/
+
+struct mailimf_in_reply_to {
+  clist * mid_list; /* list of (char *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_in_reply_to * mailimf_in_reply_to_new(clist * mid_list);
+
+LIBETPAN_EXPORT
+void mailimf_in_reply_to_free(struct mailimf_in_reply_to * in_reply_to);
+
+
+
+/*
+  mailimf_references is the parsed References field
+
+  - msg_id_list is the list of message identifiers
+ */
+
+struct mailimf_references {
+  clist * mid_list; /* list of (char *) */
+       /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_references * mailimf_references_new(clist * mid_list);
+
+LIBETPAN_EXPORT
+void mailimf_references_free(struct mailimf_references * references);
+
+
+
+/*
+  mailimf_subject is the parsed Subject field
+  
+  - sbj_value is the value of the field
+*/
+
+struct mailimf_subject {
+  char * sbj_value; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_subject * mailimf_subject_new(char * sbj_value);
+
+LIBETPAN_EXPORT
+void mailimf_subject_free(struct mailimf_subject * subject);
+
+
+/*
+  mailimf_comments is the parsed Comments field
+
+  - cm_value is the value of the field
+*/
+
+struct mailimf_comments {
+  char * cm_value; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_comments * mailimf_comments_new(char * cm_value);
+
+LIBETPAN_EXPORT
+void mailimf_comments_free(struct mailimf_comments * comments);
+
+
+/*
+  mailimf_keywords is the parsed Keywords field
+
+  - kw_list is the list of keywords
+*/
+
+struct mailimf_keywords {
+  clist * kw_list; /* list of (char *), != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_keywords * mailimf_keywords_new(clist * kw_list);
+
+LIBETPAN_EXPORT
+void mailimf_keywords_free(struct mailimf_keywords * keywords);
+
+
+/*
+  mailimf_return is the parsed Return-Path field
+
+  - ret_path is the parsed value of Return-Path
+*/
+
+struct mailimf_return {
+  struct mailimf_path * ret_path; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_return *
+mailimf_return_new(struct mailimf_path * ret_path);
+
+LIBETPAN_EXPORT
+void mailimf_return_free(struct mailimf_return * return_path);
+
+
+/*
+  mailimf_path is the parsed value of Return-Path
+
+  - pt_addr_spec is a mailbox
+*/
+
+struct mailimf_path {
+  char * pt_addr_spec; /* can be NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_path * mailimf_path_new(char * pt_addr_spec);
+
+LIBETPAN_EXPORT
+void mailimf_path_free(struct mailimf_path * path);
+
+
+/*
+  mailimf_optional_field is a non-parsed field
+
+  - fld_name is the name of the field
+
+  - fld_value is the value of the field
+*/
+
+struct mailimf_optional_field {
+  char * fld_name;  /* != NULL */
+  char * fld_value; /* != NULL */
+};
+
+LIBETPAN_EXPORT
+struct mailimf_optional_field *
+mailimf_optional_field_new(char * fld_name, char * fld_value);
+
+LIBETPAN_EXPORT
+void mailimf_optional_field_free(struct mailimf_optional_field * opt_field);
+
+
+/*
+  mailimf_fields is the native structure that IMF module will use,
+  this module will provide an easier structure to use when parsing fields.
+
+  mailimf_single_fields is an easier structure to get parsed fields,
+  rather than iteration over the list of fields
+
+  - fld_orig_date is the parsed "Date" field
+
+  - fld_from is the parsed "From" field
+  
+  - fld_sender is the parsed "Sender "field
+
+  - fld_reply_to is the parsed "Reply-To" field
+  
+  - fld_to is the parsed "To" field
+
+  - fld_cc is the parsed "Cc" field
+
+  - fld_bcc is the parsed "Bcc" field
+
+  - fld_message_id is the parsed "Message-ID" field
+
+  - fld_in_reply_to is the parsed "In-Reply-To" field
+
+  - fld_references is the parsed "References" field
+
+  - fld_subject is the parsed "Subject" field
+  
+  - fld_comments is the parsed "Comments" field
+
+  - fld_keywords is the parsed "Keywords" field
+*/
+
+struct mailimf_single_fields {
+  struct mailimf_orig_date * fld_orig_date;      /* can be NULL */
+  struct mailimf_from * fld_from;                /* can be NULL */
+  struct mailimf_sender * fld_sender;            /* can be NULL */
+  struct mailimf_reply_to * fld_reply_to;        /* can be NULL */
+  struct mailimf_to * fld_to;                    /* can be NULL */
+  struct mailimf_cc * fld_cc;                    /* can be NULL */
+  struct mailimf_bcc * fld_bcc;                  /* can be NULL */
+  struct mailimf_message_id * fld_message_id;    /* can be NULL */
+  struct mailimf_in_reply_to * fld_in_reply_to;  /* can be NULL */
+  struct mailimf_references * fld_references;    /* can be NULL */
+  struct mailimf_subject * fld_subject;          /* can be NULL */
+  struct mailimf_comments * fld_comments;        /* can be NULL */
+  struct mailimf_keywords * fld_keywords;        /* can be NULL */
+};
+
+
+
+
+
+
+/* internal use */
+
+LIBETPAN_EXPORT
+void mailimf_atom_free(char * atom);
+
+LIBETPAN_EXPORT
+void mailimf_dot_atom_free(char * dot_atom);
+
+LIBETPAN_EXPORT
+void mailimf_dot_atom_text_free(char * dot_atom);
+
+LIBETPAN_EXPORT
+void mailimf_quoted_string_free(char * quoted_string);
+
+LIBETPAN_EXPORT
+void mailimf_word_free(char * word);
+
+LIBETPAN_EXPORT
+void mailimf_phrase_free(char * phrase);
+
+LIBETPAN_EXPORT
+void mailimf_unstructured_free(char * unstructured);
+
+LIBETPAN_EXPORT
+void mailimf_angle_addr_free(char * angle_addr);
+
+LIBETPAN_EXPORT
+void mailimf_display_name_free(char * display_name);
+
+LIBETPAN_EXPORT
+void mailimf_addr_spec_free(char * addr_spec);
+
+LIBETPAN_EXPORT
+void mailimf_local_part_free(char * local_part);
+
+LIBETPAN_EXPORT
+void mailimf_domain_free(char * domain);
+
+LIBETPAN_EXPORT
+void mailimf_domain_literal_free(char * domain);
+
+LIBETPAN_EXPORT
+void mailimf_msg_id_free(char * msg_id);
+
+LIBETPAN_EXPORT
+void mailimf_id_left_free(char * id_left);
+
+LIBETPAN_EXPORT
+void mailimf_id_right_free(char * id_right);
+
+LIBETPAN_EXPORT
+void mailimf_no_fold_quote_free(char * nfq);
+
+LIBETPAN_EXPORT
+void mailimf_no_fold_literal_free(char * nfl);
+
+LIBETPAN_EXPORT
+void mailimf_field_name_free(char * field_name);
+
+
+
+/* these are the possible returned error codes */
+
+enum {
+  MAILIMF_NO_ERROR = 0,
+  MAILIMF_ERROR_PARSE,
+  MAILIMF_ERROR_MEMORY,
+  MAILIMF_ERROR_INVAL,
+  MAILIMF_ERROR_FILE
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 394 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_types_helper.h

@@ -0,0 +1,394 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimf_types_helper.h,v 1.15 2007/12/10 21:32:59 hoa Exp $
+ */
+
+#ifndef MAILIMF_TYPES_HELPER
+
+#define MAILIMF_TYPES_HELPER
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimf_types.h>
+
+/*
+  IMPORTANT NOTE:
+  
+  All allocation functions will take as argument allocated data
+  and will store these data in the structure they will allocate.
+  Data should be persistant during all the use of the structure
+  and will be freed by the free function of the structure
+
+  allocation functions will return NULL on failure
+*/
+
+/*
+  mailimf_mailbox_list_new_empty creates an empty list of mailboxes
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_mailbox_list *
+mailimf_mailbox_list_new_empty(void);
+
+/*
+  mailimf_mailbox_list_add adds a mailbox to the list of mailboxes
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_add(struct mailimf_mailbox_list * mailbox_list,
+			     struct mailimf_mailbox * mb);
+
+/*
+  mailimf_mailbox_list_add_parse parse the given string
+  into a mailimf_mailbox structure and adds it to the list of mailboxes
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_add_parse(struct mailimf_mailbox_list * mailbox_list,
+				   char * mb_str);
+
+/*
+  mailimf_mailbox creates a mailimf_mailbox structure with the given
+  arguments and adds it to the list of mailboxes
+
+  - display_name is the name that will be displayed for this mailbox,
+    for example 'name' in '"name" <mailbox@domain>,
+    should be allocated with malloc()
+  
+  - address is the mailbox, for example 'mailbox@domain'
+    in '"name" <mailbox@domain>, should be allocated with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_add_mb(struct mailimf_mailbox_list * mailbox_list,
+				char * display_name, char * address);
+
+/*
+  mailimf_address_list_new_empty creates an empty list of addresses
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_address_list *
+mailimf_address_list_new_empty(void);
+
+/*
+  mailimf_address_list_add adds a mailbox to the list of addresses
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_address_list_add(struct mailimf_address_list * address_list,
+			     struct mailimf_address * addr);
+
+/*
+  mailimf_address_list_add_parse parse the given string
+  into a mailimf_address structure and adds it to the list of addresses
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_address_list_add_parse(struct mailimf_address_list * address_list,
+				   char * addr_str);
+
+/*
+  mailimf_address_list_add_mb creates a mailbox mailimf_address
+  with the given arguments and adds it to the list of addresses
+
+  - display_name is the name that will be displayed for this mailbox,
+    for example 'name' in '"name" <mailbox@domain>,
+    should be allocated with malloc()
+  
+  - address is the mailbox, for example 'mailbox@domain'
+    in '"name" <mailbox@domain>, should be allocated with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_address_list_add_mb(struct mailimf_address_list * address_list,
+				char * display_name, char * address);
+
+/*
+  mailimf_resent_fields_add_data adds a set of resent fields in the
+  given mailimf_fields structure.
+  
+  if you don't want a given field in the set to be added in the list
+  of fields, you can give NULL as argument
+
+  @param resent_msg_id sould be allocated with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int
+mailimf_resent_fields_add_data(struct mailimf_fields * fields,
+    struct mailimf_date_time * resent_date,
+    struct mailimf_mailbox_list * resent_from,
+    struct mailimf_mailbox * resent_sender,
+    struct mailimf_address_list * resent_to,
+    struct mailimf_address_list * resent_cc,
+    struct mailimf_address_list * resent_bcc,
+    char * resent_msg_id);
+
+/*
+  mailimf_resent_fields_new_with_data_all creates a new mailimf_fields
+  structure with a set of resent fields
+
+  if you don't want a given field in the set to be added in the list
+  of fields, you can give NULL as argument
+
+  @param resent_msg_id sould be allocated with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_fields *
+mailimf_resent_fields_new_with_data_all(struct mailimf_date_time *
+    resent_date, struct mailimf_mailbox_list * resent_from,
+    struct mailimf_mailbox * resent_sender,
+    struct mailimf_address_list * resent_to,
+    struct mailimf_address_list * resent_cc,
+    struct mailimf_address_list * resent_bcc,
+    char * resent_msg_id);
+
+/*
+  mailimf_resent_fields_new_with_data_all creates a new mailimf_fields
+  structure with a set of resent fields.
+  Resent-Date and Resent-Message-ID fields will be generated for you.
+
+  if you don't want a given field in the set to be added in the list
+  of fields, you can give NULL as argument
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_fields *
+mailimf_resent_fields_new_with_data(struct mailimf_mailbox_list * from,
+    struct mailimf_mailbox * sender,
+    struct mailimf_address_list * to,
+    struct mailimf_address_list * cc,
+    struct mailimf_address_list * bcc);
+
+/*
+  this function creates a new mailimf_fields structure with no fields
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_fields *
+mailimf_fields_new_empty(void);
+
+
+/*
+  this function adds a field to the mailimf_fields structure
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_fields_add(struct mailimf_fields * fields,
+		       struct mailimf_field * field);
+
+
+/*
+  mailimf_fields_add_data adds a set of fields in the
+  given mailimf_fields structure.
+  
+  if you don't want a given field in the set to be added in the list
+  of fields, you can give NULL as argument
+
+  @param msg_id sould be allocated with malloc()
+  @param subject should be allocated with malloc()
+  @param in_reply_to each elements of this list should be allocated
+    with malloc()
+  @param references each elements of this list should be allocated
+    with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+int mailimf_fields_add_data(struct mailimf_fields * fields,
+			    struct mailimf_date_time * date,
+			    struct mailimf_mailbox_list * from,
+			    struct mailimf_mailbox * sender,
+			    struct mailimf_address_list * reply_to,
+			    struct mailimf_address_list * to,
+			    struct mailimf_address_list * cc,
+			    struct mailimf_address_list * bcc,
+			    char * msg_id,
+			    clist * in_reply_to,
+			    clist * references,
+			    char * subject);
+
+/*
+  mailimf_fields_new_with_data_all creates a new mailimf_fields
+  structure with a set of fields
+
+  if you don't want a given field in the set to be added in the list
+  of fields, you can give NULL as argument
+
+  @param message_id sould be allocated with malloc()
+  @param subject should be allocated with malloc()
+  @param in_reply_to each elements of this list should be allocated
+    with malloc()
+  @param references each elements of this list should be allocated
+    with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_fields *
+mailimf_fields_new_with_data_all(struct mailimf_date_time * date,
+				 struct mailimf_mailbox_list * from,
+				 struct mailimf_mailbox * sender,
+				 struct mailimf_address_list * reply_to,
+				 struct mailimf_address_list * to,
+				 struct mailimf_address_list * cc,
+				 struct mailimf_address_list * bcc,
+				 char * message_id,
+				 clist * in_reply_to,
+				 clist * references,
+				 char * subject);
+
+/*
+  mailimf_fields_new_with_data creates a new mailimf_fields
+  structure with a set of fields
+  Date and Message-ID fields will be generated for you.
+
+  if you don't want a given field in the set to be added in the list
+  of fields, you can give NULL as argument
+
+  @param subject should be allocated with malloc()
+  @param in_reply_to each elements of this list should be allocated
+    with malloc()
+  @param references each elements of this list should be allocated
+    with malloc()
+
+  @return MAILIMF_NO_ERROR will be returned on success,
+  other code will be returned otherwise
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_fields *
+mailimf_fields_new_with_data(struct mailimf_mailbox_list * from,
+			     struct mailimf_mailbox * sender,
+			     struct mailimf_address_list * reply_to,
+			     struct mailimf_address_list * to,
+			     struct mailimf_address_list * cc,
+			     struct mailimf_address_list * bcc,
+			     clist * in_reply_to,
+			     clist * references,
+			     char * subject);
+
+/*
+  this function returns an allocated message identifier to
+  use in a Message-ID or Resent-Message-ID field
+*/
+
+LIBETPAN_EXPORT
+char * mailimf_get_message_id(void);
+
+/*
+  this function returns a mailimf_date_time structure to
+  use in a Date or Resent-Date field
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_date_time * mailimf_get_current_date(void);
+
+LIBETPAN_EXPORT
+struct mailimf_date_time * mailimf_get_date(time_t time);
+
+/*
+  mailimf_single_fields_init fills a mailimf_single_fields structure
+  with the content of a mailimf_fields structure
+*/
+
+LIBETPAN_EXPORT
+void mailimf_single_fields_init(struct mailimf_single_fields * single_fields,
+                                struct mailimf_fields * fields);
+
+/*
+  mailimf_single_fields_new creates a new mailimf_single_fields and
+  fills the structure with mailimf_fields
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_single_fields *
+mailimf_single_fields_new(struct mailimf_fields * fields);
+
+LIBETPAN_EXPORT
+void mailimf_single_fields_free(struct mailimf_single_fields *
+                                single_fields);
+
+/*
+  mailimf_field_new_custom creates a new field of type optional
+
+  @param name should be allocated with malloc()
+  @param value should be allocated with malloc()
+*/
+
+LIBETPAN_EXPORT
+struct mailimf_field * mailimf_field_new_custom(char * name, char * value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 180 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_write_file.h

@@ -0,0 +1,180 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimf_write_file.h,v 1.3 2005/06/01 12:22:18 smarinier Exp $
+ */
+
+#ifndef MAILIMF_WRITE_H
+
+#define MAILIMF_WRITE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <libetpan/mailimf_types.h>
+
+#define MAILIMF_WRITE_COMPATIBILITY
+
+/*
+  mailimf_string_write_file writes a string to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param str is the string to write
+*/
+LIBETPAN_EXPORT
+int mailimf_string_write_file(FILE * f, int * col,
+    const char * str, size_t length);
+
+
+/*
+  mailimf_fields_write_file writes the fields to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param fields is the fields to write
+*/
+LIBETPAN_EXPORT
+int mailimf_fields_write_file(FILE * f, int * col,
+    struct mailimf_fields * fields);
+
+
+/*
+  mailimf_envelope_fields_write_file writes only some fields to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param fields is the fields to write
+*/
+LIBETPAN_EXPORT
+int mailimf_envelope_fields_write_file(FILE * f, int * col,
+    struct mailimf_fields * fields);
+
+
+/*
+  mailimf_field_write_file writes a field to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param field is the field to write
+*/
+LIBETPAN_EXPORT
+int mailimf_field_write_file(FILE * f, int * col,
+    struct mailimf_field * field);
+
+/*
+  mailimf_quoted_string_write_file writes a string that is quoted
+  to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param string is the string to quote and write
+*/
+LIBETPAN_EXPORT
+int mailimf_quoted_string_write_file(FILE * f, int * col,
+    const char * string, size_t len);
+
+LIBETPAN_EXPORT
+int mailimf_address_list_write_file(FILE * f, int * col,
+    struct mailimf_address_list * addr_list);
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_write_file(FILE * f, int * col,
+    struct mailimf_mailbox_list * mb_list);
+
+/*
+  mailimf_header_string_write_file writes a header value and fold the header
+    if needed.
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param str is the string to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_header_string_write_file(FILE * f, int * col,
+    const char * str, size_t length);
+
+
+
+/* binary compatibility with 0.34 - begin */
+
+#ifdef MAILIMF_WRITE_COMPATIBILITY
+LIBETPAN_EXPORT
+int mailimf_string_write(FILE * f, int * col,
+    const char * str, size_t length);
+
+LIBETPAN_EXPORT
+int mailimf_fields_write(FILE * f, int * col,
+    struct mailimf_fields * fields);
+
+LIBETPAN_EXPORT
+int mailimf_envelope_fields_write(FILE * f, int * col,
+    struct mailimf_fields * fields);
+
+LIBETPAN_EXPORT
+int mailimf_field_write(FILE * f, int * col,
+    struct mailimf_field * field);
+
+LIBETPAN_EXPORT
+int mailimf_quoted_string_write(FILE * f, int * col,
+    const char * string, size_t len);
+
+LIBETPAN_EXPORT
+int mailimf_address_list_write(FILE * f, int * col,
+    struct mailimf_address_list * addr_list);
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_write(FILE * f, int * col,
+    struct mailimf_mailbox_list * mb_list);
+
+LIBETPAN_EXPORT
+int mailimf_header_string_write(FILE * f, int * col,
+    const char * str, size_t length);
+#endif
+
+/* binary compatibility with 0.34 - end */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 150 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_write_generic.h

@@ -0,0 +1,150 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimf_write_generic.h,v 1.3 2007/12/10 21:32:59 hoa Exp $
+ */
+
+#ifndef MAILIMF_WRITE_GENERIC_H
+
+#define MAILIMF_WRITE_GENERIC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <libetpan/mailimf_types.h>
+
+/*
+  mailimf_string_write writes a string to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param str is the string to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_string_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    const char * str, size_t length);
+
+
+/*
+  mailimf_fields_write writes the fields to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param fields is the fields to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_fields_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    struct mailimf_fields * fields);
+
+
+/*
+  mailimf_envelope_fields_write writes only some fields to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param fields is the fields to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_envelope_fields_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    struct mailimf_fields * fields);
+
+
+/*
+  mailimf_field_write writes a field to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param field is the field to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_field_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    struct mailimf_field * field);
+
+/*
+  mailimf_quoted_string_write writes a string that is quoted
+  to a given stream
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param string is the string to quote and write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_quoted_string_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    const char * string, size_t len);
+
+LIBETPAN_EXPORT
+int mailimf_address_list_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    struct mailimf_address_list * addr_list);
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    struct mailimf_mailbox_list * mb_list);
+
+/*
+  mailimf_header_string_write writes a header value and fold the header
+    if needed.
+  
+  @param f is the stream
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param str is the string to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_header_string_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+    int * col,
+    const char * str, size_t length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 143 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailimf_write_mem.h

@@ -0,0 +1,143 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailimf_write_mem.h,v 1.2 2004/11/21 21:53:37 hoa Exp $
+ */
+
+#ifndef MAILIMF_WRITE_MEM_H
+
+#define MAILIMF_WRITE_MEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <libetpan/mailimf_types.h>
+#include <libetpan/mmapstring.h>
+  
+/*
+  mailimf_string_write_mem appends a string to a given string
+  
+  @param f is the string
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param str is the string to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_string_write_mem(MMAPString * f, int * col,
+    const char * str, size_t length);
+
+
+/*
+  mailimf_fields_write_mem appends the fields to a given string
+  
+  @param f is the string
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param fields is the fields to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_fields_write_mem(MMAPString * f, int * col,
+    struct mailimf_fields * fields);
+
+
+/*
+  mailimf_envelope_fields_write_mem appends some fields to a given string
+  
+  @param f is the string
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param fields is the fields to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_envelope_fields_write_mem(MMAPString * f, int * col,
+    struct mailimf_fields * fields);
+
+
+/*
+  mailimf_field_write_mem appends a field to a given string
+  
+  @param f is the string
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param field is the field to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_field_write_mem(MMAPString * f, int * col,
+    struct mailimf_field * field);
+
+/*
+  mailimf_quoted_string_write_mem appends a string that is quoted
+  to a given string
+  
+  @param f is the string
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param string is the string to quote and write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_quoted_string_write_mem(MMAPString * f, int * col,
+    const char * string, size_t len);
+
+LIBETPAN_EXPORT
+int mailimf_address_list_write_mem(MMAPString * f, int * col,
+    struct mailimf_address_list * addr_list);
+
+LIBETPAN_EXPORT
+int mailimf_mailbox_list_write_mem(MMAPString * f, int * col,
+    struct mailimf_mailbox_list * mb_list);
+
+/*
+  mailimf_header_string_write_mem appends a header value and fold the header
+    if needed.
+  
+  @param f is the string
+  @param col (* col) is the column number where we will start to
+    write the text, the ending column will be stored in (* col)
+  @param str is the string to write
+*/
+
+LIBETPAN_EXPORT
+int mailimf_header_string_write_mem(MMAPString * f, int * col,
+    const char * str, size_t length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 53 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/maillock.h

@@ -0,0 +1,53 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: maillock.h,v 1.5 2004/11/21 21:53:31 hoa Exp $
+ */
+
+#ifndef MAILLOCK_H
+
+#define MAILLOCK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int maillock_read_lock(const char * filename, int fd);
+int maillock_read_unlock(const char * filename, int fd);
+int maillock_write_lock(const char * filename, int fd);
+int maillock_write_unlock(const char * filename, int fd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 144 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmbox.h

@@ -0,0 +1,144 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmbox.h,v 1.19 2004/11/21 21:53:38 hoa Exp $
+ */
+
+#ifndef MAILMBOX_H
+
+#define MAILMBOX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmbox_types.h>
+
+int
+mailmbox_append_message_list(struct mailmbox_folder * folder,
+			     carray * append_tab);
+
+int
+mailmbox_append_message(struct mailmbox_folder * folder,
+			const char * data, size_t len);
+
+int
+mailmbox_append_message_uid(struct mailmbox_folder * folder,
+    const char * data, size_t len, unsigned int * puid);
+
+int mailmbox_fetch_msg(struct mailmbox_folder * folder,
+		       uint32_t num, char ** result,
+		       size_t * result_len);
+
+int mailmbox_fetch_msg_headers(struct mailmbox_folder * folder,
+			       uint32_t num, char ** result,
+			       size_t * result_len);
+
+void mailmbox_fetch_result_free(char * msg);
+
+int mailmbox_copy_msg_list(struct mailmbox_folder * dest_folder,
+			   struct mailmbox_folder * src_folder,
+			   carray * tab);
+
+int mailmbox_copy_msg(struct mailmbox_folder * dest_folder,
+		      struct mailmbox_folder * src_folder,
+		      uint32_t uid);
+
+int mailmbox_expunge(struct mailmbox_folder * folder);
+
+int mailmbox_delete_msg(struct mailmbox_folder * folder, uint32_t uid);
+
+int mailmbox_init(const char * filename,
+		  int force_readonly,
+		  int force_no_uid,
+		  uint32_t default_written_uid,
+		  struct mailmbox_folder ** result_folder);
+
+void mailmbox_done(struct mailmbox_folder * folder);
+
+/* low-level access primitives */
+
+int mailmbox_write_lock(struct mailmbox_folder * folder);
+
+int mailmbox_write_unlock(struct mailmbox_folder * folder);
+
+int mailmbox_read_lock(struct mailmbox_folder * folder);
+
+int mailmbox_read_unlock(struct mailmbox_folder * folder);
+
+
+/* memory map */
+
+int mailmbox_map(struct mailmbox_folder * folder);
+
+void mailmbox_unmap(struct mailmbox_folder * folder);
+
+void mailmbox_sync(struct mailmbox_folder * folder);
+
+
+/* open & close file */
+
+int mailmbox_open(struct mailmbox_folder * folder);
+
+void mailmbox_close(struct mailmbox_folder * folder);
+
+
+/* validate cache */
+
+int mailmbox_validate_write_lock(struct mailmbox_folder * folder);
+
+int mailmbox_validate_read_lock(struct mailmbox_folder * folder);
+
+
+/* fetch message */
+
+int mailmbox_fetch_msg_no_lock(struct mailmbox_folder * folder,
+			       uint32_t num, char ** result,
+			       size_t * result_len);
+
+int mailmbox_fetch_msg_headers_no_lock(struct mailmbox_folder * folder,
+				       uint32_t num, char ** result,
+				       size_t * result_len);
+
+/* append message */
+
+int
+mailmbox_append_message_list_no_lock(struct mailmbox_folder * folder,
+				     carray * append_tab);
+
+int mailmbox_expunge_no_lock(struct mailmbox_folder * folder);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 143 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmbox_types.h

@@ -0,0 +1,143 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmbox_types.h,v 1.27 2006/05/22 13:39:42 hoa Exp $
+ */
+
+#ifndef MAILMBOX_TYPES_H
+
+#define MAILMBOX_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#include <libetpan/libetpan-config.h>
+
+#include <libetpan/mailimf.h>
+#include <libetpan/carray.h>
+#include <libetpan/chash.h>
+
+enum {
+  MAILMBOX_NO_ERROR = 0,
+  MAILMBOX_ERROR_PARSE,
+  MAILMBOX_ERROR_INVAL,
+  MAILMBOX_ERROR_FILE_NOT_FOUND,
+  MAILMBOX_ERROR_MEMORY,
+  MAILMBOX_ERROR_TEMPORARY_FILE,
+  MAILMBOX_ERROR_FILE,
+  MAILMBOX_ERROR_MSG_NOT_FOUND,
+  MAILMBOX_ERROR_READONLY
+};
+
+
+struct mailmbox_folder {
+  char mb_filename[PATH_MAX];
+
+  time_t mb_mtime;
+
+  int mb_fd;
+  int mb_read_only;
+  int mb_no_uid;
+
+  int mb_changed;
+  unsigned int mb_deleted_count;
+  
+  char * mb_mapping;
+  size_t mb_mapping_size;
+
+  uint32_t mb_written_uid;
+  uint32_t mb_max_uid;
+
+  chash * mb_hash;
+  carray * mb_tab;
+};
+
+struct mailmbox_folder * mailmbox_folder_new(const char * mb_filename);
+void mailmbox_folder_free(struct mailmbox_folder * folder);
+
+
+struct mailmbox_msg_info {
+  unsigned int msg_index;
+  uint32_t msg_uid;
+  int msg_written_uid;
+  int msg_deleted;
+
+  size_t msg_start;
+  size_t msg_start_len;
+
+  size_t msg_headers;
+  size_t msg_headers_len;
+
+  size_t msg_body;
+  size_t msg_body_len;
+
+  size_t msg_size;
+
+  size_t msg_padding;
+};
+
+
+int mailmbox_msg_info_update(struct mailmbox_folder * folder,
+			     size_t msg_start, size_t msg_start_len,
+			     size_t msg_headers, size_t msg_headers_len,
+			     size_t msg_body, size_t msg_body_len,
+			     size_t msg_size, size_t msg_padding,
+			     uint32_t msg_uid);
+
+struct mailmbox_msg_info *
+mailmbox_msg_info_new(size_t msg_start, size_t msg_start_len,
+		      size_t msg_headers, size_t msg_headers_len,
+		      size_t msg_body, size_t msg_body_len,
+		      size_t msg_size, size_t msg_padding,
+		      uint32_t msg_uid);
+
+void mailmbox_msg_info_free(struct mailmbox_msg_info * info);
+
+struct mailmbox_append_info {
+  const char * ai_message;
+  size_t ai_size;
+  unsigned int ai_uid;
+};
+
+struct mailmbox_append_info *
+mailmbox_append_info_new(const char * ai_message, size_t ai_size);
+
+void mailmbox_append_info_free(struct mailmbox_append_info * info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 379 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmessage.h

@@ -0,0 +1,379 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmessage.h,v 1.17 2008/02/20 22:15:51 hoa Exp $
+ */
+
+#include <libetpan/mailmessage_types.h>
+
+#ifndef MAILMESSAGE_H
+
+#define MAILMESSAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+  mailmessage_new
+
+  This function will initializes a new empty message.
+  
+  @return a new empty message will be returned.
+*/
+LIBETPAN_EXPORT
+mailmessage * mailmessage_new(void);
+
+/*
+  mailmessage_free
+
+  This function will release the memory used by this message.
+*/
+LIBETPAN_EXPORT
+void mailmessage_free(mailmessage * info);
+
+/*
+  mailmessage_init
+  
+  This function will initializes a mailmessage structure
+  with a message from a given session.
+
+  @param msg_info  This is the message to initialize.
+  
+  @param session This is the source session of the message. It
+    can be NULL if the message does not get the information
+    through the session.
+  
+  @param driver This is the driver to use for the message.
+
+  @param indx This is the message number in the session. 0 can
+    be given if the message is not attached to a session.
+
+  @param size is an optional parameter, 0 can be given.
+    This is informational. This is the size of message content.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error
+*/
+LIBETPAN_EXPORT
+int mailmessage_init(mailmessage * msg_info,
+		     mailsession * session,
+		     mailmessage_driver * driver,
+		     uint32_t indx, size_t size);
+
+/*
+  mailmessage_flush
+
+  This function will release all the temporary resources that are not
+  necessary to use the mailmessage structure from memory. These
+  resources are for example cached information, such as the MIME
+  structure.
+
+  @param info is the message to clean.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error. We can assume that MAIL_NO_ERROR is always returned.
+*/
+LIBETPAN_EXPORT
+int mailmessage_flush(mailmessage * info);
+
+/*
+  mailmessage_check
+
+  This function will notify the new value of the flags to the session,
+  it must be called before mailsession_check_folder() in case the flags have
+  been changed.
+
+  @param info is the message to checkpoint.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error. We can assume that MAIL_NO_ERROR is always returned.
+*/
+LIBETPAN_EXPORT
+int mailmessage_check(mailmessage * info);
+
+/*
+  mailmessage_fetch_result_free
+
+  This function releases the memory used by a message returned
+  by any of the fetch function that returns a (char *).
+
+  @param msg_info is the message which the given buffer is from.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+  on error. We can assume that MAIL_NO_ERROR is always returned.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch_result_free(mailmessage * msg_info,
+				  char * msg);
+
+/*
+  mailmessage_fetch
+
+  This function returns the content of the message (headers and text).
+
+  @param msg_info  is the message from which we want to fetch information.
+
+  @param result     The content of the message is returned in (* result)
+
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch(mailmessage * msg_info,
+		      char ** result,
+		      size_t * result_len);
+
+/*
+  mailmessage_fetch_header
+
+  This function returns the header of the message as a string.
+
+  @param msg_info  is the message from which we want to fetch information.
+
+  @param result     The header of the message is returned in (* result)
+
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch_header(mailmessage * msg_info,
+			     char ** result,
+			     size_t * result_len);
+
+/*
+  mailmessage_fetch_body
+
+  This function returns the content of the message (without headers).
+
+  @param msg_info  is the message from which we want to fetch information.
+  @param result     The message text (without headers) is returned
+    in (* result)
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch_body(mailmessage * msg_info,
+			   char ** result, size_t * result_len);
+
+/*
+  mailmessage_fetch_size
+
+  This function returns the size of the message content.
+
+  @param msg_info  is the message from which we want to fetch information.
+
+  @param result The length of the message content is stored in (* result).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch_size(mailmessage * msg_info,
+			   size_t * result);
+
+/*
+  mailmessage_get_bodystructure
+
+  This functions returns the MIME structure of the message.
+  The returned information MUST not be freed by hand. It is freed by
+  mailmessage_flush() or mailmessage_free().
+
+  @param msg_info  is the message from which we want to fetch information.
+
+  @param result The MIME structure is stored in (* result).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_get_bodystructure(mailmessage * msg_info,
+				  struct mailmime ** result);
+
+/*
+  mailmessage_fetch_section
+
+  This function returns the content of a MIME part.
+
+  @param msg_info  is the message from which we want to fetch information.
+  
+  @param mime is the MIME part identifier.
+
+  @param result     The content is returned in (* result)
+
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+ */
+LIBETPAN_EXPORT
+int mailmessage_fetch_section(mailmessage * msg_info,
+			      struct mailmime * mime,
+			      char ** result, size_t * result_len);
+
+/*
+  mailmessage_fetch_section_header
+
+  This function returns the header of the message contained
+  in the given MIME part.
+
+  @param msg_info  is the message from which we want to fetch information.
+  
+  @param mime is the MIME part identifier.
+
+  @param result     The header is returned in (* result)
+
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch_section_header(mailmessage * msg_info,
+				     struct mailmime * mime,
+				     char ** result,
+				     size_t * result_len);
+
+/*
+  mailmessage_fetch_section_mime
+
+  This function returns the MIME header of the given MIME part.
+
+  @param msg_info  is the message from which we want to fetch information.
+  
+  @param mime is the MIME part identifier.
+
+  @param result     The MIME header is returned in (* result)
+
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_fetch_section_mime(mailmessage * msg_info,
+				   struct mailmime * mime,
+				   char ** result,
+				   size_t * result_len);
+
+/*
+  mailmessage_fetch_section_body
+
+  This function returns the text part of the message contained
+  in the given MIME part.
+
+  @param msg_info  is the message from which we want to fetch information.
+  
+  @param mime is the MIME part identifier.
+
+  @param result     The message text is returned in (* result)
+
+  @param result_len The length of the returned string is stored
+    in (* result_len).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+ */
+LIBETPAN_EXPORT
+int mailmessage_fetch_section_body(mailmessage * msg_info,
+				   struct mailmime * mime,
+				   char ** result,
+				   size_t * result_len);
+
+/*
+  mailmessage_fetch_envelope
+
+  This function returns a list of parsed fields of the message,
+  chosen by the driver.
+  The returned structure must be freed with mailimf_fields_free().
+
+  @param msg_info  is the message from which we want to fetch information.
+  
+  @param result     The headers list is returned in (* result)
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+ */
+LIBETPAN_EXPORT
+int mailmessage_fetch_envelope(mailmessage * msg_info,
+			       struct mailimf_fields ** result);
+
+
+/*
+  mailmessage_get_flags
+
+  This function returns the flags related to the message.
+  The returned information MUST not be freed by hand. It is freed by
+  mailmessage_free().
+
+  @param msg_info  is the message from which we want to fetch information.
+
+  @param result The flags are stored in (* result).
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+int mailmessage_get_flags(mailmessage * msg_info,
+			  struct mail_flags ** result);
+
+/*
+  mailmessage_resolve_single_fields
+
+  This function will use the fields information to fill the single_fields
+  structure in the mailmessage structure.
+
+  @param msg_info This is the msg_info to process.
+
+  @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
+    on error.
+*/
+LIBETPAN_EXPORT
+void mailmessage_resolve_single_fields(mailmessage * msg_info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 50 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmessage_types.h

@@ -0,0 +1,50 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmessage_types.h,v 1.9 2004/11/21 21:53:35 hoa Exp $
+ */
+
+#ifndef MAILMESSAGE_TYPES_H
+
+#define MAILMESSAGE_TYPES_H
+
+#include <libetpan/maildriver_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 147 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmh.h

@@ -0,0 +1,147 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmh.h,v 1.27 2008/02/20 22:15:52 hoa Exp $
+ */
+
+#ifndef MAILMH_H
+
+#define MAILMH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/carray.h>
+#include <libetpan/chash.h>
+
+enum {
+  MAILMH_NO_ERROR = 0,
+  MAILMH_ERROR_FOLDER,
+  MAILMH_ERROR_MEMORY,
+  MAILMH_ERROR_FILE,
+  MAILMH_ERROR_COULD_NOT_ALLOC_MSG,
+  MAILMH_ERROR_RENAME,
+  MAILMH_ERROR_MSG_NOT_FOUND
+};
+
+struct mailmh {
+  struct mailmh_folder * mh_main;
+};
+
+struct mailmh_msg_info {
+  unsigned int msg_array_index;
+  uint32_t msg_index;
+  size_t msg_size;
+  time_t msg_mtime;
+};
+
+struct mailmh_folder {
+  char * fl_filename;
+  unsigned int fl_array_index;
+
+  char * fl_name;
+  time_t fl_mtime;
+  struct mailmh_folder * fl_parent;
+  uint32_t fl_max_index;
+
+  carray * fl_msgs_tab;
+  chash * fl_msgs_hash;
+
+  carray * fl_subfolders_tab;
+  chash * fl_subfolders_hash;
+};
+
+struct mailmh * mailmh_new(const char * foldername);
+void mailmh_free(struct mailmh * f);
+
+struct mailmh_msg_info *
+mailmh_msg_info_new(uint32_t indx, size_t size, time_t mtime);
+void mailmh_msg_info_free(struct mailmh_msg_info * msg_info);
+
+struct mailmh_folder * mailmh_folder_new(struct mailmh_folder * parent,
+					 const char * name);
+void mailmh_folder_free(struct mailmh_folder * folder);
+
+int mailmh_folder_add_subfolder(struct mailmh_folder * parent,
+				const char * name);
+
+struct mailmh_folder * mailmh_folder_find(struct mailmh_folder * root,
+					  const char * filename);
+
+int mailmh_folder_remove_subfolder(struct mailmh_folder * folder);
+
+int mailmh_folder_rename_subfolder(struct mailmh_folder * src_folder,
+				   struct mailmh_folder * dst_folder,
+				   const char * new_name);
+
+int mailmh_folder_get_message_filename(struct mailmh_folder * folder,
+				       uint32_t indx, char ** result);
+
+int mailmh_folder_get_message_fd(struct mailmh_folder * folder,
+				 uint32_t indx, int flags, int * result);
+
+int mailmh_folder_get_message_size(struct mailmh_folder * folder,
+				   uint32_t indx, size_t * result);
+
+int mailmh_folder_add_message_uid(struct mailmh_folder * folder,
+    const char * message, size_t size,
+    uint32_t * pindex);
+
+int mailmh_folder_add_message(struct mailmh_folder * folder,
+			      const char * message, size_t size);
+
+int mailmh_folder_add_message_file_uid(struct mailmh_folder * folder,
+    int fd, uint32_t * pindex);
+
+int mailmh_folder_add_message_file(struct mailmh_folder * folder,
+				   int fd);
+
+int mailmh_folder_remove_message(struct mailmh_folder * folder,
+				 uint32_t indx);
+
+int mailmh_folder_move_message(struct mailmh_folder * dest_folder,
+			       struct mailmh_folder * src_folder,
+			       uint32_t indx);
+
+int mailmh_folder_update(struct mailmh_folder * folder);
+
+unsigned int mailmh_folder_get_message_number(struct mailmh_folder * folder);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 118 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime.h

@@ -0,0 +1,118 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime.h,v 1.18 2011/01/06 00:09:52 hoa Exp $
+ */
+
+#ifndef MAILMIME_H
+
+#define MAILMIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailimf.h>
+#include <libetpan/mailmime_types.h>
+#include <libetpan/mailmime_types_helper.h>
+#include <libetpan/mailmime_content.h>
+#include <libetpan/mailmime_decode.h>
+#include <libetpan/mailmime_disposition.h>
+#include <libetpan/mailmime_write_file.h>
+#include <libetpan/mailmime_write_mem.h>
+#include <libetpan/mailmime_write_generic.h>
+
+LIBETPAN_EXPORT
+int mailmime_content_parse(const char * message, size_t length,
+			   size_t * indx,
+			   struct mailmime_content ** result);
+
+LIBETPAN_EXPORT
+int mailmime_description_parse(const char * message, size_t length,
+			       size_t * indx,
+			       char ** result);
+
+LIBETPAN_EXPORT
+int mailmime_location_parse(const char * message, size_t length,
+                            size_t * indx,
+                            char ** result);
+  
+LIBETPAN_EXPORT
+int mailmime_encoding_parse(const char * message, size_t length,
+			    size_t * indx,
+			    struct mailmime_mechanism ** result);
+
+LIBETPAN_EXPORT
+int
+mailmime_field_parse(struct mailimf_optional_field * field,
+		     struct mailmime_field ** result);
+
+LIBETPAN_EXPORT
+int mailmime_id_parse(const char * message, size_t length,
+		      size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int
+mailmime_fields_parse(struct mailimf_fields *
+		      fields,
+		      struct mailmime_fields **
+		      result);
+
+LIBETPAN_EXPORT
+int mailmime_version_parse(const char * message, size_t length,
+			   size_t * indx,
+			   uint32_t * result);
+
+LIBETPAN_EXPORT
+int
+mailmime_extension_token_parse(const char * message, size_t length,
+			       size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int mailmime_parameter_parse(const char * message, size_t length,
+			     size_t * indx,
+			     struct mailmime_parameter ** result);
+
+LIBETPAN_EXPORT
+int mailmime_value_parse(const char * message, size_t length,
+			 size_t * indx, char ** result);
+
+LIBETPAN_EXPORT
+int mailmime_language_parse(const char * message, size_t length,
+			    size_t * indx,
+			    struct mailmime_language ** result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 173 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_content.h

@@ -0,0 +1,173 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_content.h,v 1.16 2008/02/20 22:15:52 hoa Exp $
+ */
+
+#ifndef MAILMIME_CONTENT_H
+
+#define MAILMIME_CONTENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+
+LIBETPAN_EXPORT
+char * mailmime_content_charset_get(struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+char * mailmime_content_param_get(struct mailmime_content * content,
+				  char * name);
+
+LIBETPAN_EXPORT
+int mailmime_parse(const char * message, size_t length,
+		   size_t * indx, struct mailmime ** result);
+
+LIBETPAN_EXPORT
+int mailmime_get_section(struct mailmime * mime,
+			 struct mailmime_section * section,
+			 struct mailmime ** result);
+
+
+LIBETPAN_EXPORT
+char * mailmime_extract_boundary(struct mailmime_content * content_type);
+
+
+/* decode */
+
+LIBETPAN_EXPORT
+int mailmime_base64_body_parse(const char * message, size_t length,
+			       size_t * indx, char ** result,
+			       size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailmime_quoted_printable_body_parse(const char * message, size_t length,
+					 size_t * indx, char ** result,
+					 size_t * result_len, int in_header);
+
+
+LIBETPAN_EXPORT
+int mailmime_binary_body_parse(const char * message, size_t length,
+			       size_t * indx, char ** result,
+			       size_t * result_len);
+
+/*
+ mailmime_part_parse()
+
+ This function gets full MIME part for parsing at once.
+ It is not suitable, if we want parse incomplete message in a stream mode.
+ 
+ @return the return code is one of MAILIMF_ERROR_XXX or
+   MAILIMF_NO_ERROR codes
+ */
+LIBETPAN_EXPORT
+int mailmime_part_parse(const char * message, size_t length,
+			size_t * indx,
+			int encoding, char ** result, size_t * result_len);
+
+
+/*
+ mailmime_part_parse_partial()
+
+ This function may parse incomplete MIME part (i.e. in streaming mode).
+ It stops when detect incomplete encoding unit at the end of data.
+ Position of the first unparsed byte will be returned in (*indx) value.
+
+ For parsing last portion of data must be used mailmime_part_parse() version.
+
+ @param message    Message for unparsed data.
+ @param length     Length of the unparsed data.
+ @param INOUT indx Index of first unparsed symbol in the message.
+ @param encoding   Encoding of the input data.
+ @param result     Parsed MIME part content. Must be freed with mmap_string_unref().
+ @param result_len Length of parsed data.
+
+ @return the return code is one of MAILIMF_ERROR_XXX or
+   MAILIMF_NO_ERROR codes
+
+ Example Usage:
+ @code
+ uint32_t received = 0;
+ uint32_t partLength = bodystructure[partId]->length;
+ for (;;) {
+   bool isThisRangeLast;
+   struct imap_range_t range = { received, 1024*1024 };
+   char *result;
+   size_t result_len;
+   int error = imap_fetch_part_range(uid, partId, range, &result, &result_len);
+   if (error != NoError) {
+     // handle network error
+     break;
+   }
+
+   if (result_len == 0) {
+     // requested range is empty. part is completely fetched
+     break;
+   }
+
+   isThisRangeLast = (received + result_len >= partLength); // determine that the received data is the last,
+                                                            // may be more difficult (in case of invalid metadata on the server).
+
+   char *decoded;
+   size_t decoded_len;
+   if (isThisRangeLast) {
+     uint32_t index = 0;
+     mailmime_part_parse(result, result_len, encoding, &index, &decoded, &decoded_len);
+     break;
+   }
+   else {
+     uint32_t index = 0;
+     mailmime_part_parse_partial(result, result_len, encoding, &index, &decoded, &decoded_len);
+     // we may have some non-decoded bytes at the end of chunk.
+     // in this case we just request it in the next chunk 
+     received += index;
+   }
+ }
+ @endcode
+ */
+LIBETPAN_EXPORT
+int mailmime_part_parse_partial(const char * message, size_t length,
+                                size_t * indx,
+                                int encoding, char ** result, size_t * result_len);
+
+
+LIBETPAN_EXPORT
+int mailmime_get_section_id(struct mailmime * mime,
+			    struct mailmime_section ** result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 62 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_decode.h

@@ -0,0 +1,62 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_decode.h,v 1.14 2008/02/20 22:15:52 hoa Exp $
+ */
+
+#ifndef MAILMIME_DECODE_H
+
+#define MAILMIME_DECODE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+
+LIBETPAN_EXPORT
+int mailmime_encoded_phrase_parse(const char * default_fromcode,
+    const char * message, size_t length,
+    size_t * indx, const char * tocode,
+    char ** result);
+
+int
+mailmime_encoded_word_parse(const char * message, size_t length,
+                            size_t * indx,
+                            struct mailmime_encoded_word ** result,
+                            int * p_has_fwd, int * p_missing_closing_quote);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 62 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_disposition.h

@@ -0,0 +1,62 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_disposition.h,v 1.11 2008/02/20 22:15:52 hoa Exp $
+ */
+
+#ifndef MAILMIME_DISPOSITION_H
+
+#define MAILMIME_DISPOSITION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+
+int mailmime_disposition_parse(const char * message, size_t length,
+			       size_t * indx,
+			       struct mailmime_disposition ** result);
+
+int
+mailmime_disposition_type_parse(const char * message, size_t length,
+				size_t * indx,
+				struct mailmime_disposition_type ** result);
+
+int mailmime_disposition_guess_type(const char * message, size_t length,
+				    size_t indx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 503 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_types.h

@@ -0,0 +1,503 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_types.h,v 1.33 2011/01/06 00:09:52 hoa Exp $
+ */
+
+#ifndef MAILMIME_TYPES_H
+
+#define MAILMIME_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef LIBETPAN_CONFIG_H
+#	include <libetpan/libetpan-config.h>
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+#include <libetpan/mailimf.h>
+#include <libetpan/clist.h>
+
+enum {
+  MAILMIME_COMPOSITE_TYPE_ERROR,
+  MAILMIME_COMPOSITE_TYPE_MESSAGE,
+  MAILMIME_COMPOSITE_TYPE_MULTIPART,
+  MAILMIME_COMPOSITE_TYPE_EXTENSION
+};
+
+struct mailmime_composite_type {
+  int ct_type;
+  char * ct_token;
+};
+
+
+struct mailmime_content {
+  struct mailmime_type * ct_type;
+  char * ct_subtype;
+  clist * ct_parameters; /* elements are (struct mailmime_parameter *) */
+};
+
+
+enum {
+  MAILMIME_DISCRETE_TYPE_ERROR,
+  MAILMIME_DISCRETE_TYPE_TEXT,
+  MAILMIME_DISCRETE_TYPE_IMAGE,
+  MAILMIME_DISCRETE_TYPE_AUDIO,
+  MAILMIME_DISCRETE_TYPE_VIDEO,
+  MAILMIME_DISCRETE_TYPE_APPLICATION,
+  MAILMIME_DISCRETE_TYPE_EXTENSION
+};
+
+struct mailmime_discrete_type {
+  int dt_type;
+  char * dt_extension;
+};
+
+enum {
+  MAILMIME_FIELD_NONE,
+  MAILMIME_FIELD_TYPE,
+  MAILMIME_FIELD_TRANSFER_ENCODING,
+  MAILMIME_FIELD_ID,
+  MAILMIME_FIELD_DESCRIPTION,
+  MAILMIME_FIELD_VERSION,
+  MAILMIME_FIELD_DISPOSITION,
+  MAILMIME_FIELD_LANGUAGE,
+  MAILMIME_FIELD_LOCATION
+};
+
+struct mailmime_field {
+  int fld_type;
+  union {
+    struct mailmime_content * fld_content;
+    struct mailmime_mechanism * fld_encoding;
+    char * fld_id;
+    char * fld_description;
+    uint32_t fld_version;
+    struct mailmime_disposition * fld_disposition;
+    struct mailmime_language * fld_language;
+    char * fld_location;
+  } fld_data;
+};
+
+enum {
+  MAILMIME_MECHANISM_ERROR,
+  MAILMIME_MECHANISM_7BIT,
+  MAILMIME_MECHANISM_8BIT,
+  MAILMIME_MECHANISM_BINARY,
+  MAILMIME_MECHANISM_QUOTED_PRINTABLE,
+  MAILMIME_MECHANISM_BASE64,
+  MAILMIME_MECHANISM_TOKEN
+};
+
+struct mailmime_mechanism {
+  int enc_type;
+  char * enc_token;
+};
+
+
+struct mailmime_fields {
+  clist * fld_list; /* list of (struct mailmime_field *) */
+};
+
+
+struct mailmime_parameter {
+  char * pa_name;
+  char * pa_value;
+};
+
+enum {
+  MAILMIME_TYPE_ERROR,
+  MAILMIME_TYPE_DISCRETE_TYPE,
+  MAILMIME_TYPE_COMPOSITE_TYPE
+};
+
+struct mailmime_type {
+  int tp_type;
+  union {
+    struct mailmime_discrete_type * tp_discrete_type;
+    struct mailmime_composite_type * tp_composite_type;
+  } tp_data;
+};
+
+LIBETPAN_EXPORT
+void mailmime_attribute_free(char * attribute);
+
+LIBETPAN_EXPORT
+struct mailmime_composite_type *
+mailmime_composite_type_new(int ct_type, char * ct_token);
+
+LIBETPAN_EXPORT
+void mailmime_composite_type_free(struct mailmime_composite_type * ct);
+
+LIBETPAN_EXPORT
+struct mailmime_content *
+mailmime_content_new(struct mailmime_type * ct_type,
+		     char * ct_subtype,
+		     clist * ct_parameters);
+
+LIBETPAN_EXPORT
+void mailmime_content_free(struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+void mailmime_description_free(char * description);
+
+LIBETPAN_EXPORT
+void mailmime_location_free(char * location);
+
+LIBETPAN_EXPORT
+struct mailmime_discrete_type *
+mailmime_discrete_type_new(int dt_type, char * dt_extension);
+
+LIBETPAN_EXPORT
+void mailmime_discrete_type_free(struct mailmime_discrete_type *
+				 discrete_type);
+
+LIBETPAN_EXPORT
+void mailmime_encoding_free(struct mailmime_mechanism * encoding);
+
+LIBETPAN_EXPORT
+void mailmime_extension_token_free(char * extension);
+
+LIBETPAN_EXPORT
+void mailmime_id_free(char * id);
+
+LIBETPAN_EXPORT
+struct mailmime_mechanism * mailmime_mechanism_new(int enc_type, char * enc_token);
+
+LIBETPAN_EXPORT
+void mailmime_mechanism_free(struct mailmime_mechanism * mechanism);
+
+LIBETPAN_EXPORT
+struct mailmime_parameter *
+mailmime_parameter_new(char * pa_name, char * pa_value);
+
+LIBETPAN_EXPORT
+void mailmime_parameter_free(struct mailmime_parameter * parameter);
+
+LIBETPAN_EXPORT
+void mailmime_subtype_free(char * subtype);
+
+LIBETPAN_EXPORT
+void mailmime_token_free(char * token);
+
+LIBETPAN_EXPORT
+struct mailmime_type *
+mailmime_type_new(int tp_type,
+		  struct mailmime_discrete_type * tp_discrete_type,
+		  struct mailmime_composite_type * tp_composite_type);
+
+LIBETPAN_EXPORT
+void mailmime_type_free(struct mailmime_type * type);
+
+LIBETPAN_EXPORT
+void mailmime_value_free(char * value);
+
+
+
+struct mailmime_language {
+  clist * lg_list; /* atom (char *) */
+};
+
+LIBETPAN_EXPORT
+struct mailmime_language * mailmime_language_new(clist * lg_list);
+
+LIBETPAN_EXPORT
+void mailmime_language_free(struct mailmime_language * lang);
+
+
+/*
+void mailmime_x_token_free(gchar * x_token);
+*/
+
+LIBETPAN_EXPORT
+struct mailmime_field *
+mailmime_field_new(int fld_type,
+		   struct mailmime_content * fld_content,
+		   struct mailmime_mechanism * fld_encoding,
+		   char * fld_id,
+		   char * fld_description,
+		   uint32_t fld_version,
+		   struct mailmime_disposition * fld_disposition,
+		   struct mailmime_language * fld_language,
+       char * fld_location);
+
+LIBETPAN_EXPORT
+void mailmime_field_free(struct mailmime_field * field);
+
+LIBETPAN_EXPORT
+struct mailmime_fields * mailmime_fields_new(clist * fld_list);
+
+LIBETPAN_EXPORT
+void mailmime_fields_free(struct mailmime_fields * fields);
+
+
+struct mailmime_multipart_body {
+  clist * bd_list;
+};
+
+LIBETPAN_EXPORT
+struct mailmime_multipart_body *
+mailmime_multipart_body_new(clist * bd_list);
+
+LIBETPAN_EXPORT
+void mailmime_multipart_body_free(struct mailmime_multipart_body * mp_body);
+
+
+enum {
+  MAILMIME_DATA_TEXT,
+  MAILMIME_DATA_FILE
+};
+
+struct mailmime_data {
+  int dt_type;
+  int dt_encoding;
+  int dt_encoded;
+  union {
+    struct {
+      const char * dt_data;
+      size_t dt_length;
+    } dt_text;
+    char * dt_filename;
+  } dt_data;
+};
+
+LIBETPAN_EXPORT
+struct mailmime_data * mailmime_data_new(int dt_type, int dt_encoding,
+    int dt_encoded, const char * dt_data, size_t dt_length,
+    char * dt_filename);
+
+LIBETPAN_EXPORT
+void mailmime_data_free(struct mailmime_data * mime_data);
+
+
+enum {
+  MAILMIME_NONE,
+  MAILMIME_SINGLE,
+  MAILMIME_MULTIPLE,
+  MAILMIME_MESSAGE
+};
+
+struct mailmime {
+  /* parent information */
+  int mm_parent_type;
+  struct mailmime * mm_parent;
+  clistiter * mm_multipart_pos;
+
+  int mm_type;
+  const char * mm_mime_start;
+  size_t mm_length;
+  
+  struct mailmime_fields * mm_mime_fields;
+  struct mailmime_content * mm_content_type;
+  
+  struct mailmime_data * mm_body;
+  union {
+    /* single part */
+    struct mailmime_data * mm_single; /* XXX - was body */
+    
+    /* multi-part */
+    struct {
+      struct mailmime_data * mm_preamble;
+      struct mailmime_data * mm_epilogue;
+      clist * mm_mp_list;
+    } mm_multipart;
+    
+    /* message */
+    struct {
+      struct mailimf_fields * mm_fields;
+      struct mailmime * mm_msg_mime;
+    } mm_message;
+    
+  } mm_data;
+};
+
+LIBETPAN_EXPORT
+struct mailmime * mailmime_new(int mm_type,
+    const char * mm_mime_start, size_t mm_length,
+    struct mailmime_fields * mm_mime_fields,
+    struct mailmime_content * mm_content_type,
+    struct mailmime_data * mm_body,
+    struct mailmime_data * mm_preamble,
+    struct mailmime_data * mm_epilogue,
+    clist * mm_mp_list,
+    struct mailimf_fields * mm_fields,
+    struct mailmime * mm_msg_mime);
+
+LIBETPAN_EXPORT
+void mailmime_free(struct mailmime * mime);
+
+struct mailmime_encoded_word {
+  char * wd_charset;
+  char * wd_text;
+};
+
+LIBETPAN_EXPORT
+struct mailmime_encoded_word *
+mailmime_encoded_word_new(char * wd_charset, char * wd_text);
+
+LIBETPAN_EXPORT
+void mailmime_encoded_word_free(struct mailmime_encoded_word * ew);
+
+LIBETPAN_EXPORT
+void mailmime_charset_free(char * charset);
+
+LIBETPAN_EXPORT
+void mailmime_encoded_text_free(char * text);
+
+
+struct mailmime_disposition {
+  struct mailmime_disposition_type * dsp_type;
+  clist * dsp_parms; /* struct mailmime_disposition_parm */
+};
+
+
+enum {
+  MAILMIME_DISPOSITION_TYPE_ERROR,
+  MAILMIME_DISPOSITION_TYPE_INLINE,
+  MAILMIME_DISPOSITION_TYPE_ATTACHMENT,
+  MAILMIME_DISPOSITION_TYPE_EXTENSION
+};
+
+struct mailmime_disposition_type {
+  int dsp_type;
+  char * dsp_extension;
+};
+
+
+enum {
+  MAILMIME_DISPOSITION_PARM_FILENAME,
+  MAILMIME_DISPOSITION_PARM_CREATION_DATE,
+  MAILMIME_DISPOSITION_PARM_MODIFICATION_DATE,
+  MAILMIME_DISPOSITION_PARM_READ_DATE,
+  MAILMIME_DISPOSITION_PARM_SIZE,
+  MAILMIME_DISPOSITION_PARM_PARAMETER
+};
+
+struct mailmime_disposition_parm {
+  int pa_type;
+  union {
+    char * pa_filename;
+    char * pa_creation_date;
+    char * pa_modification_date;
+    char * pa_read_date;
+    size_t pa_size;
+    struct mailmime_parameter * pa_parameter;
+  } pa_data;
+};
+
+LIBETPAN_EXPORT
+struct mailmime_disposition *
+mailmime_disposition_new(struct mailmime_disposition_type * dsp_type,
+			 clist * dsp_parms);
+
+LIBETPAN_EXPORT
+void mailmime_disposition_free(struct mailmime_disposition * dsp);
+
+LIBETPAN_EXPORT
+struct mailmime_disposition_type *
+mailmime_disposition_type_new(int dt_type, char * dt_extension);
+
+LIBETPAN_EXPORT
+void mailmime_disposition_type_free(struct mailmime_disposition_type * dsp_type);
+
+LIBETPAN_EXPORT
+struct mailmime_disposition_parm *
+mailmime_disposition_parm_new(int pa_type,
+			      char * pa_filename,
+			      char * pa_creation_date,
+			      char * pa_modification_date,
+			      char * pa_read_date,
+			      size_t pa_size,
+			      struct mailmime_parameter * pa_parameter);
+
+LIBETPAN_EXPORT
+void mailmime_disposition_parm_free(struct mailmime_disposition_parm *
+				    dsp_parm);
+
+LIBETPAN_EXPORT
+void mailmime_filename_parm_free(char * filename);
+
+LIBETPAN_EXPORT
+void mailmime_creation_date_parm_free(char * date);
+
+LIBETPAN_EXPORT
+void mailmime_modification_date_parm_free(char * date);
+
+LIBETPAN_EXPORT
+void mailmime_read_date_parm_free(char * date);
+
+LIBETPAN_EXPORT
+void mailmime_quoted_date_time_free(char * date);
+
+struct mailmime_section {
+  clist * sec_list; /* list of (uint32 *) */
+};
+
+LIBETPAN_EXPORT
+struct mailmime_section * mailmime_section_new(clist * list);
+
+LIBETPAN_EXPORT
+void mailmime_section_free(struct mailmime_section * section);
+
+
+LIBETPAN_EXPORT
+void mailmime_decoded_part_free(char * part);
+
+struct mailmime_single_fields {
+  struct mailmime_content * fld_content;
+  char * fld_content_charset;
+  char * fld_content_boundary;
+  char * fld_content_name;
+  struct mailmime_mechanism * fld_encoding;
+  char * fld_id;
+  char * fld_description;
+  uint32_t fld_version;
+  struct mailmime_disposition * fld_disposition;
+  char * fld_disposition_filename;
+  char * fld_disposition_creation_date;
+  char * fld_disposition_modification_date;
+  char * fld_disposition_read_date;
+  size_t fld_disposition_size;
+  struct mailmime_language * fld_language;
+  char * fld_location;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

+ 204 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_types_helper.h

@@ -0,0 +1,204 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_types_helper.h,v 1.17 2008/01/14 17:13:53 hoa Exp $
+ */
+
+#ifndef MAILMIME_TYPES_HELPER_H
+
+#define MAILMIME_TYPES_HELPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+
+LIBETPAN_EXPORT
+int mailmime_transfer_encoding_get(struct mailmime_fields * fields);
+
+LIBETPAN_EXPORT
+struct mailmime_disposition *
+mailmime_disposition_new_filename(int type, char * filename);
+
+LIBETPAN_EXPORT
+struct mailmime_fields * mailmime_fields_new_empty(void);
+
+LIBETPAN_EXPORT
+int mailmime_fields_add(struct mailmime_fields * fields,
+			struct mailmime_field * field);
+
+LIBETPAN_EXPORT
+struct mailmime_fields *
+mailmime_fields_new_with_data(struct mailmime_mechanism * encoding,
+			      char * id,
+			      char * description,
+			      struct mailmime_disposition * disposition,
+			      struct mailmime_language * language);
+
+LIBETPAN_EXPORT
+struct mailmime_fields *
+mailmime_fields_new_with_version(struct mailmime_mechanism * encoding,
+				 char * id,
+				 char * description,
+				 struct mailmime_disposition * disposition,
+				 struct mailmime_language * language);
+
+LIBETPAN_EXPORT
+struct mailmime_content * mailmime_get_content_message(void);
+LIBETPAN_EXPORT
+struct mailmime_content * mailmime_get_content_text(void);
+/* struct mailmime_content * mailmime_get_content(char * mime_type); */
+
+#define mailmime_get_content mailmime_content_new_with_str
+
+LIBETPAN_EXPORT
+struct mailmime_data *
+mailmime_data_new_data(int encoding, int encoded,
+		       const char * data, size_t length);
+
+LIBETPAN_EXPORT
+struct mailmime_data *
+mailmime_data_new_file(int encoding, int encoded,
+		       char * filename);
+
+#if 0
+struct mailmime *
+mailmime_new_message_file(char * filename);
+
+struct mailmime *
+mailmime_new_message_text(char * data_str, size_t length);
+#endif
+
+LIBETPAN_EXPORT
+struct mailmime *
+mailmime_new_message_data(struct mailmime * msg_mime);
+
+LIBETPAN_EXPORT
+struct mailmime *
+mailmime_new_empty(struct mailmime_content * content,
+		   struct mailmime_fields * mime_fields);
+
+LIBETPAN_EXPORT
+int
+mailmime_new_with_content(const char * content_type,
+			  struct mailmime_fields * mime_fields,
+			  struct mailmime ** result);
+
+LIBETPAN_EXPORT
+int mailmime_set_preamble_file(struct mailmime * build_info,
+			       char * filename);
+
+LIBETPAN_EXPORT
+int mailmime_set_epilogue_file(struct mailmime * build_info,
+			       char * filename);
+
+LIBETPAN_EXPORT
+int mailmime_set_preamble_text(struct mailmime * build_info,
+			       char * data_str, size_t length);
+
+LIBETPAN_EXPORT
+int mailmime_set_epilogue_text(struct mailmime * build_info,
+			       char * data_str, size_t length);
+
+LIBETPAN_EXPORT
+int mailmime_set_body_file(struct mailmime * build_info,
+			   char * filename);
+
+LIBETPAN_EXPORT
+int mailmime_set_body_text(struct mailmime * build_info,
+			   char * data_str, size_t length);
+
+LIBETPAN_EXPORT
+int mailmime_add_part(struct mailmime * build_info,
+		      struct mailmime * part);
+
+LIBETPAN_EXPORT
+void mailmime_remove_part(struct mailmime * mime);
+
+LIBETPAN_EXPORT
+void mailmime_set_imf_fields(struct mailmime * build_info,
+    struct mailimf_fields * fields);
+
+
+LIBETPAN_EXPORT
+struct mailmime_disposition *
+mailmime_disposition_new_with_data(int type,
+    char * filename, char * creation_date, char * modification_date,
+    char * read_date, size_t size);
+
+LIBETPAN_EXPORT
+void mailmime_single_fields_init(struct mailmime_single_fields * single_fields,
+    struct mailmime_fields * fld_fields,
+    struct mailmime_content * fld_content);
+
+LIBETPAN_EXPORT
+struct mailmime_single_fields *
+mailmime_single_fields_new(struct mailmime_fields * fld_fields,
+    struct mailmime_content * fld_content);
+
+LIBETPAN_EXPORT
+void mailmime_single_fields_free(struct mailmime_single_fields *
+    single_fields);
+
+LIBETPAN_EXPORT
+int mailmime_smart_add_part(struct mailmime * mime,
+    struct mailmime * mime_sub);
+
+LIBETPAN_EXPORT
+int mailmime_smart_remove_part(struct mailmime * mime);
+
+LIBETPAN_EXPORT
+struct mailmime_content * mailmime_content_new_with_str(const char * str);
+
+LIBETPAN_EXPORT
+struct mailmime_fields * mailmime_fields_new_encoding(int type);
+
+LIBETPAN_EXPORT
+struct mailmime * mailmime_multiple_new(const char * type);
+
+LIBETPAN_EXPORT
+struct mailmime_fields * mailmime_fields_new_filename(int dsp_type,
+    char * filename, int encoding_type);
+
+LIBETPAN_EXPORT
+struct mailmime_parameter *
+mailmime_param_new_with_data(char * name, char * value);
+
+LIBETPAN_EXPORT
+char * mailmime_generate_boundary(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 118 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_write_file.h

@@ -0,0 +1,118 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_write_file.h,v 1.3 2005/06/01 12:22:19 smarinier Exp $
+ */
+
+#ifndef MAILMIME_WRITE_FILE_H
+
+#define  MAILMIME_WRITE_FILE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+#include <stdio.h>
+
+#define MAILMIME_WRITE_COMPATIBILITY
+
+LIBETPAN_EXPORT
+int mailmime_fields_write_file(FILE * f, int * col,
+			  struct mailmime_fields * fields);
+
+LIBETPAN_EXPORT
+int mailmime_content_write_file(FILE * f, int * col,
+			   struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+int mailmime_content_type_write_file(FILE * f, int * col,
+				struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+int mailmime_write_file(FILE * f, int * col,
+		   struct mailmime * build_info);
+
+LIBETPAN_EXPORT
+int mailmime_quoted_printable_write_file(FILE * f, int * col, int istext,
+    const char * text, size_t size);
+
+LIBETPAN_EXPORT
+int mailmime_base64_write_file(FILE * f, int * col,
+    const char * text, size_t size);
+
+LIBETPAN_EXPORT
+int mailmime_data_write_file(FILE * f, int * col,
+    struct mailmime_data * data,
+    int istext);
+
+
+/* binary compatibility with 0.34 - begin */
+
+#ifdef MAILMIME_WRITE_COMPATIBILITY
+LIBETPAN_EXPORT
+int mailmime_fields_write(FILE * f, int * col,
+			  struct mailmime_fields * fields);
+
+LIBETPAN_EXPORT
+int mailmime_content_write(FILE * f, int * col,
+			   struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+int mailmime_content_type_write(FILE * f, int * col,
+				struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+int mailmime_write(FILE * f, int * col,
+		   struct mailmime * build_info);
+
+LIBETPAN_EXPORT
+int mailmime_quoted_printable_write(FILE * f, int * col, int istext,
+    const char * text, size_t size);
+
+LIBETPAN_EXPORT
+int mailmime_base64_write(FILE * f, int * col,
+    const char * text, size_t size);
+
+LIBETPAN_EXPORT
+int mailmime_data_write(FILE * f, int * col,
+    struct mailmime_data * data,
+    int istext);
+#endif
+
+/* binary compatibility with 0.34 - end */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 73 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_write_generic.h

@@ -0,0 +1,73 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_write_generic.h,v 1.2 2004/11/21 21:53:39 hoa Exp $
+ */
+
+#ifndef MAILMIME_WRITE_GENERIC_H
+
+#define  MAILMIME_WRITE_GENERIC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+#include <stdio.h>
+
+int mailmime_fields_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+			  struct mailmime_fields * fields);
+
+int mailmime_content_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+			   struct mailmime_content * content);
+
+int mailmime_content_type_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+				struct mailmime_content * content);
+
+int mailmime_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+		   struct mailmime * build_info);
+
+int mailmime_quoted_printable_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col, int istext,
+    const char * text, size_t size);
+
+int mailmime_base64_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+    const char * text, size_t size);
+
+int mailmime_data_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+    struct mailmime_data * mime_data,
+    int istext);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 80 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailmime_write_mem.h

@@ -0,0 +1,80 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailmime_write_mem.h,v 1.3 2006/06/07 12:52:45 smarinier Exp $
+ */
+
+#ifndef MAILMIME_WRITE_MEM_H
+
+#define  MAILMIME_WRITE_MEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailmime_types.h>
+#include <libetpan/mmapstring.h>
+
+LIBETPAN_EXPORT
+int mailmime_fields_write_mem(MMAPString * f, int * col,
+			  struct mailmime_fields * fields);
+
+LIBETPAN_EXPORT
+int mailmime_content_write_mem(MMAPString * f, int * col,
+			   struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+int mailmime_content_type_write_mem(MMAPString * f, int * col,
+				struct mailmime_content * content);
+
+LIBETPAN_EXPORT
+int mailmime_write_mem(MMAPString * f, int * col,
+		   struct mailmime * build_info);
+
+LIBETPAN_EXPORT
+int mailmime_quoted_printable_write_mem(MMAPString * f, int * col, int istext,
+    const char * text, size_t size);
+
+LIBETPAN_EXPORT
+int mailmime_base64_write_mem(MMAPString * f, int * col,
+    const char * text, size_t size);
+
+LIBETPAN_EXPORT
+int mailmime_data_write_mem(MMAPString * f, int * col,
+    struct mailmime_data * data,
+    int istext);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 146 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3.h

@@ -0,0 +1,146 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailpop3.h,v 1.19 2010/04/05 12:56:44 hoa Exp $
+ */
+
+#ifndef MAILPOP3_H
+
+#define MAILPOP3_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/mailpop3_types.h>
+
+#include <libetpan/mailpop3_helper.h>
+
+#include <libetpan/mailpop3_socket.h>
+#include <libetpan/mailpop3_ssl.h>
+
+#define POP3_STRING_SIZE 513
+
+LIBETPAN_EXPORT
+mailpop3 * mailpop3_new(size_t pop3_progr_rate,
+    progress_function * pop3_progr_fun);
+
+LIBETPAN_EXPORT
+void mailpop3_free(mailpop3 * f);
+
+LIBETPAN_EXPORT
+void mailpop3_set_timeout(mailpop3 * f, time_t timeout);
+
+LIBETPAN_EXPORT
+time_t mailpop3_get_timeout(mailpop3 * f);
+
+LIBETPAN_EXPORT
+void mailpop3_set_progress_callback(mailpop3 * f, mailprogress_function * progr_fun, void * context);
+
+LIBETPAN_EXPORT
+int mailpop3_connect(mailpop3 * f, mailstream * s);
+
+LIBETPAN_EXPORT
+int mailpop3_quit(mailpop3 * f);
+
+LIBETPAN_EXPORT
+int mailpop3_apop(mailpop3 * f, const char * user, const char * password);
+
+LIBETPAN_EXPORT
+int mailpop3_user(mailpop3 * f, const char * user);
+
+LIBETPAN_EXPORT
+int mailpop3_pass(mailpop3 * f, const char * password);
+
+LIBETPAN_EXPORT
+int mailpop3_list(mailpop3 * f, carray ** result);
+
+LIBETPAN_EXPORT
+int mailpop3_retr(mailpop3 * f, unsigned int indx, char ** result,
+		  size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailpop3_top(mailpop3 * f, unsigned int indx,
+    unsigned int count, char ** result,
+    size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailpop3_dele(mailpop3 * f, unsigned int indx);
+
+LIBETPAN_EXPORT
+int mailpop3_noop(mailpop3 * f);
+
+LIBETPAN_EXPORT
+int mailpop3_rset(mailpop3 * f);
+
+LIBETPAN_EXPORT
+void mailpop3_top_free(char * str);
+
+LIBETPAN_EXPORT
+void mailpop3_retr_free(char * str);
+
+LIBETPAN_EXPORT
+int mailpop3_get_msg_info(mailpop3 * f, unsigned int indx,
+			   struct mailpop3_msg_info ** result);
+
+LIBETPAN_EXPORT
+int mailpop3_capa(mailpop3 * f, clist ** result);
+
+LIBETPAN_EXPORT
+void mailpop3_capa_resp_free(clist * capa_list);
+
+LIBETPAN_EXPORT
+int mailpop3_stat(mailpop3 * f, struct mailpop3_stat_response ** result);
+
+LIBETPAN_EXPORT
+void mailpop3_stat_resp_free(struct mailpop3_stat_response * stat_result);
+
+LIBETPAN_EXPORT
+int mailpop3_stls(mailpop3 * f);
+
+LIBETPAN_EXPORT
+int mailpop3_auth(mailpop3 * f, const char * auth_type,
+    const char * server_fqdn,
+    const char * local_ip_port,
+    const char * remote_ip_port,
+    const char * login, const char * auth_name,
+    const char * password, const char * realm);
+
+LIBETPAN_EXPORT
+void mailpop3_set_logger(mailpop3 * session, void (* logger)(mailpop3 * session, int log_type,
+    const char * str, size_t size, void * context), void * logger_context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 64 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_helper.h

@@ -0,0 +1,64 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailpop3_helper.h,v 1.9 2008/02/20 22:15:53 hoa Exp $
+ */
+
+#ifndef MAILPOP3_HELPER_H
+
+#define MAILPOP3_HELPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mailpop3.h"
+
+int mailpop3_login_apop(mailpop3 * f,
+			 const char * user,
+			 const char * password);
+
+int mailpop3_login(mailpop3 * f,
+		    const char * user,
+		    const char * password);
+
+int mailpop3_header(mailpop3 * f, uint32_t indx, char ** result,
+		    size_t * result_len);
+
+void mailpop3_header_free(char * str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

+ 64 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_socket.h

@@ -0,0 +1,64 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailpop3_socket.h,v 1.16 2006/12/26 13:13:24 hoa Exp $
+ */
+
+#ifndef MAILPOP3_SOCKET_H
+
+#define MAILPOP3_SOCKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+
+#include <libetpan/mailpop3_types.h>
+
+LIBETPAN_EXPORT
+int mailpop3_socket_connect(mailpop3 * f, const char * server, uint16_t port);
+
+LIBETPAN_EXPORT
+int mailpop3_socket_starttls(mailpop3 * f);
+
+LIBETPAN_EXPORT
+int mailpop3_socket_starttls_with_callback(mailpop3 * f,
+    void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 61 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_ssl.h

@@ -0,0 +1,61 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailpop3_ssl.h,v 1.17 2006/12/26 13:13:24 hoa Exp $
+ */
+
+#ifndef MAILPOP3_SSL_H
+
+#define MAILPOP3_SSL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#	include <inttypes.h>
+#endif
+
+#include <libetpan/mailpop3_types.h>
+
+LIBETPAN_EXPORT
+int mailpop3_ssl_connect(mailpop3 * f, const char * server, uint16_t port);
+
+LIBETPAN_EXPORT
+int mailpop3_ssl_connect_with_callback(mailpop3 * f, const char * server, uint16_t port,
+    void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 131 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailpop3_types.h

@@ -0,0 +1,131 @@
+/*
+ * libEtPan! -- a mail stuff library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailpop3_types.h,v 1.19 2006/12/13 18:31:33 hoa Exp $
+ */
+
+#ifndef MAILPOP3_TYPES_H
+
+#define MAILPOP3_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <libetpan/libetpan-config.h>
+#include <libetpan/mailstream.h>
+#include <libetpan/mmapstring.h>
+#include <libetpan/carray.h>
+#include <libetpan/clist.h>
+
+enum {
+  MAILPOP3_NO_ERROR = 0,
+  MAILPOP3_ERROR_BAD_STATE,
+  MAILPOP3_ERROR_UNAUTHORIZED,
+  MAILPOP3_ERROR_STREAM,
+  MAILPOP3_ERROR_DENIED,
+  MAILPOP3_ERROR_BAD_USER,
+  MAILPOP3_ERROR_BAD_PASSWORD,
+  MAILPOP3_ERROR_CANT_LIST,
+  MAILPOP3_ERROR_NO_SUCH_MESSAGE,
+  MAILPOP3_ERROR_MEMORY,
+  MAILPOP3_ERROR_CONNECTION_REFUSED,
+  MAILPOP3_ERROR_APOP_NOT_SUPPORTED,
+  MAILPOP3_ERROR_CAPA_NOT_SUPPORTED,
+  MAILPOP3_ERROR_STLS_NOT_SUPPORTED,
+  MAILPOP3_ERROR_SSL,
+  MAILPOP3_ERROR_QUIT_FAILED
+};
+
+typedef struct mailpop3 mailpop3;
+
+struct mailpop3
+{
+  char * pop3_response;               /* response message */
+  char * pop3_timestamp;              /* connection timestamp */
+  
+  /* internals */
+  mailstream * pop3_stream;
+  size_t pop3_progr_rate;
+  progress_function * pop3_progr_fun;
+
+  MMAPString * pop3_stream_buffer;        /* buffer for lines reading */
+  MMAPString * pop3_response_buffer;      /* buffer for responses */
+
+  carray * pop3_msg_tab;               /* list of pop3_msg_info structures */
+  int pop3_state;                        /* state */
+
+  unsigned int pop3_deleted_count;
+  
+  struct {
+    void * sasl_conn;
+    const char * sasl_server_fqdn;
+    const char * sasl_login;
+    const char * sasl_auth_name;
+    const char * sasl_password;
+    const char * sasl_realm;
+    void * sasl_secret;
+  } pop3_sasl;
+
+  time_t pop3_timeout;
+  mailprogress_function * pop3_progress_fun;
+  void * pop3_progress_context;
+  
+  void (* pop3_logger)(mailpop3 * session, int log_type, const char * str, size_t size, void * context);
+  void * pop3_logger_context;
+};
+
+struct mailpop3_msg_info
+{
+  unsigned int msg_index;
+  uint32_t msg_size;
+  char * msg_uidl;
+  int msg_deleted;
+};
+
+
+struct mailpop3_capa {
+  char * cap_name;
+  clist * cap_param; /* (char *) */
+};
+
+
+struct mailpop3_stat_response  {
+  unsigned int msgs_count;
+  size_t msgs_size;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 145 - 0
deltachat-ios/libraries/deltachat-core/libs/libetpan/include/libetpan/mailprivacy.h

@@ -0,0 +1,145 @@
+/*
+ * libEtPan! -- a mail library
+ *
+ * Copyright (C) 2001, 2005 - DINH Viet Hoa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the libEtPan! project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id: mailprivacy.h,v 1.6 2007/12/10 21:32:59 hoa Exp $
+ */
+
+#ifndef MAILPRIVACY_H
+
+#define MAILPRIVACY_H
+
+#include <libetpan/mailmessage.h>
+#include <libetpan/mailprivacy_types.h>
+#include <libetpan/mailprivacy_tools.h>
+
+LIBETPAN_EXPORT
+struct mailprivacy * mailprivacy_new(char * tmp_dir, int make_alternative);
+
+LIBETPAN_EXPORT
+void mailprivacy_free(struct mailprivacy * privacy);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_get_bodystructure(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    struct mailmime ** result);
+
+LIBETPAN_EXPORT
+void mailprivacy_msg_flush(struct mailprivacy * privacy,
+    mailmessage * msg_info);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_fetch_section(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    struct mailmime * mime,
+    char ** result, size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_fetch_section_header(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    struct mailmime * mime,
+    char ** result,
+    size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_fetch_section_mime(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    struct mailmime * mime,
+    char ** result,
+    size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_fetch_section_body(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    struct mailmime * mime,
+    char ** result,
+    size_t * result_len);
+
+LIBETPAN_EXPORT
+void mailprivacy_msg_fetch_result_free(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    char * msg);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_fetch(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    char ** result,
+    size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailprivacy_msg_fetch_header(struct mailprivacy * privacy,
+    mailmessage * msg_info,
+    char ** result,
+    size_t * result_len);
+
+LIBETPAN_EXPORT
+int mailprivacy_register(struct mailprivacy * privacy,
+    struct mailprivacy_protocol * protocol);
+
+LIBETPAN_EXPORT
+void mailprivacy_unregister(struct mailprivacy * privacy,
+    struct mailprivacy_protocol * protocol);
+
+LIBETPAN_EXPORT
+char * mailprivacy_get_encryption_name(struct mailprivacy * privacy,
+    char * privacy_driver, char * privacy_encryption);
+
+/* deprecated */
+LIBETPAN_EXPORT
+int mailprivacy_encrypt(struct mailprivacy * privacy,
+    char * privacy_driver, char * privacy_encryption,
+    struct mailmime * mime,
+    struct mailmime ** result);
+
+/* introduced the use of passphrase */
+LIBETPAN_EXPORT
+int mailprivacy_encrypt_msg(struct mailprivacy * privacy,
+    char * privacy_driver, char * privacy_encryption,
+    mailmessage * msg,
+    struct mailmime * mime,
+    struct mailmime ** result);
+
+LIBETPAN_EXPORT
+void mailprivacy_debug(struct mailprivacy * privacy, FILE * f);
+
+LIBETPAN_EXPORT
+carray * mailprivacy_get_protocols(struct mailprivacy * privacy);
+
+LIBETPAN_EXPORT
+int mailprivacy_is_encrypted(struct mailprivacy * privacy,
+    mailmessage * msg,
+    struct mailmime * mime);
+
+LIBETPAN_EXPORT
+void mailprivacy_recursive_unregister_mime(struct mailprivacy * privacy,
+    struct mailmime * mime);
+
+#endif

Some files were not shown because too many files changed in this diff