@@ -84,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
+ },
+ {
+ "idiom" : "ios-marketing",
+ "size" : "1024x1024",
+ "scale" : "1x"
}
],
"info" : {
@@ -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.
@@ -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
+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
+ 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
+ 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
+2011-06-13 - libetpan-1.0cvs66 - hoa
+ 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
+ workaround for mail.maximedia.nl server.
+2011-05-23 - libetpan-1.0cvs63 - hoa
+ 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
+ fixed crash.
+2011-05-09 - libetpan-1.0cvs59 - hoa
+ 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
+ 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_disposition.c
+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
+ fixed namespace parser failure.
+ workaround for Courier-IMAP.
+2011-04-27 - libetpan-1.0cvs53 - hoa
+ 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
+ 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
+ workaround for Zoho Mail IMAP implementation.
+2011-04-06 - libetpan-1.0cvs46 - hoa
+ fallback when parsing Content-ID of Message-ID.
+2011-04-02 - libetpan-1.0cvs45 - hoa
+ 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
+ workaround for Mbox Mail for Mac.
+2011-03-25 - libetpan-1.0cvs40 - hoa
+ workaround for Exchange (blank lines between response).
+2011-03-24 - libetpan-1.0cvs39 - hoa
+ improved workaround for Exchange servers.
+2011-03-24 - libetpan-1.0cvs38 - hoa
+ 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_types.c
+2011-03-15 - libetpan-1.0cvs36 - hoa
+ 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
+ fixed MIME Content-ID and Message-ID parser.
+2011-03-11 - libetpan-1.0cvs33 - hoa
+ revert libetpan-1.0cvs32.
+2011-03-11 - libetpan-1.0cvs32 - hoa
+ private log identifier is 3.
+2011-03-11 - libetpan-1.0cvs31 - hoa
+ * src/data-types/mailstream.[ch]
+ * src/low-level/nntp/newsnntp.c
+ * src/low-level/pop3/mailpop3.c
+ authentication privacy.
+2011-03-10 - libetpan-1.0cvs30 - hoa
+ support for broken AUTH advertisement.
+2011-03-07 - libetpan-1.0cvs29 - hoa
+ handle SMTP error code for authentication error.
+2011-03-06 - libetpan-1.0cvs28 - hoa
+ implemented workaround for exchange IMAP server (for multipart/signed).
+2011-03-04 - libetpan-1.0cvs27 - hoa
+ implemented workaround for exchange IMAP server.
+2011-03-03 - libetpan-1.0cvs26 - hoa
+ * src/low-level/imap/namespace_types.c
+2011-02-28 - libetpan-1.0cvs25 - hoa
+ * src/low-level/smtp/mailsmtp_types.h
+ implements SMTP authentication availability.
+2011-02-27 - libetpan-1.0cvs24 - hoa
+ * src/data-types/connect.c
+ fixed build for win32.
+2011-02-27 - libetpan-1.0cvs23 - hoa
+ fixed error check for SMTP.
+2011-02-20 - libetpan-1.0cvs22 - hoa
+2011-02-20 - libetpan-1.0cvs21 - hoa
+ workaround Yahoo IMAP server.
+2011-02-20 - libetpan-1.0cvs20 - hoa
+ * src/low-level/imap/namespace.c
+ fixed parser.
+2011-02-19 - libetpan-1.0cvs19 - hoa
+ * build-mac/libetpan.xcodeproj/project.pbxproj
+ * src/low-level/imap/acl.h
+ * src/low-level/imap/annotatemore.h
+ * src/low-level/imap/mailimap.h
+ * src/low-level/imap/quota.[ch]
+ * src/low-level/imap/quota_sender.h
+ * 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/engine/mailprivacy_tools.c
+ * src/low-level/imap/mailimap_types.[ch]
+ * src/low-level/mime/mailmime.[ch]
+ * src/low-level/mime/mailmime_types.[ch]
+ support for Content-Location. breaks binary compatibility.
+2010-12-15 - libetpan-1.0cvs17 - hoa
+2010-12-05 - libetpan-1.0cvs16 - hoa
+ use GBK instead of GB2312 and GB_2312-80
+2010-11-30 - libetpan-1.0cvs15 - hoa
+ fixed IMAP parser
+2010-11-28 - libetpan-1.0cvs14 - hoa
+ * src/data-types/mailstream_helper.[ch]
+ * src/low-level/imap/mailimap.[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/windows/win_etpan.h
+ * tests/option-parser.c
+ improved port for win32.
+2010-11-10 - libetpan-1.0cvs11 - hoa
+ fixed decode of MIME header.
+2010-11-04 - libetpan-1.0cvs10 - hoa
+ 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
+ create an empty list in case of empty multipart.
+2010-09-04 - libetpan-1.0cvs6 - hoa
+ workaround Gmail IMAP bug: zero bodies in multipart.
+2010-09-03 - libetpan-1.0cvs5 - hoa
+ * build-windows/libetpan_version.h
+ update version.
+ report parse error.
+ * build-mac/update.sh
+ fixed mac update.
+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
+ implements RFC 1870 (SMTP SIZE).
+2010-07-22 - libetpan-1.0cvs2 - hoa
+ * src/low-level/imap/mailimap_sender.c
+ fixed date when appending.
+2010-05-30 - libetpan-1.0cvs1 - hoa
+ 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
+ Fixed --enable-debug flag in configure script.
+ Support of Berkeley DB 4.8.
+ Thanks to Tim Harder.
+2010-04-05 - libetpan-0.58cvs26 - hoa
+ fixed script.
+2010-04-05 - libetpan-0.58cvs25 - hoa
+ fixed integration of patch (libetpan-0.58cvs22).
+ fixed error code.
+2010-04-05 - libetpan-0.58cvs24 - hoa
+ 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
+ * 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/driver/implementation/db/dbdriver.c
+ * src/driver/implementation/imap/imapdriver.c
+ * src/driver/implementation/nntp/nntpdriver_cached.c
+ * src/engine/mailprivacy.c
+ * src/low-level/feed/newsfeed.c
+ * src/low-level/mbox/mailmbox.c
+ * tests/decrypt.c
+ * tests/smime.c
+ fixed some warnings. Thanks to Didier Barvaux.
+2010-04-05 - libetpan-0.58cvs21 - hoa
+ fixed memory leak (2941557). Thanks to Juha Paananen.
+ fixed IMAP search (2941559). Thanks to Juha Paananen.
+2010-04-05 - libetpan-0.58cvs20 - hoa
+ * 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
+ import of OpenSSL (prepare build for iPhone including OpenSSL)
+ * 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
+ log protocol by stream
+2010-01-17 - libetpan-0.58cvs17 - hoa
+ build mac with quota
+2010-01-14 - libetpan-0.58cvs16 - hoa
+ build with quota.
+2010-01-04 - libetpan-0.58cvs15 - hoa
+ fixed error code in extension parser (2918352). Thanks to Chris Head.
+2010-01-04 - libetpan-0.58cvs14 - hoa
+ * 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/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
+ 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/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
+ fixed crash (Thanks Gabor for discovering the bug).
+2009-12-19 - libetpan-0.58cvs8 - hoa
+ * mailimap_parser.[ch]
+ workaround in parser for imap.gmx.com (Thanks Matt Ronge for reproducible case).
+2009-11-05 - libetpan-0.58cvs7 - hoa
+ * 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
+ added build for Mac OS X (within Xcode).
+2009-09-07 - libetpan-0.58cvs5 - hoa
+ * src/low-level/feed/parser.c
+ fixed errors detected by clang static analyzer.
+2009-09-06 - libetpan-0.58cvs4 - hoa
+ fixed warning.
+2009-08-29 - libetpan-0.58cvs3 - hoa
+ fixed some crash (and workaround of MailCore).
+ Thanks to Gabor Cselle.
+2009-08-29 - libetpan-0.58cvs2 - hoa
+ * src/driver/implementation/nntp/nntpdriver.c
+ Thanks to Pawel Pekala.
+2009-07-23 - libetpan-0.58cvs1 - hoa
+ fixed build for Mac OS X
+ fix a crash.
+ Thanks to Gabor Cselle, Stefano Barbato
+ * src/driver/implementation/maildir/maildirdriver_cached.c
+ * src/driver/implementation/pop3/pop3storage.c
+ * src/driver/tools/imfcache.c
+ fix memory leaks.
+ bugfixes.
+2009-06-16 - libetpan-0.58 - hoa
+ * release 0.58
+ Improvements on SSL implementation.
+2009-06-16 - libetpan-0.57cvs4 - hoa
+ prepare for 0.58
+2009-06-12 - libetpan-0.57cvs3 - colin
+ Gnutls: Better fix (API-compatible with libgnutls13)
+2009-06-12 - libetpan-0.57cvs2 - colin
+ Gnutls: Use compatibility mode to avoid being unable to
+ connect to some servers. (see Claws Mail's bug #1930)
+ Fix error with automake 1.10.2
+2008-11-21 - libetpan-0.57cvs1 - colin
+ 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
+ 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
+ Check ssl_context to see if it's NULL (fixes crash)
+2008-08-30 - libetpan-0.55cvs1 - colin
+ 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
+ support for db 4.7
+2008-07-04 - libetpan-0.54cvs16 - hoa
+ fixed wait_read() in ssl stream implementation.
+2008-07-03 - libetpan-0.54cvs15 - colin
+ * 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
+ Fixed timezone calculation.
+2008-06-15 - libetpan-0.54cvs13 - hoa
+ 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.
+ workarounded bug on lavabit.com server.
+2008-05-26 - libetpan-0.54cvs11 - hoa
+ fixed build of tests where getopt_long is not present.
+2008-05-26 - libetpan-0.54cvs10 - hoa
+ 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
+ Fixed crash in parser.
+2008-05-22 - libetpan-0.54cvs7 - hoa
+ updated version of win32 build
+ fixed 1909672: Date fields parsed as optional field on 64 bit OS.
+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
+ fixed charset handling in RSS parser.
+2008-03-16 - libetpan-0.54cvs3 - colin
+ fixed collection of IMAP message envelope.
+2008-02-28 - libetpan-0.54cvs2 - colin
+ * 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
+ 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
+ prepare for 0.54
+2008-02-20 - libetpan-0.53cvs5 - hoa
+ * src/driver/implementation/imap/imapdriver_cached.c
+ * src/driver/tools/mailthread.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_tools_private.h
+ * src/driver/implementation/mbox/mboxdriver_tools.[ch]
+ * src/driver/implementation/mh/mhdriver.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/mailimap_extension.[ch]
+ * src/low-level/imap/mailimap_keywords.[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/mh/mailmh.[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_helper.[ch]
+ cleanup. Thanks to Daniel Richard G.
+ removed deprecated cinthash.
+2008-02-17 - libetpan-0.53cvs3 - hoa
+ * src/data-types/mailstream.c
+ * src/driver/implementation/data-message/data_message_driver.c
+ * src/driver/implementation/db/dbdriver_message.c
+ * src/driver/implementation/db/dbstorage.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_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_message.c
+ * src/driver/implementation/mbox/mboxdriver_message.c
+ * src/driver/implementation/mbox/mboxstorage.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_cached_message.c
+ * src/driver/implementation/nntp/nntpdriver_message.c
+ * src/driver/implementation/nntp/nntpstorage.c
+ * src/driver/implementation/pop3/pop3driver_cached_message.c
+ * src/driver/implementation/pop3/pop3driver_message.c
+ * src/engine/mailprivacy_tools_private.h
+ * src/low-level/feed/date.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_print.c
+ * src/low-level/imap/uidplus.c
+ * src/low-level/imap/uidplus_types.h
+ * src/low-level/maildir/maildir.c
+ * tests/option-parser.h
+ * tests/readmsg-common.h
+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
+ 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
+ workaround for gmail IMAP bug.
+2008-01-29 - libetpan-0.52cvs36 - colin
+ 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
+ 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.
+2008-01-14 - libetpan-0.52cvs33 - hoa
+ * src/low-level/mime/mailmime_types_helper.h
+ fixed cache of MIME parts when no boundary is specified.
+2008-01-01 - libetpan-0.52cvs32 - hoa
+ Fixed build on Solaris.
+2007-12-15 - libetpan-0.52cvs31 - hoa
+ * src/data-types/mailstream_ssl_private.h ** NEW FILE **
+ * 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.
+ Fixed build on Windows.
+2007-12-14 - libetpan-0.52cvs30 - colin
+ Allow "too short" certificates (512 bits < len < 1024bits)
+2007-12-13 - libetpan-0.52cvs29 - hoa
+ progress function is now called properly on IMAP.
+ * tests/fetch-attachment.c
+ * tests/pgp.c
+ Fixed build on Mac OS X.
+2007-12-10 - libetpan-0.52cvs28 - Marcus Brinkmann
+ Do not define LIBETPAN_DLL on mingw32 targets for now.
+ 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.
+ Use read instead mmap to get file content.
+2007-11-25 - libetpan-0.52cvs27 - hoa
+ Thanks to astavtsev.
+2007-11-15 - libetpan-0.52cvs26 - hoa
+ fixed MIME parser for Content-Disposition.
+2007-11-15 - libetpan-0.52cvs25 - hoa
+ fixed uninitialized variable.
+2007-11-14 - libetpan-0.52cvs24 - hoa
+ fixed IMAP driver.
+ * m4/README *** ADDED FILE ***
+ * m4/libtool.m4 *** REMOVED FILE ***
+2007-11-10 - libetpan-0.52cvs23 - hoa
+ fixed quoted-printable when the given text did not finish with LF.
+2007-11-08 - libetpan-0.52cvs22 - hoa
+ fixed IMAP parser.
+2007-11-07 - libetpan-0.52cvs21 - hoa
+2007-11-03 - libetpan-0.52cvs20 - hoa
+ fixed MIME parser. Thanks to woolshum for reporting.
+2007-11-01 - libetpan-0.52cvs19 - hoa
+ * Makefile.am
+2007-10-30 - libetpan-0.52cvs18 - hoa
+ support for gmail broken IMAP server.
+2007-10-30 - libetpan-0.52cvs18 - Marcus Brinkmann
+ 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_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
+ 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.
+ (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
+ 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.
+ Add windows to SUBDIRS only if HAVE_MINGW32_SYSTEM. In this
+ case, add windows/libarch.la to libetpan.la.
+ 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 ***
+ Include config.h and win_etpan.h conditionally.
+ Include win_etpan.h conditionally. Use WIN32 instead of _MSC_VER.
+ * src/windows/time_r.c
+ Include config.h conditionally. Use WIN32 instead of _MSC_VER.
+ * src/driver/implementation/mh/mhdriver_tools.c
+ * src/driver/interfaces/maildriver_tools.c
+ * src/driver/interfaces/mailstorage_tools.c
+ * src/driver/tools/generic_cache.c
+ * src/low-level/mh/mailmh.c
+ * tests/readmsg-common.c
+ Use WIN32 instead of _MSC_VER.
+ Include win_etpan.h for WIN32 instead of just _MSC_VER.
+ Do not use pthread only for _MSC_VER instead all WIN32.
+ Include win_etpan.h instead of sys/mman.h on Windows.
+ Use WIN32 instead of _MSC_VER. Do not check UID on windows.
+ Include win_etpan.h instead of sys/mman.h and sys/wait.h
+ on Windows. Rewrite command passphrase handling for Windows.
+ Include win_etpan.h instead of sys/mman.h and libgen.h.
+ Include stdlib.h.
+ Build libarch.la.
+ 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.
+ 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.
+ Add check for mingw32 platform. Auto-detect IPv6
+ support. Check for pthreads-w32.
+2007-10-22 - libetpan-0.52cvs12 - hoa
+ Fixed memory leak in GnuTLS related code.
+ Thanks to Colin Leroy.
+2007-10-20 - libetpan-0.52cvs11 - hoa
+ fixed false SASL auth type for try apop.
+ Thanks to Vasily Osadchuk.
+2007-10-19 - libetpan-0.52cvs10 - hoa
+ lower limits on server key length restriction
+ on GnuTLS implementation.
+2007-10-11 - libetpan-0.52cvs9 - hoa
+ 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
+ changed error code when opening cache file does not work.
+2007-09-18 - libetpan-0.52cvs6 - hoa
+ workaround Exchange authentication response.
+ Thanks to Horia Olaru.
+2007-09-15 - libetpan-0.52cvs5 - hoa
+ 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
+ Fixed POP3 SASL authentication.
+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
+ added detection of db 4.5
+2007-08-08 - libetpan-0.52cvs1 - hoa
+ 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_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
+ build when IPv6 is not supported.
+ advertised version.
+2007-08-06 - libetpan-0.51cvs1 - hoa
+ build problem when IPv6 is not supported.
+2007-08-03 - libetpan-0.51 - alfie
+ * release 0.51 - Sex & Religion
+ SASL enabled build fixed
+ GnuTLS build fixed
+ BIOs handling fix for openSSL
+2007-07-30 - libetpan-0.50cvs6 - colin
+ put back the (ai == NULL) test - it was alright
+ but a break was missing in the for loop
+ rename wait_connect to wait_SSL_connect for
+ clarity
+2007-07-30 - libetpan-0.50cvs5 - colin
+ fix non-blocking connection (select()ing for
+ connect is on writability)
+ fix handling of non-blocking underlying BIOs for
+ openSSL; fix build with GnuTLS.
+2007-07-28 - libetpan-0.50cvs4 - hoa
+ connection to server has timeout using
+ mailstream_network_delay.
+2007-07-27 - libetpan-0.50cvs3 - hoa
+ workaround broken behavior of www.safe-mail.net server.
+2007-07-27 - libetpan-0.50cvs2 - hoa
+ cleanup: mapped MAILSMTP_AUTH_LOGIN authentication type
+ on SASL LOGIN mechanism.
+2007-07-25 - libetpan-0.50cvs1 - hoa
+ 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
+ several build fixes for Windows
+ documentation build fixed
+2007-07-21 - libetpan-0.49cvs32 - hoa
+ revert previous change. this was not correct.
+2007-07-21 - libetpan-0.49cvs31 - hoa
+ set timeout also on SSL sessions.
+2007-07-21 - libetpan-0.49cvs30 - hoa
+ 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
+ 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
+ * src/main/libetpan_version.h.in
+ * AUTHORS *** NEW FILES ***
+ * Makefile.am *** NEW FILES ***
+ * README *** NEW FILES ***
+ * 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.
+2007-07-15 - libetpan-0.49cvs24 - hoa
+ fixed integer sign. (bis)
+2007-07-14 - libetpan-0.49cvs24 - hoa
+ fixed integer sign.
+2007-07-12 - libetpan-0.49cvs23 - smarinier
+ * build-windows/README.txt
+ * build-windows/build_headers.list
+ * build-windows/libetpan-config.h
+ 2 new projects : debug_ssl and release_ssl
+ mutex, ssl for windows
+ * src/low-level/mime/mailmime_write_mem.c
+ warning
+ * src/windows/inet_aton.c
+ inet_aton for Windows
+2007-07-01 - libetpan-0.49cvs22 - hoa
+ 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_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
+ improved API to fetch article by Message ID.
+2007-06-29 - libetpan-0.49cvs19 - hoa
+ * src/low-level/nntp/newsnntp.h
+ allows fetch article by Message-ID.
+ Thanks to Thomas Glanzmann.
+2007-05-26 - libetpan-0.49cvs18 - hoa
+ 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
+ fixed cancel on win32. Thanks to Andrei N. Balabohin.
+ fixed include for win32.
+ prepare for IMAP IDLE.
+2007-05-24 - libetpan-0.49cvs15 - hoa
+ prefixed properly global symbols.
+2007-05-19 - libetpan-0.49cvs14 - hoa
+ fixed comparison.
+2007-05-02 - libetpan-0.49cvs13 - hoa
+ 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
+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/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/newsfeed.h
+ * 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_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
+ 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
+ fixed behavior of mailmime_encoded_phrase_parse().
+ Thanks to Laurent Birtz.
+2007-01-28 - libetpan-0.49cvs4 - hoa
+ fixed build for Windows. Thanks to Andrei N. Balabohin.
+ * 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
+ fill msg_fields field in mailmessage structure
+ for data message driver.
+2007-01-28 - libetpan-0.49cvs2 - hoa
+ * src/low-level/feed/newsfeed_private.[ch]
+ * src/low-level/feed/parser_atom10.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/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
+ implementation of RSS/ATOM feed.
+ Still needs to write autodetection for needed libraries.
+2007-01-08 - libetpan-0.49 - alfie
+ * release 0.49 - Drive
+ stream cancellation
+ better handling of ssl error
+ improved imap cache
+ various bugfixes
+2007-01-07 - libetpan-0.48cvs15 - hoa
+ remove unnecessary casts, fixed properly header.
+2007-01-06 - libetpan-0.48cvs14 - colin
+ Cleaner type fix -- Changes mailstream_ssl_get_certificate
+ return type to ssize_t
+2007-01-06 - libetpan-0.48cvs13 - colin
+ Fixed size_t/int problem.
+2007-01-06 - libetpan-0.48cvs12 - colin
+ Fixed GNUTLS build.
+2006-12-29 - libetpan-0.48cvs11 - hoa
+ simplified code. Fixed build.
+2006-12-29 - libetpan-0.48cvs10 - colin
+ 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/low-level/imf/mailimf_types_helper.[ch]
+ avoid code duplication.
+ build for Windows.
+ * 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.
+ cleanup.
+2006-12-23 - libetpan-0.48cvs7 - hoa
+ 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/mailstream_socket.h
+ cancel implemented. breaks binary compatibility.
+ fixed MIME parser. Thanks to Laurent Birtz.
+2006-12-13 - libetpan-0.48cvs4 - hoa
+ removed C99 structure style. Use a unique code for Unix/Windows.
+ make a function really internal.
+ * src/low-level/pop3/mailpop3.h
+ * src/low-level/pop3/mailpop3_socket.h
+ * src/driver/interface/maildriver_errors.h
+ * src/low-level/nntp/newsnntp_types.h
+ * src/low-level/pop3/mailpop3_types.h
+ SSL error management.
+ exports some functions for Windows.
+ removed warning.
+ compilation fix for Windows.
+2006-12-12 - libetpan-0.48cvs3 - hoa
+ Fixed code documentation.
+ Fixed warning. Thanks to anosek.
+ Interpret 'UTF8' as 'UTF-8'.
+2006-12-10 - libetpan-0.48cvs2 - colin
+ fix crash when server answers " * BYE"
+ Fixes debian bug #398382
+2006-11-12 - libetpan-0.48cvs1 - hoa
+ cache of bodystructure for IMAP driver.
+2006-10-26 - libetpan-0.48 - alfie
+ * release 0.48 - Hypergeek
+ UIDPLUS implemented
+ various smaller code fixes
+2006-10-26 - libetpan-0.47cvs6 - hoa
+ fixed the code of response_info_free().
+2006-10-25 - libetpan-0.47cvs5 - hoa
+ fixed the code of db_get_next_validity().
+2006-10-22 - libetpan-0.47cvs4 - hoa
+ 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/uidplus.[ch]
+ added an API to check the capabilities.
+ fixed UIDPLUS copy.
+2006-10-20 - libetpan-0.47cvs1 - hoa
+ * src/low-level/imap/acl_types.c
+ 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
+ IPv6 Support
+ various leaks and crashes
+ MIME decoding fix
+ gnutls fix
+ SASL fix
+ AUTH parser fix
+2006-10-13 - libetpan-0.46cvs13 - alfie
+ order it backward compatible.
+2006-10-12 - libetpan-0.46cvs12 - hoa
+2006-10-12 - libetpan-0.46cvs11 - hoa
+2006-10-07 - libetpan-0.46cvs10 - hoa
+ fixed MIME header decoding.
+2006-09-25 - libetpan-0.46cvs9 - colin
+ Really fix gnutls' init.
+2006-09-24 - libetpan-0.46cvs8 - colin
+ Fix a typo that made gnutls crash on some servers
+ (mail.hp.com:993 for example). Sorry :-/
+2006-09-05 - libetpan-0.46cvs7 - hoa
+ 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
+ improved performance of certificates collector.
+ fixed use of SASL.
+2006-08-05 - libetpan-0.46cvs5 - hoa
+ exports maillock.h
+ file descriptor is now optional.
+ disable fcntl() call on win32.
+ fixed a leak.
+ * src/driver/implementation/nntp/nntpdriver_tools.c
+ 'unknown' character set is considered as 'iso-8859-1'.
+ fixed AUTH parser.
+ improved error management.
+2006-07-15 - libetpan-0.46cvs4 - hoa
+ IPv6 is enabled by default.
+2006-07-15 - libetpan-0.46cvs3 - hoa
+ IPv6 implementation. Thanks to Didier Barvaux.
+2006-07-15 - libetpan-0.46cvs2 - hoa
+ fixed libetpan version for Windows.
+ fixed function prototype.
+2006-07-14 - libetpan-0.46cvs1 - hoa
+ fixed a crash in case of parse error on Bcc field.
+2006-07-12 - libetpan-0.46 - alfie
+ * release 0.46 - Drawing Circles
+ imap extension api
+ imap annotate
+ C89 conformance
+ 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
+ moved variable declarations up to avoid having declarations
+ after statements, plus some minor syntax fixes
+2006-06-29 - libetpan-0.45cvs16 - hoa
+ temporary fix for install.
+2006-06-28 - libetpan-0.45cvs15 - skunk
+ checked in the remaining bits of the last patch
+2006-06-26 - libetpan-0.45cvs14 - hoa
+ * src/Makefile.in
+ * src/data-types/mapping.c
+ * src/driver/Makefile
+ * src/driver/implementation/data-message/Makefile
+ * src/driver/implementation/db/Makefile
+ * src/driver/implementation/hotmail/Makefile
+ * src/driver/implementation/imap/Makefile
+ * src/driver/implementation/maildir/Makefile
+ * src/driver/implementation/mbox/Makefile
+ * src/driver/implementation/mh/Makefile
+ * src/driver/implementation/mime-message/Makefile
+ * src/driver/implementation/nntp/Makefile
+ * src/driver/implementation/pop3/Makefile
+ * src/driver/interface/Makefile
+ * src/driver/tools/Makefile
+ * src/engine/Makefile
+ * src/low-level/imap/acl_sender.c
+ * src/low-level/imap/annotatemore_sender.c
+ * src/low-level/mime/mailmime.c
+ * src/low-level/mime/mailmime_types.c
+ * src/low-level/mime/mailmime_write.c
+ * src/low-level/mime/mailmime_write_file.c
+ * src/low-level/smtp/mailsmtp_ssl.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/interface/maildriver.[ch]
+ * src/driver/interface/maildriver_tools.[ch]
+ * src/low-level/imap/mailimap_helper.[ch]
+ * tests/option-parser.[ch]
+ use const char* when char* is not necessary (2)
+2006-06-06 - libetpan-0.45cvs11 - smarinier
+ add (slow) remove_message to imap_driver
+2006-06-02 - libetpan-0.45cvs10 - smarinier
+ minor bug on nn_command deletion
+ * src/driver/implementation/maildir/maildirstorage.[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]
+ 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
+ support for newer version of Debian Berkeley DB.
+2006-05-22 - libetpan-0.45cvs7 - hoa
+ * src/data-types/carray.c
+ * src/data-types/chash.c
+ * src/data-types/cinthash.c
+ * src/data-types/mail_cache_db.c
+ * src/data-types/mailsem.c
+ * src/data-types/md5.h
+ * src/driver/implementation/hotmail/hotmailstorage.c
+ * src/driver/implementation/maildir/maildirdriver_tools.c
+ * src/driver/implementation/maildir/maildirdriver_types.h
+ * src/driver/implementation/mbox/mboxdriver_tools.c
+ * src/driver/implementation/mbox/mboxdriver_types.h
+ * src/driver/implementation/mh/mhdriver_types.h
+ * 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/tools/mailthread_types.[ch]
+ * src/engine/mailengine.c
+ * src/low-level/imf/mailimf_types.h
+ * src/low-level/imf/mailimf_write_generic.c
+ * src/low-level/maildir/maildir_types.h
+ * src/low-level/mbox/mailmbox_parse.c
+ * src/low-level/mbox/mailmbox_types.[ch]
+ * src/low-level/mime/mailmime_types.h
+ * src/low-level/nntp/newsnntp_socket.[ch]
+ * src/low-level/pop3/mailpop3_helper.c
+ * src/main/libetpan_version.c
+ cleanup of libetpan.
+ Thanks to Daniel Richard G.
+2006-05-17 - libetpan-0.45cvs6 - hoa
+ fixed UTF-8 character maximum size.
+ message list cache.
+ fixed 'From ' skipper.
+2006-04-16 - libetpan-0.45cvs5 - colin
+ Fix missing mailimap_annotatemore_entry_list_new
+2006-04-16 - libetpan-0.45cvs4 - colin
+ 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
+ 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 *
+ 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.
+ 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/charconv.h
+ fixed includes
+2006-03-20 - libetpan-0.44cvs1 - hoa
+2006-03-10 - libetpan-0.44
+ * release 0.44 - Lateralus
+ fixed versions
+2006-03-08 - libetpan-0.43
+ * release 0.43 - Lateralus
+2006-03-08 - libetpan-0.42cvs5 - hoa
+ * ChangeLog
+ * libetpan-config.in
+ prepare for release
+2006-02-15 - libetpan-0.42cvs4 - colin
+ Implement certificate retrieval
+2006-02-15 - libetpan-0.42cvs3 - colin
+ 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
+ Use SSLv23 instead of TLSv1, seems to be more
+ universal
+2006-02-09 - libetpan-0.42cvs1 - colin
+ Fix return value when we get SSL_ERROR_ZERO_RETURN
+2006-01-09 - libetpan-0.42
+ * release 0.41 - Figure Number Five
+2006-01-04 - libetpan-0.41cvs10 - hoa
+ fixed SMTP SASL login.
+ 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
+ fixed maildir expunge.
+ implemented SMTP RSET (reset).
+2005-12-18 - libetpan-0.41cvs7 - hoa
+ implemented SMTP NOOP.
+2005-12-16 - libetpan-0.41cvs6 - hoa
+ * Makefile.in
+ added empty target 'test'
+ fixed build when disabling thread safety.
+2005-12-16 - libetpan-0.41cvs5 - hoa
+ fixed quoting of filename in shell calls.
+2005-12-07 - libetpan-0.41cvs4 - hoa
+ fixed build when SSL is not available.
+2005-12-07 - libetpan-0.41cvs3 - hoa
+2005-12-04 - libetpan-0.41cvs2 - hoa
+ fixed libtool version
+2005-12-02 - libetpan-0.41cvs1 - hoa
+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
+ fixed signing.
+ display needed passphrase.
+2005-11-21 - libetpan-0.40cvs5 - hoa
+ OpenSSL has priority in detection.
+ * src/engine/mailprivacy.[ch]
+ * src/engine/mailprivacy_gnupg.[ch]
+ * src/engine/mailprivacy_smime.[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
+ Try to finish handshaking when
+ possible with gnutls.
+2005-10-09 - libetpan-0.40cvs3 - colin
+ fixed deadlock on the mutex
+2005-10-09 - libetpan-0.40cvs2 - colin
+ fixed compilation with GnuTLS
+2005-10-09 - libetpan-0.40cvs1 - hoa
+ avoid symbols conflicts between OpenSSL and GnuTLS.
+2005-10-07 - libetpan-0.40 - hoa
+ * release 0.40 - Kashmir
+ SSL initialization is optional.
+2005-10-06 - libetpan-0.39cvs2 - hoa
+ fixed compilation on Solaris.
+2005-10-02 - libetpan-0.39cvs1 - hoa
+ * 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
+ fixed compatibility with GnuTLS.
+2005-08-17 - libetpan-0.38cvs4 - hoa
+ fixed crash when a S/MIME 2 signed message does not verify.
+2005-08-14 - libetpan-0.38cvs3 - hoa
+ * src/driver/implementation/imap/imapstorage.h
+ * src/driver/implementation/pop3/pop3storage.h
+ * src/driver/interface/maildriver.h
+ * src/driver/interface/mailstorage_tools.h
+ implemented SASL at higher level API.
+ support for Outlook signed messages.
+2005-08-13 - libetpan-0.38cvs2 - hoa
+ fixed build on Solaris.
+ Thanks to Alex S. Moore.
+2005-08-13 - libetpan-0.38cvs1 - hoa
+ 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
+ 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
+ * src/data-types/mailsasl.[ch] ** NEW FILES **
+ implemented SASL.
+2005-07-15 - libetpan-0.37cvs4 - hoa
+ fixed version number. fixed custom logger.
+2005-07-15 - libetpan-0.37cvs3 - hoa
+ changed API for custom logger (added direction of stream).
+2005-07-15 - libetpan-0.37cvs2 - hoa
+ added a custom logger for applications.
+2005-07-15 - libetpan-0.37cvs1 - hoa
+ 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
+ fixed storage of flags.
+2005-06-19 - libetpan-0.36cvs17 - hoa
+ fixed double fclose(). Thanks to Nyoxi.
+2005-06-13 - libetpan-0.36cvs16 - hoa
+ fixed thread safety for reference count.
+ fixed MH (addition of messages).
+2005-06-01 - libetpan-0.36cvs15 - hoa
+ * src/low-level/mh/mailmh.h
+ * src/low-level/smtp/mailsmtp_socket.h
+ fixed linux build.
+2005-06-01 - libetpan-0.36cvs14 - hoa
+ fixed gcc 4.0 warnings.
+2005-06-01 - libetpan-0.36cvs13 - hoa
+2005-06-01 - libetpan-0.36cvs12 - smarinier
+ * most files
+ Windows port
+2005-05-27 - libetpan-0.36cvs11 - hoa
+ don't use tables of size 0.
+ includes missing header.
+ insert part even if decoding failed.
+2005-05-22 - libetpan-0.36cvs10 - g_roualland
+ change the way libetpan-config.h is generated to cope with
+ cross compilers and external build directories.
+2005-05-19 - libetpan-0.36cvs9 - hoa
+ reconnect on POP3 fetch of message list.
+ fixed crash on mailpop3_quit() in case
+ of bad state.
+2005-04-25 - libetpan-0.36cvs8 - hoa
+ fixed test of error codes.
+2005-04-18 - libetpan-0.36cvs7 - hoa
+ don't allow zero-sized array.
+ That will avoid infinite loops.
+2005-04-12 - libetpan-0.36cvs6 - hoa
+ use unique implementation of semaphore.
+2005-04-08 - libetpan-0.36cvs5 - hoa
+2005-04-07 - libetpan-0.36cvs5 - hoa
+ support for Mac OS X
+ * src/data-types/mail_cache_db.h
+ added function to retrieve the list of keys.
+ fixed semaphore.
+ made mailthread thread safe.
+2005-03-12 - libetpan-0.36cvs4 - hoa
+ support for GNUTLS.
+ Thanks from Rajko Albrecht.
+ disable semaphore when reentrant support is disabled.
+ fixed false error in cached IMAP driver.
+2005-03-04 - libetpan-0.36cvs3 - hoa
+ reorder unlock() and close()
+ implements properly the semaphore.
+2005-02-28 - libetpan-0.36cvs2 - hoa
+ fixed build when the exported header list is empty.
+ * doc/README.sgml
+ removed version numbers.
+2005-02-28 - libetpan-0.36cvs1 - g_roualland
+ fix DB cursor call when running on db2 < 2.6
+2005-02-22 - libetpan-0.36 - hoa
+ * release 0.36 - Silver Drop
+ * memory leak
+ * fixed maildir support
+2005-02-17 - libetpan-0.35cvs4 - hoa
+ does not check for owner of the folder:
+ this is the responsibility of the application.
+2005-01-31 - libetpan-0.35cvs3 - hoa
+ reverted to initial in code in non-debug mode.
+ fixed thread safety.
+2005-01-29 - libetpan-0.35cvs2 - hoa
+ fixed some memory leaks.
+2005-01-28 - libetpan-0.35cvs1 - hoa
+ support for Cygwin.
+ removed a log.
+ internal version of basename() can be used.
+ fixed update of Maildir mailbox.
+ 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
+ fixed syntax error.
+ avoid stat() on maildir files.
+ 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
+ fixed MIME parser. MIME parts does not include
+ the boundary CR LF.
+2004-12-12 - libetpan-0.34cvs5 - hoa
+ fixed data types and uninitialized variable.
+ now use rename() when link() is not available.
+ Thanks to Lutz Rogowski.
+ fixed a memory leak. Thanks to Lutz Rogowski.
+2004-11-14 - libetpan-0.34cvs4 - hoa
+ 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
+ maildir_update() now creates an empty file named maildirfolder.
+2004-11-14 - libetpan-0.34cvs2 - hoa
+ fixed locks when using liblockfile.
+2004-11-13 - libetpan-0.34cvs1 - hoa
+ additional checks.
+ clean up of code.
+ * src/low-level/imf/Makefile
+ * 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
+ debug logs are just before low-level.
+ helper functions to send multi-lines data.
+ limit requests to imap server (compatibility with iPlanet).
+ fixed send of literal, add proper CR LF
+ (compatibility with Cyrus).
+ removed reference to deprecated cinthash
+ removed inexistant function in header.
+2004-10-17 - libetpan-0.33cvs6 - g_roualland
+ 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.
+ 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.
+ do not include pthread calls if not reentrant.
+2004-10-17 - libetpan-0.33cvs5 - hoa
+ fixed precopy of headers.
+ fixed write of mailbox files on debian systems.
+ fixed a bug. Thanks to Melvin.
+2004-09-29 - libetpan-0.33cvs4 - hoa
+ support for mailboxes on debian systems.
+2004-09-03 - libetpan-0.33cvs3 - hoa
+ can remove storage or folder twice.
+2004-09-02 - libetpan-0.33cvs2 - hoa
+ * 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
+ fixed the workaround MH mailboxes with messages
+ containing 'From ' header.
+2004-08-24 - libetpan-0.33 - hoa
+ * release 0.33 - entropia
+ - 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
+ Fixed header inclusion.
+ Fixed installation of headers.
+2004-08-22 - libetpan-0.32cvs17 - hoa
+ Better detection of iconv.
+ Some fixes in build process.
+ Documentation is generated at prepackaging.
+ Engine added to build process.
+ * doc/API.sgml
+ * doc/Makefile
+ Updated documentation
+ Fixed db wrapper.
+ Fixed format of UID, in several drivers.
+ * src/driver/interface/mailfolder.h
+ * src/driver/interface/mailstorage.h
+ we can now append messages with their flags.
+ * src/engine/mailengine.h
+ remove hash global to storage to find folder of messages
+2004-07-28 - libetpan-0.32cvs16 - g_roualland
+ * acconfig.h * REMOVED FILE *
+ Convert old, deprecated autoconf defines to 2.5 like.
+ Do not look for acconfig.h, remove autoconf cache on clean.
+ Make sure "make clean" works even when the library was not built.
+ Support for DESTDIR to install in another root.
+ Patch from Rajko Albrecht <ral@alwins-world.de>
+ Fix a GCC 3.4 compiling issue with labels.
+2004-05-23 - libetpan-0.32cvs15 - hoa
+ fixed building and installing.
+ improved support for Berkeley DB
+ (thanks to Nikita V. Youshchenko).
+ updated documentation.
+ * src/data-types/mail_cache_db.[ch]
+ added function to get size of a given item.
+ fixed a crash when sending of data.
+ code cleanup.
+ implemented get_message_by_uid()
+ (Thanks to Toni Willberg).
+ implemented get_flags().
+ * 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/readmsg-uid.c ** NEW FILE **
+ added example for get_message_by_uid()
+2004-05-04 - libetpan-0.32cvs14 - hoa
+ 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]
+ get identifier of the message when we add a message
+ in a mailbox.
+2004-05-02 - libetpan-0.32cvs13 - hoa
+ * src/Makefile.in * NEW FILES *
+ * 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/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/maildir/Makefile
+ * src/low-level/mbox/Makefile
+ * src/low-level/mh/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
+ 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
+ * imap/mailimap.c
+ * tools/charconv.c
+ possibility to disable iconv. Fixed some leaks.
+ Thanks to Frederic Devernay.
+ 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
+ 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
+ Added <unistd.h> header
+2004-01-12 - libetpan-0.32cvs3 - hoa
+ detection of Berkeley DB can be disabled.
+ updated documentation
+ * generic/Makefile
+ * 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.
+2004-01-07 - libetpan-0.32cvs2 - g_roualland
+ * 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.
+ updated to make use of starttls and esmtp extensions.
+2003-12-23 - libetpan-0.32cvs1 - hoa
+ fixed a crash related to capabilities.
+2003-12-16 - libetpan-0.32 - hoa
+ * release 0.32 - Black Utopia
+ - 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
+ fixed dependencies in Makefiles.
+2003-12-15 - libetpan-0.31cvs6 - hoa
+ "make clean" does no more delete install include directory.
+2003-12-15 - libetpan-0.31cvs5 - hoa
+ 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.
+ don't add -I/usr/include if /usr is the prefix.
+2003-12-15 - libetpan-0.31cvs4 - hoa
+ * 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_ssl.h
+ * tests/compose-msg.c
+ * tests/frm-common.[ch]
+ * tests/readmsg-common.[ch]
+ * tools/Makefile
+ * tools/carray.h
+ * tools/mail.h
+ * tools/mailstream.h
+ * tools/mailstream_helper.[ch]
+ * tools/mailstream_low.h
+ * tools/mailstream_socket.h
+ * tools/mailstream_ssl.h
+ * tools/mailstream_types.h
+ fixed some dependencies.
+ Application that use libEtPan! now have to use
+ #include <libetpan.h> still exists for backward compatibility.
+ API version (with libtool) has been introduced.
+2003-12-14 - libetpan-0.31cvs3 - hoa
+ fixed dependencies.
+ added missing includes.
+ fixed documentation.
+2003-12-11 - libetpan-0.31cvs2 - hoa
+ fixed prototype of non-macro version.
+2003-12-11 - libetpan-0.31cvs1 - hoa
+ * imap/mailimap_helper.c
+ 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
+ - 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
+ 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.
+ fixed examples. Add static keyword where needed, forbid use
+ of 'msg->msg_single_fields'.
+2003-12-08 - libetpan-0.30-cvs21 - hoa
+ * 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/maildriver_types.[ch]
+ * generic/maildriver.[ch]
+ * generic/maildriver_tools.[ch]
+ * generic/maildriver_types_helper.c
+ * generic/mailstorage.[ch]
+ * generic/mailstorage_types.h
+ * 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/imapdriver_cached_message.c
+ * generic/imapdriver_message.c
+ * generic/imapdriver_tools.[ch]
+ additionnally, imapdriver becomes imap_session_driver
+ and imapdriver_cached becomes imap_cached_session_driver.
+ drivers are now included in this header.
+ * generic/maildirdriver.[ch]
+ * generic/maildirdriver_cached_message.c
+ * generic/maildirdriver_message.c
+ * generic/maildirdriver_tools.[ch]
+ additionnally, maildirdriver becomes maildir_session_driver
+ and maildirdriver_cached becomes
+ maildir_cached_session_driver.
+ * generic/mboxdriver_cached_message.c
+ * generic/mboxdriver_message.c
+ * generic/mboxdriver_tools.[ch]
+ additionnally, mboxdriver becomes mbox_session_driver
+ and mboxdriver_cached becomes mbox_cached_session_driver.
+ * generic/mhdriver.[ch]
+ * generic/mhdriver_cached_message.c
+ * generic/mhdriver_message.c
+ * generic/mhdriver_tools.[ch]
+ additionnally, mboxdriver becomes mh_session_driver
+ and mhdriver_cached becomes mh_cached_session_driver.
+ * generic/nntpdriver_cached_message.c
+ * generic/nntpdriver_message.c
+ * generic/nntpdriver_tools.[ch]
+ additionnally, nntpdriver becomes nntp_session_driver
+ and nntpdriver_cached becomes nntp_cached_session_driver.
+ * generic/pop3driver.[ch]
+ * generic/pop3driver_cached_message.c
+ * generic/pop3driver_message.c
+ * generic/pop3driver_tools.[ch]
+ additionnally, pop3driver becomes pop3_session_driver
+ and pop3driver_cached becomes pop3_cached_session_driver.
+ * imf/mailimf_types_helper.c
+ * imf/mailimf_write.c
+ * mime/mailmime.c
+ * mime/mailmime_types.c
+ * mime/mailmime_types_helper.c
+ * nntp/newsnntp.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.
+ improved autodetection of Berkeley DB version.
+ Thanks to Keith Edmunds.
+2003-12-04 - libetpan-0.30-cvs18 - hoa
+ * generic/imapdriver_cached.c
+ * generic/maildirdriver_tools.c
+ * generic/maildriver_types.c
+ * generic/mailstorage.c
+ * generic/mailthread.c
+ * generic/mboxdriver.c
+ * generic/mboxdriver_cached.c
+ * generic/mboxdriver_tools.c
+ * generic/mhdriver.c
+ * generic/mhdriver_cached.c
+ * generic/nntpdriver.c
+ * generic/nntpdriver_cached.c
+ * generic/pop3driver.c
+ * generic/pop3driver_cached.c
+ * generic/pop3driver_tools.c
+ * maildir/maildir.c
+ * mbox/mailmbox_parse.c
+ * mbox/mailmbox_types.[ch]
+ * pop3/mailpop3.c
+ * tools/carray.[ch]
+ * tools/chash.[ch]
+ 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
+ don't update folder implicitely.
+ 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]
+ * mbox/mailmbox.[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_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_low.[ch]
+ * tools/mailstream_ssl.c
+ applied 'const' qualifier where it is needed except in
+ generic part.
+2003-12-03 - libetpan-0.30-cvs16 - hoa
+ Workaround for a bug in Courier-IMAP.
+ Thanks to Mark B. Elrod.
+2003-12-03 - libetpan-0.30-cvs15 - hoa
+ * README
+ 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
+ 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/etpan-message-data-driver.[ch] * REMOVED FILES *
+ * tests/frm-common.c * NEW FILES *
+ synchronize tests with new API.
+2003-12-02 - libetpan-0.30-cvs12 - hoa
+ added a prefix before field names in mbox module.
+2003-12-02 - libetpan-0.30-cvs11 - hoa
+ * imf/mailimf.c
+ added a prefix before field names in IMF module.
+2003-12-01 - libetpan-0.30-cvs10 - hoa
+ * 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
+ added a prefix before field names in NNTP
+ and POP3 modules.
+2003-12-01 - libetpan-0.30-cvs8 - hoa
+ * mime/mailmime_disposition.c
+ * mime/mailmime_write.c
+ changed field name in MIME module and
+ replaced some structure with union.
+ fixed bug that didn't allow connection.
+2003-12-01 - libetpan-0.30-cvs7 - hoa
+ added LDFLAGS to libetpan-config --libs.
+ don't unreference stream on connect() error.
+ 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.
+ * imap/mailimap.h
+ * imap/mailimap_socket.c
+ changed the name of the fields in IMAP low-level implementation,
+ (prefix has been added to field names in structures).
+ a FWS can now appear in Content-Type field, before
+ the MIME type.
+2003-11-25 - libetpan-0.30-cvs6 - hoa
+ max-uid file is now located in flags directory.
+ this allows to keep flags coherence.
+2003-11-25 - libetpan-0.30-cvs5 - hoa
+ removed specific check for <sys/select.h>
+ * generic/data_message_driver.h
+ * generic/libetpan_version.h.in
+ * generic/mime_message_driver.h
+ added licence information.
+2003-11-25 - libetpan-0.30-cvs4 - hoa
+ 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/libetpan_version.c
+ clean up code.
+ Support for Berkeley DB version 1.x.
+2003-11-25 - libetpan-0.30-cvs3 - hoa
+ fixed a crash in get_envelopes_list().
+ * generic/maildriver_errors.h * NEW FILE *
+ 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
+ added internal basename() function so that
+ libEtPan! can compile on Mac OS X.
+ * 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
+ added UID to NNTP mailmessage structure.
+2003-11-22 - libetpan-0.30-cvs1 - hoa
+ 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.
+2003-11-21 - libetpan-0.30 - hoa
+ * release 0.30 - Spock's Beard release
+ - 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
+ support for runtime version of libetpan
+2003-11-20 - libetpan-0.29-cvs30 - hoa
+ wrap mailbox list when we have a single address as
+ a mailbox.
+2003-11-20 - libetpan-0.29-cvs29 - hoa
+ update message count with EXPUNGE responses.
+ added comment about initial state of socket.
+ read() is fixed.
+2003-11-19 - libetpan-0.29-cvs28 - hoa
+ fixed threading by references when using subjects.
+2003-11-19 - libetpan-0.29-cvs27 - hoa
+ don't open any files if flags_store is empty.
+ 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
+ fixed syntax of SEARCH command.
+ 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
+ use SEARCH instead of STATUS on selected folder to
+ get UNSEEN messages count.
+ allows multiple SEARCH responses.
+ * imap/mailimap_keywords.c
+ fixed parsing of mailbox flags.
+ * tools/clist.c
+ fixed count when using clist_concat().
+2003-11-14 - libetpan-0.29-cvs24 - hoa
+ fixed the space between Message-IDs, problem introduced
+ by rewriting of headers wrapper.
+2003-11-13 - libetpan-0.29-cvs23 - hoa
+ fixed some comments.
+ 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
+ removed exported function that does no more exist.
+2003-11-11 - libetpan-0.29-cvs20 - hoa
+ * 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
+ 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/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.
+ use msync() when finished writing using mmap() with MAP_SHARED.
+ changed flag name "Forwarded" into something more standard
+ "$Forwarded" (draft on flag keywords for IMAP).
+ added maildir drivers for session.
+ added message data for drivers that will use internal
+ data although they are using the generic functions.
+ added maildir drivers for message.
+ added maildir driver for storage.
+ optimization on memory use.
+ code clean up.
+ don't use MAP_SHARED for mmap() where it is not needed.
+ factorize code of storage initialization into
+ option-parser.[ch].
+2003-11-09 - libetpan-0.29-cvs18 - hoa
+ fixed management of MAIL_FLAG_FORWARDED.
+ fixed a memory leak.
+ fixed a memory freeing.
+2003-11-05 - libetpan-0.29-cvs17 - hoa
+ broken parsing of message-id due to previous change
+ is fixed.
+2003-11-05 - libetpan-0.29-cvs16 - hoa
+ accept some weird syntax, for example :
+ foo@bar.com <foo@bar.com>
+ This is now accepted.
+2003-11-04 - libetpan-0.29-cvs15 - hoa
+ fixed (again) wrapping of header fields.
+2003-11-03 - libetpan-0.29-cvs14 - hoa
+ fixed behaviour of IMAP message driver.
+2003-11-03 - libetpan-0.29-cvs13 - hoa
+ 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
+ fixed a bug in generic fetch header part of section.
+ check() replace flush() message in message envelopes list
+ fetch to reflect new API (0.29-cvs1).
+2003-10-29 - libetpan-0.29-cvs11 - hoa
+ workaround for a bug of old versions of INN.
+ 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
+ message content cache files are now cleaned up in
+ an unlocked state.
+2003-10-29 - libetpan-0.29-cvs9 - hoa
+ fixed get_line() function. Does not get out from the buffer.
+2003-10-29 - libetpan-0.29-cvs8 - hoa
+ fixed conversion of data in IMAP driver.
+2003-10-29 - libetpan-0.29-cvs7 - hoa
+ 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
+ now, the flags are not lost when the cache is deleted.
+ 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
+ fixed header fields cache.
+ added comment about driver function.
+ change dotlock behaviour (wait 5 seconds after each failed try)
+2003-10-27 - libetpan-0.29-cvs4 - hoa
+ added information about C #define
+ fixed memory leak in cached IMAP message driver.
+ MIME structure is not fetched again when already fetched.
+ added LIBETPAN_MAILIMF_FIELD_UNION #define to know that
+ we are on version of libEtPan! with a union to implement
+ mailimf_field data type.
+ 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
+ fixed wrapping of header text. First character was removed
+ when the first word was too long.
+ * generic/imapdriver_tools.h
+ * generic/imfcache.[ch]
+ * generic/maildriver.c
+ * generic/mailmessage_types.h
+ * generic/mboxdriver_cached.h
+ * tools/cinthash.[ch]
+ * tools/clist.[ch]
+ * tools/hmac-md5.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
+ 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.
+ fixed single address parsing (his will strip all spaces in
+ the address)
+2003-10-24
+ * version 0.29-cvs2
+ 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
+ * 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.
+ * 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
@@ -0,0 +1,284 @@
+ * passphrase is implemented for S/MIME and PGP.
+ * avoid symbols conflict between GnuTLS and OpenSSL.
+ * SSL initialization is optional.
+ * compatibility with GnuTLS
+ * SASL for higher level
+ libEtPan! - a mail library
+2003-12-10 - libEtPan! version 0.31
+2003-11-21 - libEtPan! version 0.30
+ * main new features
+ - cache for drivers is cleaned up.
+ - maildir driver.
+* 2003-10-06 - libEtPan! version 0.29
+ * 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
+ * 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
+ * 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
+ * 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
+ * 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.
+ * 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
@@ -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.
+[](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
+- 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.
@@ -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
+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 identifier the identifier to remove acl for
+int mailimap_acl_deleteacl(mailimap * session,
+ const char * identifier);
+ mailimap_acl_getacl()
+ This will get a list of acls for the mailbox
+ @param mailbox the mailbox to get the acls for
+ @param result this will store a clist of (struct mailimap_acl_acl_data *)
+ in (* result)
+int mailimap_acl_getacl(mailimap * session,
+ 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 identifier the identifier to query the acls for
+ @param result this will store a (struct mailimap_acl_listrights_data *)
+int mailimap_acl_listrights(mailimap * session,
+ struct mailimap_acl_listrights_data ** result);
+ mailimap_acl_myrights()
+ This will list the rights for the querying user on the mailbox
+ @param result this will store a (struct mailimap_acl_myrights_data *)
+int mailimap_acl_myrights(mailimap * session,
+ struct mailimap_acl_myrights_data ** result);
+int mailimap_has_acl(mailimap * session);
+}
@@ -0,0 +1,169 @@
+#ifndef ACL_TYPES_H
+#define ACL_TYPES_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 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);
+void mailimap_acl_acl_data_free(struct
+ mailimap_acl_acl_data * acl_data);
+struct mailimap_acl_listrights_data {
+ 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);
+void mailimap_acl_listrights_data_free(struct
+ mailimap_acl_listrights_data * listrights_data);
+struct mailimap_acl_myrights_data {
+struct mailimap_acl_myrights_data *
+mailimap_acl_myrights_data_new(char * mailbox, char * rights);
+void mailimap_acl_myrights_data_free(struct
+ mailimap_acl_myrights_data * myrights_data);
+void
+mailimap_acl_free(struct mailimap_extension_data * ext_data);
@@ -0,0 +1,103 @@
+#ifndef ANNOTATEMORE_H
+#define ANNOTATEMORE_H
+#include <libetpan/annotatemore_types.h>
+extern struct mailimap_extension_api mailimap_extension_annotatemore;
+ mailimap_annotatemore_getannotation()
+ This function will get annotations from given mailboxes or the server.
+ @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 *)
+int mailimap_annotatemore_getannotation(mailimap * session,
+ const char * list_mb,
+ struct mailimap_annotatemore_entry_match_list * entries,
+ struct mailimap_annotatemore_attrib_match_list * attribs,
+ mailimap_annotatemore_setannotation()
+ This function will set annotations on given mailboxes or the server.
+ @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.
+int mailimap_annotatemore_setannotation(mailimap * session,
+ struct mailimap_annotatemore_entry_att_list * en_att,
+ int * result);
+int mailimap_has_annotatemore(mailimap * session);
@@ -0,0 +1,268 @@
+#ifndef ANNOTATEMORE_TYPES_H
+#define ANNOTATEMORE_TYPES_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
+ ; 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
+ 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
+ getannotation = "GETANNOTATION" SP list-mailbox SP entries SP attribs
+ ; empty string for list-mailbox implies
+ 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
+ setentryatt = entry-att / "(" entry-att *(SP entry-att) ")"
+ value = nstring
+ MAILIMAP_ANNOTATEMORE_TYPE_ANNOTATE_DATA, /* child of response-data */
+ MAILIMAP_ANNOTATEMORE_TYPE_RESP_TEXT_CODE /* child of resp-text-code */
+ error codes for annotatemore.
+ 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;
+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 *) */
+struct mailimap_annotatemore_entry_att *
+mailimap_annotatemore_entry_att_new(char * entry, clist * list);
+void mailimap_annotatemore_entry_att_free(struct
+ mailimap_annotatemore_entry_att * en_att);
+mailimap_annotatemore_entry_att_new_empty(char * entry);
+int mailimap_annotatemore_entry_att_add(struct
+ mailimap_annotatemore_entry_att * en_att,
+ struct mailimap_annotatemore_att_value * at_value);
+ 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 {
+ struct mailimap_annotatemore_entry_list * entry_list;
+struct mailimap_annotatemore_annotate_data *
+mailimap_annotatemore_annotate_data_new(char * mb, struct
+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 *) */
+struct mailimap_annotatemore_entry_match_list *
+mailimap_annotatemore_entry_match_list_new(clist * en_list);
+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 *) */
+struct mailimap_annotatemore_attrib_match_list *
+mailimap_annotatemore_attrib_match_list_new(clist * at_list);
+void mailimap_annotatemore_attrib_match_list_free(
+ struct mailimap_annotatemore_attrib_match_list * at_list);
+mailimap_annotatemore_entry_match_list_new_empty(void);
+int mailimap_annotatemore_entry_match_list_add(
+ struct mailimap_annotatemore_entry_match_list * en_list,
+ char * entry);
+mailimap_annotatemore_attrib_match_list_new_empty(void);
+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 *) */
+struct mailimap_annotatemore_entry_att_list *
+mailimap_annotatemore_entry_att_list_new(clist * en_list);
+void mailimap_annotatemore_entry_att_list_free(
+ struct mailimap_annotatemore_entry_att_list * en_list);
+mailimap_annotatemore_entry_att_list_new_empty(void);
+int mailimap_annotatemore_entry_att_list_add(
+ struct mailimap_annotatemore_entry_att_list * en_list,
+ struct mailimap_annotatemore_entry_att * en_att);
+mailimap_annotatemore_free(struct mailimap_extension_data * ext_data);
@@ -0,0 +1,149 @@
+ * carray - Implements simple dynamic pointer arrays
+ * Copyright (c) 1999-2005, Gaël Roualland <gael.roualland@iname.com>
+ * interface changes - 2005 - DINH Viet Hoa
+ * $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>
+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 */
+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 */
+int carray_add(carray * array, void * data, unsigned int * indx);
+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. */
+int carray_delete(carray * array, unsigned int indx);
+ Order of elements in the array IS not changed. */
+int carray_delete_slow(carray * array, unsigned int indx);
+/* remove without decreasing the size of the array */
+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 */
+void ** carray_data(carray *);
+/* Returns the number of elements in the array */
+unsigned int carray_count(carray *);
+/* Returns the contents of one cell */
+void * carray_get(carray * array, unsigned int indx);
+/* Sets the contents of one cell */
+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)
+#ifndef INLINE
+#ifdef _MSC_VER
+#define INLINE __inline
+#define INLINE inline
+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;
+void carray_free(carray * array);
@@ -0,0 +1,84 @@
+ * $Id: charconv.h,v 1.13 2006/06/16 09:25:23 smarinier Exp $
+#ifndef CHARCONV_H
+#define CHARCONV_H
+#include <sys/types.h>
+ 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
+extern int (*extended_charconv)(const char * tocode, const char * fromcode, const char * str, size_t length,
+ char * result, size_t* result_len);
+int charconv(const char * tocode, const char * fromcode,
+ const char * str, size_t length,
+ char ** result);
+int charconv_buffer(const char * tocode, const char * fromcode,
+ char ** result, size_t * result_len);
+void charconv_buffer_free(char * str);
@@ -0,0 +1,191 @@
+ * chash - Implements generic hash tables.
+ * $Id: chash.h,v 1.16 2010/11/16 20:46:35 hoa Exp $
+#ifndef CHASH_H
+#define CHASH_H
+typedef struct {
+ void * data;
+} 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.
+chash * chash_new(unsigned int size, int flags);
+/* Frees a hash */
+void chash_free(chash * hash);
+/* Removes all elements from a hash */
+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. */
+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*/
+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. */
+int chash_delete(chash * hash,
+/* Resizes the hash table to the passed size. */
+int chash_resize(chash * hash, unsigned int size);
+/* Returns an iterator to the first non-empty entry of the hash table */
+chashiter * chash_begin(chash * hash);
+/* Returns the next non-empty entry of the hash table */
+chashiter * chash_next(chash * hash, chashiter * iter);
+/* Returns the size of the hash table */
+unsigned int chash_size(chash * hash);
+/* Returns the number of entries in the hash table */
+unsigned int chash_count(chash * hash);
+/* Returns the key part of the entry pointed by the iterator */
+void chash_key(chashiter * iter, chashdatum * result);
+/* Returns the value part of the entry pointed by the iterator */
+void chash_value(chashiter * iter, chashdatum * result);
+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;
@@ -0,0 +1,146 @@
+ * clist - Implements simple generic double-linked pointer lists
+ * $Id: clist.h,v 1.13 2011/05/09 21:49:46 hoa Exp $
+#ifndef CLIST_H
+#define CLIST_H
+typedef struct clistcell_s {
+ 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 */
+clist * clist_new(void);
+/* Destroys a list. Data pointed by data pointers is NOT freed. */
+void clist_free(clist *);
+/* 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 *);
+#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))
+/* Inserts this data pointer before the element pointed by the iterator */
+int clist_insert_before(clist *, clistiter *, void *);
+/* Inserts this data pointer after the element pointed by the iterator */
+int clist_insert_after(clist *, clistiter *, void *);
+/* Deletes the element pointed by the iterator.
+ Returns an iterator to the next element. */
+clistiter * clist_delete(clist *, clistiter *);
+typedef void (* clist_func)(void *, void *);
+void clist_foreach(clist * lst, clist_func func, void * data);
+void clist_concat(clist * dest, clist * src);
+void * clist_nth_data(clist * lst, int indx);
+clistiter * clist_nth(clist * lst, int indx);
@@ -0,0 +1,101 @@
+ * Copyright (C) 2001, 2013 - DINH Viet Hoa
+#ifndef CONDSTORE_H
+#define CONDSTORE_H
+#include <libetpan/condstore_types.h>
+extern struct mailimap_extension_api mailimap_extension_condstore;
+int mailimap_store_unchangedsince(mailimap * session,
+ struct mailimap_set * set, uint64_t mod_sequence_valzer,
+ struct mailimap_store_att_flags * store_att_flags);
+int mailimap_uid_store_unchangedsince(mailimap * session,
+int mailimap_fetch_changedsince(mailimap * session,
+ struct mailimap_set * set,
+ struct mailimap_fetch_type * fetch_type, uint64_t mod_sequence_value,
+int mailimap_uid_fetch_changedsince(mailimap * session,
+struct mailimap_fetch_att * mailimap_fetch_att_new_modseq(void);
+int mailimap_search_modseq(mailimap * session, const char * charset,
+ struct mailimap_search_key * key, clist ** result, uint64_t * p_mod_sequence_value);
+int mailimap_uid_search_modseq(mailimap * session, const char * charset,
+int mailimap_search_literalplus_modseq(mailimap * session, const char * charset,
+int mailimap_uid_search_literalplus_modseq(mailimap * session, const char * charset,
+int mailimap_select_condstore(mailimap * session, const char * mb, uint64_t * p_mod_sequence_value);
+int mailimap_examine_condstore(mailimap * session, const char * mb, uint64_t * p_mod_sequence_value);
+int mailimap_has_condstore(mailimap * session);
@@ -0,0 +1,97 @@
+#ifndef CONDSTORE_TYPE_H
+#define CONDSTORE_TYPE_H
+#include <libetpan/mailimap_types.h>
+ 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;
+ MAILIMAP_CONDSTORE_RESPTEXTCODE_HIGHESTMODSEQ,
+ MAILIMAP_CONDSTORE_RESPTEXTCODE_NOMODSEQ,
+ MAILIMAP_CONDSTORE_RESPTEXTCODE_MODIFIED
+struct mailimap_condstore_resptextcode {
+ int cs_type;
+ union {
+ struct mailimap_set * cs_modified_set;
+ } cs_data;
+struct mailimap_condstore_search {
+ clist * cs_search_result; /* uint32_t */
+struct mailimap_condstore_status_info {
+ uint64_t cs_highestmodseq_value;
+struct mailimap_condstore_fetch_mod_resp * mailimap_condstore_fetch_mod_resp_new(uint64_t cs_modseq_value);
+void mailimap_condstore_fetch_mod_resp_free(struct mailimap_condstore_fetch_mod_resp * fetch_data);
+struct mailimap_condstore_resptextcode * mailimap_condstore_resptextcode_new(int cs_type,
+ uint64_t cs_modseq_value, struct mailimap_set * cs_modified_set);
+void mailimap_condstore_resptextcode_free(struct mailimap_condstore_resptextcode * resptextcode);
+struct mailimap_condstore_search * mailimap_condstore_search_new(clist * cs_search_result, uint64_t cs_modseq_value);
+void mailimap_condstore_search_free(struct mailimap_condstore_search * search_data);
+struct mailimap_condstore_status_info * mailimap_condstore_status_info_new(uint64_t cs_highestmodseq_value);
+void mailimap_condstore_status_info_free(struct mailimap_condstore_status_info * status_info);
@@ -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
+/* 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 */
@@ -0,0 +1,60 @@
+ * $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
+extern mailmessage_driver * data_message_driver;
+mailmessage * data_message_init(char * data, size_t len);
+void data_message_detach_mime(mailmessage * msg);
@@ -0,0 +1,53 @@
+ * $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>
+extern mailsession_driver * db_session_driver;
@@ -0,0 +1,52 @@
+ * $Id: dbdriver_message.h,v 1.2 2004/11/21 21:53:31 hoa Exp $
+#ifndef DBDRIVER_MESSAGE_H
+#define DBDRIVER_MESSAGE_H
+extern mailmessage_driver * db_message_driver;
@@ -0,0 +1,71 @@
+ * $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/maildriver_types.h>
+#include <libetpan/generic_cache_types.h>
+#include <libetpan/mailstorage_types.h>
+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;
+ * $Id: dbstorage.h,v 1.3 2005/06/01 12:21:57 smarinier Exp $
+#ifndef DBSTORAGE_H
+#define DBSTORAGE_H
+ 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.
+int db_mailstorage_init(struct mailstorage * storage,
+ char * db_pathname);
@@ -0,0 +1,56 @@
+ * Copyright (C) 2001, 2011 - DINH Viet Hoa
+#ifndef ENABLE_H
+#define ENABLE_H
+extern struct mailimap_extension_api mailimap_extension_enable;
+int mailimap_enable(mailimap * session, struct mailimap_capability_data * capabilities,
+ struct mailimap_capability_data ** result);
+int mailimap_has_enable(mailimap * session);
+ * $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>
+extern mailsession_driver * feed_session_driver;
+ * $Id: feeddriver_message.h,v 1.1 2007/01/18 09:15:01 hoa Exp $
+#ifndef FEEDDRIVER_MESSAGE_H
+#define FEEDDRIVER_MESSAGE_H
+extern mailmessage_driver * feed_message_driver;
@@ -0,0 +1,68 @@
+ * $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/newsfeed.h>
+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;
@@ -0,0 +1,72 @@
+ * $Id: feedstorage.h,v 1.1 2007/01/18 09:15:01 hoa Exp $
+#ifndef FEEDSTORAGE_H
+#define FEEDSTORAGE_H
+ feed_mailstorage_init is the constructor for a FEED storage
+ @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
+int feed_mailstorage_init(struct mailstorage * storage,
+ const char * feed_url,
+ int feed_cached, const char * feed_cache_directory,
+ const char * feed_flags_directory);
+ * $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>
+struct mail_flags_store {
+ carray * fls_tab;
+ chash * fls_hash;
@@ -0,0 +1,57 @@
+ * $Id: hotmailstorage.h,v 1.3 2005/06/01 12:21:58 smarinier Exp $
+#ifndef HOTMAILSTORAGE_H
+#define HOTMAILSTORAGE_H
+#include "mailstorage_types.h"
+int hotmail_mailstorage_init(struct mailstorage * storage,
+ char * hotmail_login, char * hotmail_password,
+ int hotmail_cached, char * hotmail_cache_directory,
+ char * hotmail_flags_directory);
@@ -0,0 +1,64 @@
+ * Copyright (C) 2001, 2014 - DINH Viet Hoa
+#ifndef MAILIMAP_IDLE_H
+#define MAILIMAP_IDLE_H
+#include "mailimap_types.h"
+int mailimap_idle(mailimap * session);
+int mailimap_idle_done(mailimap * session);
+int mailimap_idle_get_fd(mailimap * session);
+/* delay in seconds */
+void mailimap_idle_set_delay(mailimap * session, long delay);
+long mailimap_idle_get_done_delay(mailimap * session);
+int mailimap_has_idle(mailimap * session);
+ * $Id: imapdriver.h,v 1.12 2004/11/21 21:53:32 hoa Exp $
+#ifndef IMAPDRIVER_H
+#define IMAPDRIVER_H
+#include <libetpan/imapdriver_types.h>
+extern mailsession_driver * imap_session_driver;
+ * $Id: imapdriver_cached.h,v 1.11 2004/11/21 21:53:32 hoa Exp $
+#ifndef IMAPDRIVER_CACHED_H
+#define IMAPDRIVER_CACHED_H
+extern mailsession_driver * imap_cached_session_driver;
+ * $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
+extern mailmessage_driver * imap_cached_message_driver;
+ * $Id: imapdriver_message.h,v 1.6 2004/11/21 21:53:32 hoa Exp $
+#ifndef IMAPDRIVER_MESSAGE_H
+#define IMAPDRIVER_MESSAGE_H
+extern mailmessage_driver * imap_message_driver;
@@ -0,0 +1,88 @@
+ * $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"
+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);
+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);
+#ifndef IMAPDRIVER_TOOLS_PRIVATE_H
+#define IMAPDRIVER_TOOLS_PRIVATE_H
+#include "mail_cache_db.h"
+imapdriver_get_cached_envelope(struct mail_cache_db * cache_db,
+ MMAPString * mmapstr,
+ mailsession * session, mailmessage * msg,
+imapdriver_write_cached_envelope(struct mail_cache_db * cache_db,
+ 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);
+ * $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/mailimap.h>
+/* 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;
+ IMAP_SECTION_MESSAGE,
+ IMAP_SECTION_HEADER,
+ IMAP_SECTION_MIME,
+ IMAP_SECTION_BODY
+/* cached IMAP driver for session */
+ 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
+ - 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 */
+ 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 */
@@ -0,0 +1,120 @@
+ * $Id: imapstorage.h,v 1.13 2007/06/30 12:58:21 hoa Exp $
+#ifndef IMAPSTORAGE_H
+#define IMAPSTORAGE_H
+ imap_mailstorage_init is the constructor for a IMAP4rev1 storage
+ @param servername this is the name of the IMAP4rev1 server
+ @param port is the port to connect to, on the server.
+ @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.
+ 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.
+ @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.
+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);
+int imap_mailstorage_init_sasl(struct mailstorage * storage,
+ 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_mailstorage_init_sasl_with_local_address(struct mailstorage * storage,
+ const char * imap_local_address, uint16_t imap_local_port,
@@ -0,0 +1,26 @@
+#define LIBETPAN_CONFIG_H
+#if WIN32
+# define MMAP_UNAVAILABLE
+#if defined(_MSC_VER) && !defined(__cplusplus)
+# define inline __inline
+#include <limits.h>
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#include <sys/param.h>
+#include <inttypes.h>
+#define MAIL_DIR_SEPARATOR '/'
+#define MAIL_DIR_SEPARATOR_S "/"
+# ifdef LIBETPAN_DLL
+# define LIBETPAN_EXPORT __declspec(dllexport)
+# else
+# define LIBETPAN_EXPORT __declspec(dllimport)
+# endif
+# define LIBETPAN_EXPORT
@@ -0,0 +1,128 @@
+ * $Id: libetpan.h,v 1.17 2007/01/18 09:15:02 hoa Exp $
+#ifndef LIBETPAN_H
+#define LIBETPAN_H
+#include <libetpan/libetpan_version.h>
+#include <libetpan/maildriver.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/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/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>
@@ -0,0 +1,66 @@
+ * Copyright (C) 2001 - 2003 - DINH Viet Hoa
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+#ifndef LIBETPAN_VERSION_H
+#define LIBETPAN_VERSION_H
+#ifndef LIBETPAN_VERSION_MAJOR
+#define LIBETPAN_VERSION_MAJOR 1
+#ifndef LIBETPAN_VERSION_MINOR
+#define LIBETPAN_VERSION_MINOR 7
+#ifndef LIBETPAN_REENTRANT
+#if 1
+#ifndef LIBETPAN_API_CURRENT
+#define LIBETPAN_API_CURRENT 20
+#ifndef LIBETPAN_API_REVISION
+#define LIBETPAN_API_REVISION 0
+#ifndef LIBETPAN_API_COMPATIBILITY
+#define LIBETPAN_API_COMPATIBILITY 20
+int libetpan_get_version_major(void);
+int libetpan_get_version_minor(void);
+ * $Id: mail.h,v 1.8 2004/11/21 21:53:31 hoa Exp $
+#ifndef MAIL_H
+#define MAIL_H
+#ifndef TRUE
+#define TRUE 1
+#ifndef FALSE
+#define FALSE 0
@@ -0,0 +1,67 @@
+ * $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,
+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);
@@ -0,0 +1,93 @@
+ * $Id: maildir_types.h,v 1.9 2006/05/22 13:39:42 hoa Exp $
+#ifndef MAILDIR_TYPES_H
+#define MAILDIR_TYPES_H
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#define LIBETPAN_MAILDIR
+ 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
+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;
+ * $Id: maildirdriver.h,v 1.4 2004/11/21 21:53:32 hoa Exp $
+#ifndef MAILDIRDRIVER_H
+#define MAILDIRDRIVER_H
+#include <libetpan/maildirdriver_types.h>
+extern mailsession_driver * maildir_session_driver;
+ * $Id: maildirdriver_cached.h,v 1.4 2004/11/21 21:53:32 hoa Exp $
+#ifndef MAILDIRDRIVER_CACHED_H
+#define MAILDIRDRIVER_CACHED_H
+extern mailsession_driver * maildir_cached_session_driver;
+ * $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
+extern mailmessage_driver * maildir_cached_message_driver;
+ * $Id: maildirdriver_message.h,v 1.3 2004/11/21 21:53:32 hoa Exp $
+#ifndef MAILDIRDRIVER_MESSAGE_H
+#define MAILDIRDRIVER_MESSAGE_H
+extern mailmessage_driver * maildir_message_driver;
@@ -0,0 +1,96 @@
+ * $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/maildir.h>
+struct maildir_session_state_data {
+ struct maildir * md_session;
+ struct mail_flags_store * md_flags_store;
+ MAILDIRDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
+ MAILDIRDRIVER_CACHED_SET_FLAGS_DIRECTORY
+struct maildir_cached_session_state_data {
+ mailsession * md_ancestor;
+ char * md_quoted_mb;
+ 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.
+ - 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;
@@ -0,0 +1,70 @@
+ * $Id: maildirstorage.h,v 1.7 2006/06/02 15:44:29 smarinier Exp $
+#ifndef MAILDIRSTORAGE_H
+#define MAILDIRSTORAGE_H
+ maildir_mailstorage_init is the constructor for a maildir storage.
+int maildir_mailstorage_init(struct mailstorage * storage,
+ const char * md_pathname, int md_cached,
+ const char * md_cache_directory, const char * md_flags_directory);
@@ -0,0 +1,607 @@
+ * $Id: maildriver.h,v 1.34 2006/06/07 15:10:01 smarinier Exp $
+#ifndef MAILDRIVER_H
+#define MAILDRIVER_H
+#include <libetpan/maildriver_types_helper.h>
+/* mailsession */
+ mailsession_new creates a new session, using the given driver
+ @return the created session is returned
+mailsession * mailsession_new(mailsession_driver * sess_driver);
+ mailsession_free release the memory used by the session
+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
+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
+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
+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)
+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
+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.
+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.
+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()
+int mailsession_build_folder_name(mailsession * session, const char * mb,
+ const char * name, char ** result);
+ mailsession_create_folder creates the folder that corresponds to the
+ given name
+ @param session the session
+ @param mb is the name of the mailbox
+int mailsession_create_folder(mailsession * session, const char * mb);
+ mailsession_delete_folder deletes the folder that corresponds to the
+int mailsession_delete_folder(mailsession * session, const char * mb);
+ mailsession_rename_folder changes the name of the folder
+ @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)
+int mailsession_rename_folder(mailsession * session,
+ const char * mb, const char * new_name);
+ mailsession_check_folder makes a checkpoint of the session
+int mailsession_check_folder(mailsession * session);
+ NOTE: this function is not implemented in most drivers
+ mailsession_examine_folder selects a mailbox as readonly
+int mailsession_examine_folder(mailsession * session, const char * mb);
+ mailsession_select_folder selects a mailbox
+int mailsession_select_folder(mailsession * session, const char * mb);
+ mailsession_expunge_folder deletes all messages marked \Deleted
+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 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)
+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 result the number of messages is stored in (* result)
+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 result the number of recent messages is stored in (* result)
+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 result the number of unseen messages is stored in (* result)
+int mailsession_unseen_number(mailsession * session, const char * mb,
+ mailsession_list_folders returns the list of all sub-mailboxes
+ of the given mailbox
+ @param mb the mailbox
+ @param result list of mailboxes if stored in (* result),
+ this structure have to be freed with mail_list_free()
+int mailsession_list_folders(mailsession * session, const char * mb,
+ struct mail_list ** result);
+ mailsession_lsub_folders returns the list of subscribed
+ sub-mailboxes of the given mailbox
+int mailsession_lsub_folders(mailsession * session, const char * mb,
+ mailsession_subscribe_folder subscribes to the given mailbox
+int mailsession_subscribe_folder(mailsession * session, const char * mb);
+ mailsession_unsubscribe_folder unsubscribes to the given mailbox
+int mailsession_unsubscribe_folder(mailsession * session, const char * mb);
+ mailsession_append_message adds a RFC 2822 message to the current
+ given mailbox
+ @param message is a string that contains the RFC 2822 message
+ @param size this is the size of the message
+int mailsession_append_message(mailsession * session,
+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 num the message number
+ @param mb the destination mailbox
+int mailsession_copy_message(mailsession * session,
+ uint32_t num, const char * mb);
+ mailsession_move_message copies a message whose number is given to
+int mailsession_move_message(mailsession * session,
+ mailsession_get_messages_list returns the list of message numbers
+ of the current mailbox.
+ @param result the list of message numbers will be stored in (* result),
+ this structure have to be freed with mailmessage_list_free()
+int mailsession_get_messages_list(mailsession * session,
+ mailsession_get_envelopes_list fills the parsed fields in the
+ mailmessage structures of the mailmessage_list.
+ @param result this is the list of mailmessage structures
+int mailsession_get_envelopes_list(mailsession * session,
+ struct mailmessage_list * result);
+ mailsession_remove_message removes the given message from the mailbox.
+ The message is permanently deleted.
+ @param num is the message number
+int mailsession_remove_message(mailsession * session, uint32_t num);
+ mailsession_search_message returns a list of message numbers that
+ corresponds to the given criteria.
+ @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()
+int mailsession_search_messages(mailsession * session, const char * charset,
+ struct mail_search_key * key,
+ struct mail_search_result ** result);
+ 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 result the allocated mailmessage structure will be stored
+ in (* result), this structure have to be freed with mailmessage_free()
+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 uid the message unique identifier
+int mailsession_get_message_by_uid(mailsession * session,
+ const char * uid, mailmessage ** result);
+ mailsession_login notifies the SASL authentication information
+ @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
+int mailsession_login_sasl(mailsession * session, const char * auth_type,
+ const char * password, const char * realm);
+ * $Id: maildriver_errors.h,v 1.9 2006/12/13 18:31:32 hoa Exp $
+#ifndef MAILDRIVER_ERRORS_H
+#define MAILDRIVER_ERRORS_H
+ 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
@@ -0,0 +1,822 @@
+ * $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 <sys/types.h>
+#include <libetpan/mailimf.h>
+#include <libetpan/mailmime.h>
+#include <libetpan/mailthread_types.h>
+#include <libetpan/maildriver_errors.h>
+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 *) */
+struct mailmessage_list * mailmessage_list_new(carray * msg_tab);
+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 *) */
+struct mail_list * mail_list_new(clist * mb_list);
+void mail_list_free(struct mail_list * resp);
+ This is a flag value.
+ Flags can be combined with OR operation
+ 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 *) */
+struct mail_flags * mail_flags_new(uint32_t fl_flags, clist * fl_ext);
+void mail_flags_free(struct mail_flags * flags);
+ This function creates a flag for a new message
+struct mail_flags * mail_flags_new_empty(void);
+ mailimf_date_time_comp compares two dates
+int32_t mailimf_date_time_comp(struct mailimf_date_time * date1,
+ struct mailimf_date_time * date2);
+ this is type type of the search criteria
+ 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
+ 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
+ MAIL_SEARCH_KEY_TEXT, /* messages whose text part contains the
+ MAIL_SEARCH_KEY_TO, /* messages whose To field contains the
+ 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
+ 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
+struct mail_search_key {
+ 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; /* 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);
+ mail_search_result is a list of message numbers that is returned
+ by the mailsession_search_messages function()
+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);
+ 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
+ - build_folder_name() will return an allocated string with
+ - create_folder() creates the folder that corresponds to the
+ - delete_folder() deletes the folder that corresponds to the
+ - 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
+ - lsub_folders() returns the list of subscribed
+ - subscribe_folder() subscribes to the given mailbox
+ - unsubscribe_folder() unsubscribes to the given mailbox
+ - append_message() adds a RFC 2822 message to the current
+ - 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
+ - get_envelopes_list() fills the parsed fields in the
+ - remove_message() removes the given message from the mailbox.
+ - search_message() returns a list of message numbers that
+ - get_message returns a mailmessage structure that corresponds
+ - 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 (* 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,
+ 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,
+ int (* sess_messages_number)(mailsession * session, const char * mb,
+ int (* sess_recent_number)(mailsession * session, const char * mb,
+ int (* sess_unseen_number)(mailsession * session, const char * mb,
+ int (* sess_list_folders)(mailsession * session, const char * mb,
+ int (* sess_lsub_folders)(mailsession * session, const char * mb,
+ 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,
+ int (* sess_append_message_flags)(mailsession * session,
+ int (* sess_copy_message)(mailsession * session,
+ int (* sess_move_message)(mailsession * session,
+ int (* sess_get_message)(mailsession * session,
+ int (* sess_get_message_by_uid)(mailsession * session,
+ int (* sess_get_messages_list)(mailsession * session,
+ int (* sess_get_envelopes_list)(mailsession * session,
+ int (* sess_remove_message)(mailsession * session, uint32_t num);
+ int (* sess_login_sasl)(mailsession * session, const char * auth_type,
+ 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.
+ in the field data of the mailsession.
+ 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,
+ int (* msg_fetch_body)(mailmessage * msg_info,
+ int (* msg_fetch_size)(mailmessage * msg_info,
+ size_t * result);
+ int (* msg_get_bodystructure)(mailmessage * msg_info,
+ int (* msg_fetch_section)(mailmessage * msg_info,
+ struct mailmime * mime,
+ int (* msg_fetch_section_header)(mailmessage * msg_info,
+ int (* msg_fetch_section_mime)(mailmessage * msg_info,
+ int (* msg_fetch_section_body)(mailmessage * msg_info,
+ int (* msg_fetch_envelope)(mailmessage * msg_info,
+ int (* msg_get_flags)(mailmessage * msg_info,
+ 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;
+ 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;
+struct mailmessage_tree *
+mailmessage_tree_new(char * node_msgid, time_t node_date,
+ mailmessage * node_msg);
+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.
+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;
+const char * maildriver_strerror(int err);
+/* basic malloc / free functions to be compliant with the library allocations */
+void *libetpan_malloc(size_t length);
+void libetpan_free(void* data);
@@ -0,0 +1,99 @@
+ * $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
+ 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.
+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 given flag name is no more needed after the function call.
+int mail_flags_remove_extension(struct mail_flags * flags,
+ mail_flags_has_extension returns 1 if the flags is in the given flags,
+ 0 is returned otherwise.
+int mail_flags_has_extension(struct mail_flags * flags,
@@ -0,0 +1,190 @@
+ * libEtPan! -- a mail library
+ * $Id: mailengine.h,v 1.3 2004/11/21 21:53:35 hoa Exp $
+#ifndef MAILENGINE_H
+#define MAILENGINE_H
+#include <libetpan/mailprivacy_types.h>
+ 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,
+ 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,
+int libetpan_message_mime_unref(struct mailengine * engine,
+ 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 mailmessage_list * msg_list);
+void libetpan_folder_free_msg_list(struct mailengine * engine,
+ connect and disconnect storage
+int libetpan_storage_add(struct mailengine * engine,
+ struct mailstorage * storage);
+void libetpan_storage_remove(struct mailengine * engine,
+int libetpan_storage_connect(struct mailengine * engine,
+void libetpan_storage_disconnect(struct mailengine * engine,
+int libetpan_storage_used(struct mailengine * engine,
+ 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 *
+libetpan_message_get_folder(struct mailengine * engine,
+struct mailstorage *
+libetpan_message_get_storage(struct mailengine * engine,
+ register a message
+int libetpan_message_register(struct mailengine * engine,
+void libetpan_engine_debug(struct mailengine * engine, FILE * f);
+extern void * engine_app;
@@ -0,0 +1,80 @@
+ * $Id: mailfolder.h,v 1.4 2006/04/06 22:54:56 hoa Exp $
+#ifndef MAILFOLDER_H
+#define MAILFOLDER_H
+int mailfolder_noop(struct mailfolder * folder);
+int mailfolder_check(struct mailfolder * folder);
+int mailfolder_expunge(struct mailfolder * folder);
+int mailfolder_status(struct mailfolder * folder,
+int mailfolder_append_message(struct mailfolder * folder,
+ char * message, size_t size);
+int mailfolder_append_message_flags(struct mailfolder * folder,
+ char * message, size_t size, struct mail_flags * flags);
+int mailfolder_get_messages_list(struct mailfolder * folder,
+int mailfolder_get_envelopes_list(struct mailfolder * folder,
+int mailfolder_get_message(struct mailfolder * folder,
+int mailfolder_get_message_by_uid(struct mailfolder * folder,
@@ -0,0 +1,914 @@
+ * $Id: mailimap.h,v 1.23 2011/03/29 23:59:05 hoa Exp $
+#ifndef MAILIMAP_H
+#define MAILIMAP_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 s stream to use
+ 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.
+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 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
+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
+ MAILIMAP_NO_ERROR_XXX codes
+int mailimap_noop(mailimap * session);
+ mailimap_logout()
+ This function will logout from an IMAP server by sending
+ a LOGOUT command.
+int mailimap_logout(mailimap * session);
+ mailimap_capability()
+ This function will query an IMAP server for his capabilities
+ by sending a CAPABILITY command.
+ @param result The result of this command is a list of
+ capabilities and it is stored into (* result).
+int mailimap_capability(mailimap * session,
+ mailimap_check()
+ This function will request for a checkpoint of the mailbox by
+ sending a CHECK command.
+int mailimap_check(mailimap * session);
+ mailimap_close()
+ This function will close the selected mailbox by sending
+ a CLOSE command.
+int mailimap_close(mailimap * session);
+ mailimap_expunge()
+ This function will permanently remove from the selected mailbox
+ message that have the \Deleted flag set.
+int mailimap_expunge(mailimap * session);
+ mailimap_copy()
+ This function will copy the given messages from the selected mailbox
+ to the given mailbox.
+ @param set This is a set of message numbers.
+ @param mb This is the destination mailbox.
+int mailimap_copy(mailimap * session, struct mailimap_set * set,
+ const char * mb);
+ mailimap_uid_copy()
+ @param set This is a set of message unique identifiers.
+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
+int mailimap_move(mailimap * session, struct mailimap_set * set,
+ mailimap_uid_move()
+int mailimap_uid_move(mailimap * session, struct mailimap_set * set,
+ mailimap_create()
+ This function will create a mailbox.
+ @param mb This is the name of the mailbox to create.
+int mailimap_create(mailimap * session, const char * mb);
+ mailimap_delete()
+ This function will delete a mailox.
+ @param mb This is the name of the mailbox to delete.
+int mailimap_delete(mailimap * session, const char * mb);
+ mailimap_examine()
+ This function will select the mailbox for read-only operations.
+ @param mb This is the name of the mailbox to select.
+int mailimap_examine(mailimap * session, const char * mb);
+ mailimap_fetch()
+ This function will retrieve data associated with the given message
+ numbers.
+ @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 *).
+mailimap_fetch(mailimap * session, struct mailimap_set * set,
+ struct mailimap_fetch_type * fetch_type, clist ** result);
+ @param set set of message unique identifiers
+mailimap_uid_fetch(mailimap * session,
+ 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.
+void mailimap_fetch_list_free(clist * fetch_list);
+ mailimap_list()
+ This function will return the list of the mailbox
+ available on the server.
+ @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 *)
+int mailimap_list(mailimap * session, const char * mb,
+ const char * list_mb, clist ** result);
+ mailimap_login()
+ This function will authenticate the client.
+ @param userid login of the user
+ @param password password of the user
+int mailimap_login(mailimap * session,
+ mailimap_authenticate()
+ TODO : documentation
+int mailimap_authenticate(mailimap * session, const char * auth_type,
+ mailimap_lsub()
+ that the client has subscribed to.
+ @param result This will store a list of (struct mailimap_mailbox_list *)
+int mailimap_lsub(mailimap * session, const char * mb,
+ mailimap_list_result_free()
+ This function will free the clist of (struct mailimap_mailbox_list *)
+ @param list This is the clist to free.
+void mailimap_list_result_free(clist * list);
+ mailimap_rename()
+ This function will change the name of a mailbox.
+ @param mb current name
+ @param new_name new name
+int mailimap_rename(mailimap * session,
+ mailimap_search()
+ All mails that match the given criteria will be returned
+ their numbers in the result list.
+ @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).
+mailimap_search(mailimap * session, const char * charset,
+ struct mailimap_search_key * key, clist ** result);
+ mailimap_uid_search()
+ their unique identifiers in the result list.
+mailimap_uid_search(mailimap * session, const char * charset,
+ mailimap_search_literalplus()
+ LITERAL+ feature will be used to send strings.
+LIBETPAN_EXPORT int mailimap_search_literalplus(mailimap * session, const char * charset,
+ mailimap_uid_search_literalplus()
+LIBETPAN_EXPORT int mailimap_uid_search_literalplus(mailimap * session, const char * charset,
+ 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()
+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.
+mailimap_select(mailimap * session, const char * mb);
+ mailimap_custom_command()
+ @param command Custom IMAP command to be send
+int mailimap_custom_command(mailimap * session, const char * command);
+ mailimap_status()
+ This function will return informations about a given mailbox.
+ @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
+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 set This is a list of message numbers.
+ @param store_att_flags This is the data to associate with the
+ given messages
+mailimap_store(mailimap * session,
+ @param set This is a list of message unique identifiers.
+mailimap_uid_store(mailimap * session,
+ mailimap_subscribe()
+ This function adds the specified mailbox name to the
+ server's set of "active" or "subscribed" mailboxes.
+int mailimap_subscribe(mailimap * session, const char * mb);
+ mailimap_unsubscribe()
+ This function removes the specified mailbox name to the
+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.
+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.
+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.
+void mailimap_free(mailimap * session);
+ mailimap_send_current_tag() send current IMAP tag. See RFC 3501.
+ @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.
+ @return MAILIMAP_NO_ERROR if a line could be buffered.
+char * mailimap_read_line(mailimap * session);
+ mailimap_parse_response() parse an IMAP response.
+ @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.
+int mailimap_parse_response(mailimap * session,
+ struct mailimap_response ** result);
+ mailimap_set_progress_callback() set IMAP progression callbacks.
+ @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.
+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 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.
+void mailimap_set_msg_att_handler(mailimap * session,
+ mailimap_msg_att_handler * handler,
+ mailimap_set_msg_body_handler() set a callback when a message body is
+ 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.
+void mailimap_set_msg_body_handler(mailimap * session,
+ mailimap_msg_body_handler * handler,
+ mailimap_set_timeout() set the network timeout of the IMAP session.
+ @param timeout value of the timeout in seconds.
+void mailimap_set_timeout(mailimap * session, time_t timeout);;
+ mailimap_get_timeout() get the network timeout of the IMAP session.
+ @return the value of the timeout in seconds.
+time_t mailimap_get_timeout(mailimap * session);
+ mailimap_set_logger() get the network timeout of the 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.
+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
+int mailimap_is_163_workaround_enabled(mailimap * session);
+void mailimap_set_163_workaround_enabled(mailimap * session, int enabled);
+#ifndef LIBETPAN_HAS_MAILIMAP_RAMBLER_WORKAROUND
+ #define LIBETPAN_HAS_MAILIMAP_RAMBLER_WORKAROUND 1
+ 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
+int mailimap_is_rambler_workaround_enabled(mailimap * session);
+void mailimap_set_rambler_workaround_enabled(mailimap * session, int enabled);
+#ifndef MAILIMAP_COMPRESS_H
+#define MAILIMAP_COMPRESS_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).
+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.
+ @return returns 1 if compression deflate is available on the server.
+int mailimap_has_compress_deflate(mailimap * session);
@@ -0,0 +1,111 @@
+#ifndef MAILIMAP_EXTENSION_H
+#define MAILIMAP_EXTENSION_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.
+mailimap_extension_register(struct mailimap_extension_api * extension);
+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.
+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);
+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.
+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.
+int mailimap_has_extension(mailimap * session, const char * extension_name);
+int mailimap_has_authentication(mailimap * session, const char * authentication_name);
@@ -0,0 +1,114 @@
+#ifndef MAILIMAP_EXTENSION_TYPES_H
+#define MAILIMAP_EXTENSION_TYPES_H
+struct mailimap_extension_data;
+ this is the list of known extensions with the purpose to
+ get integer identifers for the extensions.
+ 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.
+ 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,
+ 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;
+ * $Id: mailimap_helper.h,v 1.12 2006/06/07 15:10:01 smarinier Exp $
+#ifndef MAILIMAP_HELPER_H
+#define MAILIMAP_HELPER_H
+int mailimap_fetch_rfc822(mailimap * session,
+ uint32_t msgid, char ** result);
+int mailimap_fetch_rfc822_header(mailimap * session,
+int mailimap_fetch_envelope(mailimap * session,
+ uint32_t first, uint32_t last,
+int mailimap_append_simple(mailimap * session, const char * mailbox,
+ const char * content, size_t size);
+int mailimap_login_simple(mailimap * session,
+#ifndef MAILIMAP_ID_H
+#define MAILIMAP_ID_H
+#include <libetpan/mailimap_id_types.h>
+LIBETPAN_EXPORT extern struct mailimap_extension_api mailimap_extension_id;
+int mailimap_has_id(mailimap * session);
+int mailimap_id(mailimap * session, struct mailimap_id_params_list * client_identification,
+ struct mailimap_id_params_list ** result);
+/* Helpers */
+/* result must be freed */
+int mailimap_id_basic(mailimap * session, const char * name, const char * version,
+ char ** p_server_name, char ** p_server_version);
+#ifndef MAILIMAP_ID_TYPES_H
+#define MAILIMAP_ID_TYPES_H
+struct mailimap_id_params_list {
+ clist * /* struct mailimap_id_param */ idpa_list;
+struct mailimap_id_params_list * mailimap_id_params_list_new(clist * items);
+void mailimap_id_params_list_free(struct mailimap_id_params_list * list);
+struct mailimap_id_param {
+ char * idpa_name;
+ char * idpa_value;
+struct mailimap_id_param * mailimap_id_param_new(char * name, char * value);
+void mailimap_id_param_free(struct mailimap_id_param * param);
+struct mailimap_id_params_list * mailimap_id_params_list_new_empty(void);
+int mailimap_id_params_list_add_name_value(struct mailimap_id_params_list * list, char * name, char * value);
@@ -0,0 +1,102 @@
+#ifndef MAILIMAP_OAUTH2_H
+#define MAILIMAP_OAUTH2_H
+ 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 auth_user Authentication user (tipically an e-mail address, depends on server)
+ @param access_token OAuth2 access token
+int mailimap_oauth2_authenticate(mailimap * session, const char * auth_user,
+ const char * access_token);
+int mailimap_has_xoauth2(mailimap * session);
+ * $Id: mailimap_socket.h,v 1.16 2006/12/26 13:13:24 hoa Exp $
+#ifndef MAILIMAP_SOCKET_H
+#define MAILIMAP_SOCKET_H
+int mailimap_socket_connect_voip(mailimap * f, const char * server, uint16_t port, int voip_enabled);
+int mailimap_socket_connect(mailimap * f, const char * server, uint16_t port);
+int mailimap_socket_starttls(mailimap * f);
+int mailimap_socket_starttls_with_callback(mailimap * f,
+ void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data);
+#ifndef libetpan_mailimap_sort_h
+#define libetpan_mailimap_sort_h
+#include <libetpan/mailimap_sort_types.h>
+ LIBETPAN_EXPORT
+ extern struct mailimap_extension_api mailimap_extension_sort;
+ mailimap_sort()
+ their numbers sorted by the given sorting criteria in the result list.
+ int
+ mailimap_sort(mailimap * session, const char * charset,
+ struct mailimap_sort_key * key, struct mailimap_search_key * searchkey,
+ mailimap_uid_sort()
+ their unique identifiers sorted by the given sorting criteria in the result list.
+ @param key This is the sorting criteria
+ @param searchkey This is the searching criteria
+ mailimap_uid_sort(mailimap * session, const char * charset,
+ void mailimap_sort_result_free(clist * search_result);
@@ -0,0 +1,121 @@
+#ifndef MAILIMAP_SORT_TYPES_H
+#define MAILIMAP_SORT_TYPES_H
+#ifndef WIN32
+ /* 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 *) */
+ struct mailimap_sort_key *
+ mailimap_sort_key_new(int sortk_type,
+ int is_reverse,
+ clist * sortk_multiple);
+ void mailimap_sort_key_free(struct mailimap_sort_key * key);
+ mailimap_sort_key_new_arrival(int is_reverse);
+ mailimap_sort_key_new_cc(int is_reverse);
+ mailimap_sort_key_new_date(int is_reverse);
+ mailimap_sort_key_new_from(int is_reverse);
+ mailimap_sort_key_new_size(int is_reverse);
+ mailimap_sort_key_new_subject(int is_reverse);
+ mailimap_sort_key_new_to(int is_reverse);
+ mailimap_sort_key_new_multiple(clist * keys);
+ mailimap_sort_key_new_multiple_empty(void);
+ mailimap_sort_key_multiple_add(struct mailimap_sort_key * keys,
+ struct mailimap_sort_key * key_item);
+ * $Id: mailimap_ssl.h,v 1.16 2006/12/26 13:13:24 hoa Exp $
+#ifndef MAILIMAP_SSL_H
+#define MAILIMAP_SSL_H
+int mailimap_ssl_connect(mailimap * f, const char * server, uint16_t port);
+int mailimap_ssl_connect_voip(mailimap * f, const char * server, uint16_t port, int voip_enabled);
+int mailimap_ssl_connect_with_callback(mailimap * f, const char * server, uint16_t port,
+int mailimap_ssl_connect_voip_with_callback(mailimap * f, const char * server, uint16_t port, int voip_enabled,
@@ -0,0 +1,3604 @@
+ * $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
+ 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
+ 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
+ ; MUST accept flag-extension flags. Server
+ ; flag-extension flags except as defined by
+ 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
+ media-subtype = string
+ media-text = DQUOTE "TEXT" DQUOTE SP media-subtype
+ 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
+#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
+ 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 */
+struct mailimap_address *
+mailimap_address_new(char * ad_personal_name, char * ad_source_route,
+ char * ad_mailbox_name, char * ad_host_name);
+void mailimap_address_free(struct mailimap_address * addr);
+/* this is the type of MIME body parsed by IMAP server */
+ 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 */
+ struct mailimap_body_type_1part * bd_body_1part; /* can be NULL */
+ struct mailimap_body_type_mpart * bd_body_mpart; /* can be NULL */
+ } bd_data;
+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);
+void mailimap_body_free(struct mailimap_body * body);
+ this is the type of MIME body extension
+ 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 {
+ can be MAILIMAP_BODY_EXTENSION_NSTRING, MAILIMAP_BODY_EXTENSION_NUMBER
+ or MAILIMAP_BODY_EXTENSION_LIST
+ 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;
+struct mailimap_body_extension *
+mailimap_body_extension_new(int ext_type, char * ext_nstring,
+ uint32_t ext_number,
+ clist * ext_body_extension_list);
+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 *) */
+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);
+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
+ - 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
+struct mailimap_body_ext_mpart {
+ struct mailimap_body_fld_param * bd_parameter; /* can be NULL */
+struct mailimap_body_ext_mpart *
+mailimap_body_ext_mpart_new(struct mailimap_body_fld_param * bd_parameter,
+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_id is the value of Content-ID header field, should be allocated
+ with malloc()
+ - body_description is the value of Content-Description header field,
+ - body_encoding is the value of Content-Transfer-Encoding header field
+ - body_size is the size of the MIME part
+struct mailimap_body_fields {
+ char * bd_id; /* can be NULL */
+ char * bd_description; /* can be NULL */
+ struct mailimap_body_fld_enc * bd_encoding; /* != NULL */
+ uint32_t bd_size;
+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);
+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 */
+struct mailimap_body_fld_dsp *
+mailimap_body_fld_dsp_new(char * dsp_type,
+ struct mailimap_body_fld_param * dsp_attributes);
+void mailimap_body_fld_dsp_free(struct mailimap_body_fld_dsp * bfd);
+/* these are the different parsed values for Content-Transfer-Encoding */
+ 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,
+struct mailimap_body_fld_enc {
+ int enc_type;
+ char * enc_value; /* can be NULL */
+struct mailimap_body_fld_enc *
+mailimap_body_fld_enc_new(int enc_type, char * enc_value);
+void mailimap_body_fld_enc_free(struct mailimap_body_fld_enc * bfe);
+/* this is the type of Content-Language header field value */
+ 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,
+ - 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;
+ char * lg_single; /* can be NULL */
+ clist * lg_list; /* list of string (char *), can be NULL */
+ } lg_data;
+struct mailimap_body_fld_lang *
+mailimap_body_fld_lang_new(int lg_type, char * lg_single, clist * lg_list);
+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 */
+struct mailimap_single_body_fld_param *
+mailimap_single_body_fld_param_new(char * pa_name, char * pa_value);
+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 */
+struct mailimap_body_fld_param *
+mailimap_body_fld_param_new(clist * pa_list);
+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)
+ 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 {
+ 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 */
+ struct mailimap_body_ext_1part * bd_ext_1part; /* can be NULL */
+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);
+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 */
+struct mailimap_body_type_basic *
+mailimap_body_type_basic_new(struct mailimap_media_basic * bd_media_basic,
+ struct mailimap_body_fields * bd_fields);
+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 *) */
+ char * bd_media_subtype; /* != NULL */
+ struct mailimap_body_ext_mpart * bd_ext_mpart; /* can be NULL */
+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);
+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_envelope * bd_envelope; /* != NULL */
+ struct mailimap_body * bd_body; /* != NULL */
+ uint32_t bd_lines;
+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);
+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()
+struct mailimap_body_type_text {
+ char * bd_media_text; /* != NULL */
+struct mailimap_body_type_text *
+mailimap_body_type_text_new(char * bd_media_text,
+ struct mailimap_body_fields * bd_fields,
+mailimap_body_type_text_free(struct mailimap_body_type_text * body_type_text);
+/* this is the type of capability field */
+ 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,
+ - name is a type of capability when this is not an authentication type,
+struct mailimap_capability {
+ int cap_type;
+ char * cap_auth_type; /* can be NULL */
+ char * cap_name; /* can be NULL */
+ } cap_data;
+struct mailimap_capability *
+mailimap_capability_new(int cap_type, char * cap_auth_type, char * cap_name);
+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 */
+struct mailimap_capability_data *
+mailimap_capability_data_new(clist * cap_list);
+mailimap_capability_data_free(struct mailimap_capability_data * cap_data);
+/* this is the type of continue request data */
+ 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
+struct mailimap_continue_req {
+ int cr_type;
+ struct mailimap_resp_text * cr_text; /* can be NULL */
+ char * cr_base64; /* can be NULL */
+ } cr_data;
+struct mailimap_continue_req *
+mailimap_continue_req_new(int cr_type, struct mailimap_resp_text * cr_text,
+ char * cr_base64);
+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;
+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);
+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,
+ - 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,
+ - message_id is the content of the "Message-ID" field,
+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 */
+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);
+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 */
+struct mailimap_env_bcc * mailimap_env_bcc_new(clist * bcc_list);
+void mailimap_env_bcc_free(struct mailimap_env_bcc * env_bcc);
+ mailimap_env_cc is the parsed "Cc" field
+struct mailimap_env_cc {
+ clist * cc_list; /* list of (struct mailimap_address *), can be NULL */
+struct mailimap_env_cc * mailimap_env_cc_new(clist * cc_list);
+void mailimap_env_cc_free(struct mailimap_env_cc * env_cc);
+ mailimap_env_from is the parsed "From" field
+struct mailimap_env_from {
+ clist * frm_list; /* list of (struct mailimap_address *) */
+struct mailimap_env_from * mailimap_env_from_new(clist * frm_list);
+void mailimap_env_from_free(struct mailimap_env_from * env_from);
+ mailimap_env_reply_to is the parsed "Reply-To" field
+struct mailimap_env_reply_to {
+ clist * rt_list; /* list of (struct mailimap_address *), can be NULL */
+struct mailimap_env_reply_to * mailimap_env_reply_to_new(clist * rt_list);
+mailimap_env_reply_to_free(struct mailimap_env_reply_to * env_reply_to);
+ mailimap_env_sender is the parsed "Sender" field
+struct mailimap_env_sender {
+ clist * snd_list; /* list of (struct mailimap_address *), can be NULL */
+struct mailimap_env_sender * mailimap_env_sender_new(clist * snd_list);
+void mailimap_env_sender_free(struct mailimap_env_sender * env_sender);
+ mailimap_env_to is the parsed "To" field
+struct mailimap_env_to {
+ clist * to_list; /* list of (struct mailimap_address *), can be NULL */
+struct mailimap_env_to * mailimap_env_to_new(clist * to_list);
+void mailimap_env_to_free(struct mailimap_env_to * env_to);
+/* this is the type of flag */
+ 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,
+ - extension is the flag when the flag is of extension type, should be
+struct mailimap_flag {
+ int fl_type;
+ char * fl_keyword; /* can be NULL */
+ char * fl_extension; /* can be NULL */
+ } fl_data;
+struct mailimap_flag * mailimap_flag_new(int fl_type,
+ char * fl_keyword, char * fl_extension);
+void mailimap_flag_free(struct mailimap_flag * f);
+ 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 {
+ struct mailimap_flag * fl_flag; /* can be NULL */
+struct mailimap_flag_fetch *
+mailimap_flag_fetch_new(int fl_type, struct mailimap_flag * fl_flag);
+void mailimap_flag_fetch_free(struct mailimap_flag_fetch * flag_fetch);
+ 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 {
+struct mailimap_flag_perm *
+mailimap_flag_perm_new(int fl_type, struct mailimap_flag * fl_flag);
+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 */
+struct mailimap_flag_list *
+mailimap_flag_list_new(clist * fl_list);
+void mailimap_flag_list_free(struct mailimap_flag_list * flag_list);
+/* this is the type of greeting response */
+ 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;
+ struct mailimap_resp_cond_auth * gr_auth; /* can be NULL */
+ struct mailimap_resp_cond_bye * gr_bye; /* can be NULL */
+ } gr_data;
+struct mailimap_greeting *
+mailimap_greeting_new(int gr_type,
+ struct mailimap_resp_cond_auth * gr_auth,
+ struct mailimap_resp_cond_bye * gr_bye);
+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
+struct mailimap_header_list {
+ clist * hdr_list; /* list of astring (char *), != NULL */
+struct mailimap_header_list *
+mailimap_header_list_new(clist * hdr_list);
+mailimap_header_list_free(struct mailimap_header_list * header_list);
+/* this is the type of mailbox STATUS that can be returned */
+ 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 */
+struct mailimap_status_info *
+ mailimap_status_info_new(int st_att, uint32_t st_value,
+ struct mailimap_extension_data * st_ext_data);
+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 *) */
+struct mailimap_mailbox_data_status *
+mailimap_mailbox_data_status_new(char * st_mailbox,
+ clist * st_info_list);
+mailimap_mailbox_data_status_free(struct mailimap_mailbox_data_status * info);
+/* this is the type of mailbox information that is returned */
+ 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
+ - 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;
+ 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;
+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);
+mailimap_mailbox_data_free(struct mailimap_mailbox_data * mb_data);
+/* this is the type of mailbox flags */
+ 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 */
+ 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;
+struct mailimap_mbx_list_flags *
+mailimap_mbx_list_flags_new(int mbf_type,
+ clist * mbf_oflags, int mbf_sflag);
+mailimap_mbx_list_flags_free(struct mailimap_mbx_list_flags * mbx_list_flags);
+/* this is the type of the mailbox other flag */
+ 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 */
+struct mailimap_mbx_list_oflag *
+mailimap_mbx_list_oflag_new(int of_type, char * of_flag_ext);
+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 */
+struct mailimap_mailbox_list *
+mailimap_mailbox_list_new(struct mailimap_mbx_list_flags * mbx_flags,
+ char mb_delimiter, char * mb_name);
+mailimap_mailbox_list_free(struct mailimap_mailbox_list * mb_list);
+/* this is the MIME type */
+ 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 */
+struct mailimap_media_basic *
+mailimap_media_basic_new(int med_type,
+ char * med_basic_type, char * med_subtype);
+mailimap_media_basic_free(struct mailimap_media_basic * media_basic);
+/* this is the type of message data */
+ 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 */
+struct mailimap_message_data *
+mailimap_message_data_new(uint32_t mdt_number, int mdt_type,
+ struct mailimap_msg_att * mdt_msg_att);
+mailimap_message_data_free(struct mailimap_message_data * msg_data);
+/* this the type of the message attributes */
+ 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;
+ 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;
+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);
+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 *) */
+ uint32_t att_number; /* extra field to store the message number,
+ used for mailimap */
+struct mailimap_msg_att * mailimap_msg_att_new(clist * att_list);
+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 *) */
+struct mailimap_msg_att_dynamic *
+mailimap_msg_att_dynamic_new(clist * att_list);
+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;
+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);
+mailimap_msg_att_body_section_free(struct mailimap_msg_att_body_section *
+ msg_att_body_section);
+ this is the type of static message attribute
+ 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,
+ - 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 {
+ struct mailimap_envelope * att_env; /* can be NULL */
+ struct mailimap_date_time * att_internal_date; /* can be NULL */
+ char * att_content; /* can be NULL */
+ size_t att_length;
+ } att_rfc822;
+ } att_rfc822_header;
+ } 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;
+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);
+mailimap_msg_att_static_free(struct mailimap_msg_att_static * item);
+/* this is the type of a response element */
+ 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;
+ struct mailimap_continue_req * rsp_cont_req; /* can be NULL */
+ struct mailimap_response_data * rsp_resp_data; /* can be NULL */
+ } rsp_data;
+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);
+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 *) */
+ struct mailimap_response_done * rsp_resp_done; /* != NULL */
+struct mailimap_response *
+mailimap_response_new(clist * rsp_cont_req_or_resp_data_list,
+ struct mailimap_response_done * rsp_resp_done);
+mailimap_response_free(struct mailimap_response * resp);
+/* this is the type of an untagged response */
+ 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 {
+ 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 */
+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);
+mailimap_response_data_free(struct mailimap_response_data * resp_data);
+/* this is the type of an ending response */
+ 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 {
+ struct mailimap_response_tagged * rsp_tagged; /* can be NULL */
+ struct mailimap_response_fatal * rsp_fatal; /* can be NULL */
+struct mailimap_response_done *
+mailimap_response_done_new(int rsp_type,
+ struct mailimap_response_tagged * rsp_tagged,
+ struct mailimap_response_fatal * rsp_fatal);
+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 */
+struct mailimap_response_fatal *
+mailimap_response_fatal_new(struct mailimap_resp_cond_bye * rsp_bye);
+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()
+struct mailimap_response_tagged {
+ char * rsp_tag; /* != NULL */
+ struct mailimap_resp_cond_state * rsp_cond_state; /* != NULL */
+struct mailimap_response_tagged *
+mailimap_response_tagged_new(char * rsp_tag,
+ struct mailimap_resp_cond_state * rsp_cond_state);
+mailimap_response_tagged_free(struct mailimap_response_tagged * tagged);
+/* this is the type of an authentication condition response */
+ 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 {
+ struct mailimap_resp_text * rsp_text; /* != NULL */
+struct mailimap_resp_cond_auth *
+mailimap_resp_cond_auth_new(int rsp_type,
+ struct mailimap_resp_text * rsp_text);
+mailimap_resp_cond_auth_free(struct mailimap_resp_cond_auth * cond_auth);
+ mailimap_resp_cond_bye is a BYE response
+struct mailimap_resp_cond_bye {
+struct mailimap_resp_cond_bye *
+mailimap_resp_cond_bye_new(struct mailimap_resp_text * rsp_text);
+mailimap_resp_cond_bye_free(struct mailimap_resp_cond_bye * cond_bye);
+/* this is the type of a condition state response */
+ 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
+struct mailimap_resp_cond_state {
+ struct mailimap_resp_text * rsp_text; /* can be NULL */
+struct mailimap_resp_cond_state *
+mailimap_resp_cond_state_new(int rsp_type,
+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 */
+struct mailimap_resp_text *
+mailimap_resp_text_new(struct mailimap_resp_text_code * resp_code,
+ char * rsp_text);
+void mailimap_resp_text_free(struct mailimap_resp_text * resp_text);
+/* this is the type of the response code */
+ 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
+ - 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
+ - atom_value is the data related with the extension response code,
+struct mailimap_resp_text_code {
+ int rc_type;
+ clist * rc_badcharset; /* list of astring (char *) */
+ struct mailimap_capability_data * rc_cap_data; /* != NULL */
+ clist * rc_perm_flags; /* list of (struct mailimap_flag_perm *) */
+ uint32_t rc_uidnext;
+ uint32_t rc_uidvalidity;
+ uint32_t rc_first_unseen;
+ 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;
+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);
+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 */
+struct mailimap_section *
+mailimap_section_new(struct mailimap_section_spec * sec_spec);
+void mailimap_section_free(struct mailimap_section * section);
+/* this is the type of the message/rfc822 part description */
+ MAILIMAP_SECTION_MSGTEXT_HEADER, /* header fields part of the
+ message */
+ MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS, /* given header fields of the
+ 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
+struct mailimap_section_msgtext {
+ int sec_type;
+ struct mailimap_header_list * sec_header_list; /* can be NULL */
+struct mailimap_section_msgtext *
+mailimap_section_msgtext_new(int sec_type,
+ struct mailimap_header_list * sec_header_list);
+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 *) */
+struct mailimap_section_part *
+mailimap_section_part_new(clist * sec_id);
+mailimap_section_part_free(struct mailimap_section_part * section_part);
+/* this is the type of section specification */
+ 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
+ - 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 {
+ 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 */
+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);
+mailimap_section_spec_free(struct mailimap_section_spec * section_spec);
+/* this is the type of body part location for a given MIME part */
+ 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 {
+struct mailimap_section_text *
+mailimap_section_text_new(int sec_type,
+ struct mailimap_section_msgtext * sec_msgtext);
+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;
+struct mailimap_set_item *
+mailimap_set_item_new(uint32_t set_first, uint32_t set_last);
+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 *) */
+struct mailimap_set * mailimap_set_new(clist * list);
+void mailimap_set_free(struct mailimap_set * set);
+ mailimap_date is a date
+ - day is the day in the month (1 to 31)
+struct mailimap_date {
+struct mailimap_date *
+mailimap_date_new(int dt_day, int dt_month, int dt_year);
+void mailimap_date_free(struct mailimap_date * date);
+/* this is the type of fetch attribute for a given message */
+ 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,
+ - 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 {
+ struct mailimap_section * att_section;
+ uint32_t att_offset;
+ uint32_t att_size;
+ char * att_extension; /* can be NULL */
+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);
+void mailimap_fetch_att_free(struct mailimap_fetch_att * fetch_att);
+/* this is the type of a FETCH operation */
+ 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
+struct mailimap_fetch_type {
+ int ft_type;
+ struct mailimap_fetch_att * ft_fetch_att;
+ clist * ft_fetch_att_list; /* list of (struct mailimap_fetch_att *) */
+ } ft_data;
+struct mailimap_fetch_type *
+mailimap_fetch_type_new(int ft_type,
+ struct mailimap_fetch_att * ft_fetch_att,
+ clist * ft_fetch_att_list);
+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;
+struct mailimap_store_att_flags *
+mailimap_store_att_flags_new(int fl_sign, int fl_silent,
+ struct mailimap_flag_list * fl_flag_list);
+void mailimap_store_att_flags_free(struct mailimap_store_att_flags *
+ store_att_flags);
+/* this is the condition of the SEARCH operation */
+ 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
+ MAILIMAP_SEARCH_KEY_BEFORE, /* messages whose internal date is earlier
+ MAILIMAP_SEARCH_KEY_BODY, /* message that contains the given string
+ MAILIMAP_SEARCH_KEY_CC, /* messages whose Cc field contains the
+ 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
+ MAILIMAP_SEARCH_KEY_KEYWORD, /* messages with the flag keyword set */
+ MAILIMAP_SEARCH_KEY_NEW, /* messages with the flag \Recent and not
+ MAILIMAP_SEARCH_KEY_OLD, /* messages that do not have the
+ MAILIMAP_SEARCH_KEY_ON, /* messages whose internal date is the
+ 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
+ MAILIMAP_SEARCH_KEY_SUBJECT, /* messages whose Subject field contains the
+ MAILIMAP_SEARCH_KEY_TEXT, /* messages whose text part contains the
+ MAILIMAP_SEARCH_KEY_TO, /* messages whose To field contains the
+ 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
+ MAILIMAP_SEARCH_KEY_LARGER, /* messages whose size is larger then
+ 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
+ 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
+ MAILIMAP_SEARCH_KEY_MULTIPLE, /* the boolean operator between the
+ 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
+ MAILIMAP_SEARCH_KEY_BCC, should be allocated with malloc()
+ - before is a date when type is MAILIMAP_SEARCH_KEY_BEFORE
+ MAILIMAP_SEARCH_KEY_BODY, should be allocated with malloc()
+ MAILIMAP_SEARCH_KEY_CC, should be allocated with malloc()
+ MAILIMAP_SEARCH_KEY_FROM, should be allocated with malloc()
+ - keyword is the keyword flag name when type is MAILIMAP_SEARCH_KEY_KEYWORD,
+ - on is a date when type is MAILIMAP_SEARCH_KEY_ON
+ - since is a date when type is MAILIMAP_SEARCH_KEY_SINCE
+ - unkeyword is the keyword flag name when type is
+ MAILIMAP_SEARCH_KEY_UNKEYWORD, should be allocated with malloc()
+ - 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
+ 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 {
+ struct mailimap_date * sk_before;
+ char * sk_keyword;
+ struct mailimap_date * sk_on;
+ struct mailimap_date * sk_since;
+ char * sk_unkeyword;
+ } sk_header;
+ uint32_t sk_larger;
+ struct mailimap_search_key * sk_not;
+ 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;
+ struct mailimap_flag * sk_entry_name;
+ int sk_entry_type_req;
+ uint64_t sk_modseq_valzer;
+ } sk_modseq;
+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_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
+mailimap_search_key_new_xgmthrid(uint64_t sk_xgmthrid);
+mailimap_search_key_new_xgmmsgid(uint64_t sk_xgmmsgid);
+mailimap_search_key_new_xgmraw(char * sk_xgmraw);
+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),
+struct mailimap_status_att_list {
+ clist * att_list; /* list of (uint32_t *) */
+struct mailimap_status_att_list *
+mailimap_status_att_list_new(clist * att_list);
+void mailimap_status_att_list_free(struct mailimap_status_att_list *
+ status_att_list);
+/* internal use functions */
+uint32_t * mailimap_number_alloc_new(uint32_t number);
+void mailimap_number_alloc_free(uint32_t * pnumber);
+void mailimap_addr_host_free(char * addr_host);
+void mailimap_addr_mailbox_free(char * addr_mailbox);
+void mailimap_addr_adl_free(char * addr_adl);
+void mailimap_addr_name_free(char * addr_name);
+void mailimap_astring_free(char * astring);
+void mailimap_atom_free(char * atom);
+void mailimap_auth_type_free(char * auth_type);
+void mailimap_base64_free(char * base64);
+void mailimap_body_fld_desc_free(char * body_fld_desc);
+void mailimap_body_fld_id_free(char * body_fld_id);
+void mailimap_body_fld_md5_free(char * body_fld_md5);
+void mailimap_body_fld_loc_free(char * body_fld_loc);
+void mailimap_env_date_free(char * date);
+void mailimap_env_in_reply_to_free(char * in_reply_to);
+void mailimap_env_message_id_free(char * message_id);
+void mailimap_env_subject_free(char * subject);
+void mailimap_flag_extension_free(char * flag_extension);
+void mailimap_flag_keyword_free(char * flag_keyword);
+mailimap_header_fld_name_free(char * header_fld_name);
+void mailimap_literal_free(char * literal);
+void mailimap_mailbox_free(char * mailbox);
+mailimap_mailbox_data_search_free(clist * data_search);
+void mailimap_media_subtype_free(char * media_subtype);
+void mailimap_media_text_free(char * media_text);
+void mailimap_msg_att_envelope_free(struct mailimap_envelope * env);
+mailimap_msg_att_internaldate_free(struct mailimap_date_time * date_time);
+mailimap_msg_att_rfc822_free(char * str);
+mailimap_msg_att_rfc822_header_free(char * str);
+mailimap_msg_att_rfc822_text_free(char * str);
+mailimap_msg_att_body_free(struct mailimap_body * body);
+mailimap_msg_att_bodystructure_free(struct mailimap_body * body);
+void mailimap_nstring_free(char * str);
+mailimap_string_free(char * str);
+void mailimap_tag_free(char * tag);
+void mailimap_text_free(char * text);
+/* IMAP connection */
+/* this is the state of the IMAP connection */
+ 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;
+ 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;
+ 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;
+struct mailimap_connection_info *
+mailimap_connection_info_new(void);
+mailimap_connection_info_free(struct mailimap_connection_info * conn_info);
+/* this is the type of mailbox access */
+ 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;
+struct mailimap_selection_info *
+mailimap_selection_info_new(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;
+struct mailimap_response_info *
+mailimap_response_info_new(void);
+mailimap_response_info_free(struct mailimap_response_info * resp_info);
+/* these are the possible returned error codes */
+ 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 {
+ 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;
+struct mailimap_parser_context *
+mailimap_parser_context_new(mailimap * session);
+mailimap_parser_context_free(struct mailimap_parser_context * ctx);
+mailimap_parser_context_is_rambler_workaround_enabled(struct mailimap_parser_context * parser_ctx);
@@ -0,0 +1,849 @@
+ * $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
+ this function creates a new set item with a single message
+ given by indx
+struct mailimap_set_item * mailimap_set_item_new_single(uint32_t indx);
+ this function creates a new set with one set item
+struct mailimap_set *
+mailimap_set_new_single_item(struct mailimap_set_item * item);
+ this function creates a set with a single interval
+struct mailimap_set * mailimap_set_new_interval(uint32_t first, uint32_t last);
+ this function creates a set with a single message
+struct mailimap_set * mailimap_set_new_single(uint32_t indx);
+ this function creates an empty set of messages
+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
+int mailimap_set_add(struct mailimap_set * set,
+ struct mailimap_set_item * set_item);
+ this function adds an interval to the set
+int mailimap_set_add_interval(struct mailimap_set * set,
+ uint32_t first, uint32_t last);
+ this function adds a single message to the set
+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
+struct mailimap_section * mailimap_section_new_header(void);
+ this functions creates a mailimap_section structure to describe
+ a list of headers
+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
+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
+struct mailimap_section * mailimap_section_new_text(void);
+ content of a MIME part
+mailimap_section_new_part(struct mailimap_section_part * part);
+ MIME fields of a MIME part
+mailimap_section_new_part_mime(struct mailimap_section_part * part);
+ headers of a MIME part if the MIME type is a message/rfc822
+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
+mailimap_section_new_part_header_fields(struct mailimap_section_part *
+ part,
+ struct mailimap_header_list *
+ header_list);
+ headers of a MIME part other than those given if the MIME type
+ is a message/rfc822
+mailimap_section_new_part_header_fields_not(struct mailimap_section_part
+ * part,
+ struct mailimap_header_list
+ * header_list);
+ text part of message if the MIME type is a message/rfc822
+mailimap_section_new_part_text(struct mailimap_section_part * part);
+ this function creates a mailimap_fetch_att structure to request
+ envelope of a message
+mailimap_fetch_att_new_envelope(void);
+ flags of a message
+mailimap_fetch_att_new_flags(void);
+ internal date of a message
+mailimap_fetch_att_new_internaldate(void);
+ text part of a message
+mailimap_fetch_att_new_rfc822(void);
+ header of a message
+mailimap_fetch_att_new_rfc822_header(void);
+ size of a message
+mailimap_fetch_att_new_rfc822_size(void);
+mailimap_fetch_att_new_rfc822_text(void);
+ the MIME structure of a message
+mailimap_fetch_att_new_body(void);
+ the MIME structure of a message and additional MIME information
+mailimap_fetch_att_new_bodystructure(void);
+ unique identifier of a message
+mailimap_fetch_att_new_uid(void);
+ a given section of a message
+mailimap_fetch_att_new_body_section(struct mailimap_section * section);
+ a given section of a message without marking it as read
+mailimap_fetch_att_new_body_peek_section(struct mailimap_section * section);
+ a part of a section of a message
+mailimap_fetch_att_new_body_section_partial(struct mailimap_section * section,
+ uint32_t offset, uint32_t size);
+ a part of a section of a message without marking it as read
+mailimap_fetch_att_new_body_peek_section_partial(struct mailimap_section * section,
+ creates a mailimap_fetch_att extension
+ 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
+mailimap_fetch_type_new_all(void);
+ (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)
+mailimap_fetch_type_new_full(void);
+ (FLAGS INTERNALDATE RFC822.SIZE)
+mailimap_fetch_type_new_fast(void);
+ the given fetch attribute
+mailimap_fetch_type_new_fetch_att(struct mailimap_fetch_att * fetch_att);
+ the list of fetch attributes
+mailimap_fetch_type_new_fetch_att_list(clist * fetch_att_list);
+ this function creates a mailimap_fetch_type structure
+mailimap_fetch_type_new_fetch_att_list_empty(void);
+ this function adds a given fetch attribute to the mailimap_fetch
+ structure
+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
+mailimap_store_att_flags_new_set_flags(struct mailimap_flag_list * flags);
+ this function creates a store attribute to silently set the given 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
+mailimap_store_att_flags_new_add_flags(struct mailimap_flag_list * flags);
+ this function creates a store attribute to add silently the given flags
+mailimap_store_att_flags_new_add_flags_silent(struct mailimap_flag_list *
+ this function creates a store attribute to remove the given 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
+mailimap_store_att_flags_new_remove_flags_silent(struct mailimap_flag_list *
+ this function creates a condition structure to match all messages
+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
+mailimap_search_key_new_bcc(char * sk_bcc);
+ internal date
+mailimap_search_key_new_before(struct mailimap_date * sk_before);
+ message content
+ @param body this is the content of the message to match, it should
+mailimap_search_key_new_body(char * sk_body);
+ Cc field
+ @param cc this is the content of Cc to match, it should be allocated
+mailimap_search_key_new_cc(char * sk_cc);
+ From field
+ @param from this is the content of From to match, it should be allocated
+mailimap_search_key_new_from(char * sk_from);
+ a flag given by keyword
+mailimap_search_key_new_keyword(char * sk_keyword);
+mailimap_search_key_new_on(struct mailimap_date * sk_on);
+mailimap_search_key_new_since(struct mailimap_date * sk_since);
+ Subject field
+ @param subject this is the content of Subject to match, it should
+mailimap_search_key_new_subject(char * sk_subject);
+ message text part
+ @param text this is the message text to match, it should
+mailimap_search_key_new_text(char * sk_text);
+ To field
+ @param to this is the content of To to match, it should be allocated
+mailimap_search_key_new_to(char * sk_to);
+ no a flag given by unkeyword
+mailimap_search_key_new_unkeyword(char * sk_unkeyword);
+ the given field
+ @param header_name this is the name of the field to match, it
+ @param header_value this is the content, it should be allocated
+mailimap_search_key_new_header(char * sk_header_name, char * sk_header_value);
+ this function creates a condition structure to match messages with size
+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
+mailimap_search_key_new_not(struct mailimap_search_key * sk_not);
+ match one of the given conditions
+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
+mailimap_search_key_new_sentbefore(struct mailimap_date * sk_sentbefore);
+mailimap_search_key_new_senton(struct mailimap_date * sk_senton);
+mailimap_search_key_new_sentsince(struct mailimap_date * sk_sentsince);
+mailimap_search_key_new_smaller(uint32_t sk_smaller);
+ this function creates a condition structure to match messages with unique
+ identifier
+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)
+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
+mailimap_search_key_new_multiple(clist * sk_multiple);
+ same as previous but the list is empty
+mailimap_search_key_new_multiple_empty(void);
+ this function adds a condition to the condition list
+mailimap_search_key_multiple_add(struct mailimap_search_key * keys,
+ struct mailimap_search_key * key_item);
+ this function creates an empty list of flags
+mailimap_flag_list_new_empty(void);
+ this function adds a flag to the list of flags
+int mailimap_flag_list_add(struct mailimap_flag_list * flag_list,
+ struct mailimap_flag * f);
+ this function creates a \Answered flag
+struct mailimap_flag * mailimap_flag_new_answered(void);
+ this function creates a \Flagged flag
+struct mailimap_flag * mailimap_flag_new_flagged(void);
+ this function creates a \Deleted flag
+struct mailimap_flag * mailimap_flag_new_deleted(void);
+ this function creates a \Seen flag
+struct mailimap_flag * mailimap_flag_new_seen(void);
+ this function creates a \Draft flag
+struct mailimap_flag * mailimap_flag_new_draft(void);
+ this function creates a keyword flag
+ @param flag_keyword this should be allocated with malloc()
+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()
+struct mailimap_flag * mailimap_flag_new_flag_extension(char * flag_extension);
+ this function creates an empty list of status attributes
+struct mailimap_status_att_list * mailimap_status_att_list_new_empty(void);
+ this function adds status attributes to the list
+mailimap_status_att_list_add(struct mailimap_status_att_list * sa_list,
+ int status_att);
+/* return mailimap_section_part from a given mailimap_body */
+int mailimap_get_section_part_from_body(struct mailimap_body * root_part,
+ struct mailimap_body * part,
+ struct mailimap_section_part ** result);
@@ -0,0 +1,368 @@
+ * $Id: mailimf.h,v 1.28 2008/05/27 10:07:55 hoa Exp $
+#ifndef MAILIMF_H
+#define MAILIMF_H
+#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_SYS_TYPES_H
+ 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
+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 indx this is a pointer to the start of the message text part in
+int mailimf_body_parse(const char * message, size_t length,
+ struct mailimf_body ** result);
+ mailimf_fields_parse will parse the given header fields
+ @param message this is a string containing the header fields
+ @param indx this is a pointer to the start of the header fields in
+int mailimf_fields_parse(const char * message, size_t length,
+ mailimf_mailbox_list_parse will parse the given mailbox list
+ @param message this is a string containing the mailbox list
+ @param indx this is a pointer to the start of the mailbox list in
+mailimf_mailbox_list_parse(const char * message, size_t length,
+ 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 indx this is a pointer to the start of the address list in
+mailimf_address_list_parse(const char * message, size_t length,
+ struct mailimf_address_list ** result);
+ mailimf_address_parse will parse the given address
+ @param message this is a string containing the address
+ @param indx this is a pointer to the start of the address in
+int mailimf_address_parse(const char * message, size_t length,
+ struct mailimf_address ** result);
+ mailimf_mailbox_parse will parse the given address
+ @param message this is a string containing the mailbox
+ @param indx this is a pointer to the start of the mailbox in
+int mailimf_mailbox_parse(const char * message, size_t length,
+ 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 indx this is a pointer to the start of the date in
+int mailimf_date_time_parse(const char * message, size_t length,
+ 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)
+int mailimf_envelope_fields_parse(const char * message, size_t length,
+ mailimf_ignore_field_parse will skip the given field
+ @param message this is a string containing the header field
+ @param indx this is a pointer to the start of the header field in
+int mailimf_ignore_field_parse(const char * message, size_t length,
+ size_t * indx);
+ mailimf_envelope_fields will parse the given fields (Date,
+ References and Subject), other fields will be added as optional
+ fields.
+mailimf_envelope_and_optional_fields_parse(const char * message, size_t length,
+ mailimf_envelope_fields will parse the given fields as optional
+mailimf_optional_fields_parse(const char * message, size_t length,
+/* internal use, exported for MIME */
+int mailimf_fws_parse(const char * message, size_t length, size_t * indx);
+int mailimf_cfws_parse(const char * message, size_t length,
+int mailimf_char_parse(const char * message, size_t length,
+ size_t * indx, char token);
+int mailimf_unstrict_char_parse(const char * message, size_t length,
+int mailimf_crlf_parse(const char * message, size_t length, size_t * indx);
+mailimf_custom_string_parse(const char * message, size_t length,
+ size_t * indx, char ** result,
+ int (* is_custom_char)(char));
+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))
+int mailimf_quoted_string_parse(const char * message, size_t length,
+ size_t * indx, char ** result);
+mailimf_number_parse(const char * message, size_t length,
+ size_t * indx, uint32_t * result);
+int mailimf_msg_id_parse(const char * message, size_t length,
+int mailimf_msg_id_list_parse(const char * message, size_t length,
+ size_t * indx, clist ** result);
+int mailimf_word_parse(const char * message, size_t length,
+int mailimf_atom_parse(const char * message, size_t length,
+int mailimf_fws_atom_parse(const char * message, size_t length,
+int mailimf_fws_word_parse(const char * message, size_t length,
+ size_t * indx, char ** result, int * p_missing_closing_quote);
+int mailimf_fws_quoted_string_parse(const char * message, size_t length,
+/* exported for IMAP */
+int mailimf_references_parse(const char * message, size_t length,
+ struct mailimf_references ** result);
@@ -0,0 +1,864 @@
+ * $Id: mailimf_types.h,v 1.34 2006/05/22 13:39:42 hoa Exp $
+#ifndef MAILIMF_TYPES_H
+#define MAILIMF_TYPES_H
+ mailimf_date_time is a date
+struct mailimf_date_time {
+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);
+void mailimf_date_time_free(struct mailimf_date_time * date_time);
+/* this is the type of address */
+ 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;
+ struct mailimf_mailbox * ad_mailbox; /* can be NULL */
+ struct mailimf_group * ad_group; /* can be NULL */
+ } ad_data;
+struct mailimf_address *
+mailimf_address_new(int ad_type, struct mailimf_mailbox * ad_mailbox,
+ struct mailimf_group * ad_group);
+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>,
+ - 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 */
+struct mailimf_mailbox *
+mailimf_mailbox_new(char * mb_display_name, char * mb_addr_spec);
+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
+ - 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 */
+struct mailimf_group *
+mailimf_group_new(char * grp_display_name,
+ struct mailimf_mailbox_list * grp_mb_list);
+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 */
+struct mailimf_mailbox_list *
+mailimf_mailbox_list_new(clist * mb_list);
+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 */
+struct mailimf_address_list *
+mailimf_address_list_new(clist * ad_list);
+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;
+struct mailimf_body * mailimf_body_new(const char * bd_text, size_t bd_size);
+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 */
+struct mailimf_message *
+mailimf_message_new(struct mailimf_fields * msg_fields,
+ struct mailimf_body * msg_body);
+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 */
+struct mailimf_fields * mailimf_fields_new(clist * fld_list);
+void mailimf_fields_free(struct mailimf_fields * fields);
+/* this is a type of field */
+ 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;
+ 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;
+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);
+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 */
+struct mailimf_orig_date * mailimf_orig_date_new(struct mailimf_date_time *
+ dt_date_time);
+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 */
+struct mailimf_from *
+mailimf_from_new(struct mailimf_mailbox_list * frm_mb_list);
+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 */
+struct mailimf_sender * mailimf_sender_new(struct mailimf_mailbox * snd_mb);
+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 */
+struct mailimf_reply_to *
+mailimf_reply_to_new(struct mailimf_address_list * rt_addr_list);
+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 */
+struct mailimf_to * mailimf_to_new(struct mailimf_address_list * to_addr_list);
+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 */
+struct mailimf_cc * mailimf_cc_new(struct mailimf_address_list * cc_addr_list);
+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 */
+struct mailimf_bcc *
+mailimf_bcc_new(struct mailimf_address_list * bcc_addr_list);
+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 */
+struct mailimf_message_id * mailimf_message_id_new(char * mid_value);
+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 */
+struct mailimf_in_reply_to * mailimf_in_reply_to_new(clist * mid_list);
+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 *) */
+struct mailimf_references * mailimf_references_new(clist * mid_list);
+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 */
+struct mailimf_subject * mailimf_subject_new(char * sbj_value);
+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 */
+struct mailimf_comments * mailimf_comments_new(char * cm_value);
+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 */
+struct mailimf_keywords * mailimf_keywords_new(clist * kw_list);
+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 */
+struct mailimf_return *
+mailimf_return_new(struct mailimf_path * ret_path);
+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 */
+struct mailimf_path * mailimf_path_new(char * pt_addr_spec);
+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 */
+struct mailimf_optional_field *
+mailimf_optional_field_new(char * fld_name, char * fld_value);
+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 {
+/* internal use */
+void mailimf_atom_free(char * atom);
+void mailimf_dot_atom_free(char * dot_atom);
+void mailimf_dot_atom_text_free(char * dot_atom);
+void mailimf_quoted_string_free(char * quoted_string);
+void mailimf_word_free(char * word);
+void mailimf_phrase_free(char * phrase);
+void mailimf_unstructured_free(char * unstructured);
+void mailimf_angle_addr_free(char * angle_addr);
+void mailimf_display_name_free(char * display_name);
+void mailimf_addr_spec_free(char * addr_spec);
+void mailimf_local_part_free(char * local_part);
+void mailimf_domain_free(char * domain);
+void mailimf_domain_literal_free(char * domain);
+void mailimf_msg_id_free(char * msg_id);
+void mailimf_id_left_free(char * id_left);
+void mailimf_id_right_free(char * id_right);
+void mailimf_no_fold_quote_free(char * nfq);
+void mailimf_no_fold_literal_free(char * nfl);
+void mailimf_field_name_free(char * field_name);
+ MAILIMF_NO_ERROR = 0,
+ MAILIMF_ERROR_PARSE,
+ MAILIMF_ERROR_MEMORY,
+ MAILIMF_ERROR_INVAL,
+ MAILIMF_ERROR_FILE
@@ -0,0 +1,394 @@
+ * $Id: mailimf_types_helper.h,v 1.15 2007/12/10 21:32:59 hoa Exp $
+#ifndef MAILIMF_TYPES_HELPER
+#define MAILIMF_TYPES_HELPER
+ mailimf_mailbox_list_new_empty creates an empty list of mailboxes
+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,
+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
+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
+ - address is the mailbox, for example 'mailbox@domain'
+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
+mailimf_address_list_new_empty(void);
+ mailimf_address_list_add adds a mailbox to the list of addresses
+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
+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
+int mailimf_address_list_add_mb(struct mailimf_address_list * address_list,
+ 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()
+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
+struct mailimf_fields *
+mailimf_resent_fields_new_with_data_all(struct mailimf_date_time *
+ resent_date, struct mailimf_mailbox_list * resent_from,
+ structure with a set of resent fields.
+ Resent-Date and Resent-Message-ID fields will be generated for you.
+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
+mailimf_fields_new_empty(void);
+ this function adds a field to the mailimf_fields structure
+int mailimf_fields_add(struct mailimf_fields * fields,
+ struct mailimf_field * field);
+ mailimf_fields_add_data adds a set of fields in the
+ @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
+ @param references each elements of this list should be allocated
+int mailimf_fields_add_data(struct mailimf_fields * fields,
+ struct mailimf_date_time * date,
+ struct mailimf_mailbox_list * from,
+ struct mailimf_address_list * reply_to,
+ 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
+ @param message_id sould be allocated with malloc()
+mailimf_fields_new_with_data_all(struct mailimf_date_time * date,
+ char * message_id,
+ mailimf_fields_new_with_data creates a new mailimf_fields
+ Date and Message-ID fields will be generated for you.
+mailimf_fields_new_with_data(struct mailimf_mailbox_list * from,
+ this function returns an allocated message identifier to
+ use in a Message-ID or Resent-Message-ID field
+char * mailimf_get_message_id(void);
+ this function returns a mailimf_date_time structure to
+ use in a Date or Resent-Date field
+struct mailimf_date_time * mailimf_get_current_date(void);
+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
+void mailimf_single_fields_init(struct mailimf_single_fields * single_fields,
+ mailimf_single_fields_new creates a new mailimf_single_fields and
+ fills the structure with mailimf_fields
+struct mailimf_single_fields *
+mailimf_single_fields_new(struct mailimf_fields * fields);
+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()
+struct mailimf_field * mailimf_field_new_custom(char * name, char * value);
+ * $Id: mailimf_write_file.h,v 1.3 2005/06/01 12:22:18 smarinier Exp $
+#ifndef MAILIMF_WRITE_H
+#define MAILIMF_WRITE_H
+#include <stdio.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
+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 fields is the fields to write
+int mailimf_fields_write_file(FILE * f, int * col,
+ mailimf_envelope_fields_write_file writes only some fields to a given stream
+int mailimf_envelope_fields_write_file(FILE * f, int * col,
+ mailimf_field_write_file writes a field to a given stream
+ @param field is the field to write
+int mailimf_field_write_file(FILE * f, int * col,
+ mailimf_quoted_string_write_file writes a string that is quoted
+ to a given stream
+ @param string is the string to quote and write
+int mailimf_quoted_string_write_file(FILE * f, int * col,
+ const char * string, size_t len);
+int mailimf_address_list_write_file(FILE * f, int * col,
+ struct mailimf_address_list * addr_list);
+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.
+int mailimf_header_string_write_file(FILE * f, int * col,
+/* binary compatibility with 0.34 - begin */
+#ifdef MAILIMF_WRITE_COMPATIBILITY
+int mailimf_string_write(FILE * f, int * col,
+int mailimf_fields_write(FILE * f, int * col,
+int mailimf_envelope_fields_write(FILE * f, int * col,
+int mailimf_field_write(FILE * f, int * col,
+int mailimf_quoted_string_write(FILE * f, int * col,
+int mailimf_address_list_write(FILE * f, int * col,
+int mailimf_mailbox_list_write(FILE * f, int * col,
+int mailimf_header_string_write(FILE * f, int * col,
+/* binary compatibility with 0.34 - end */
@@ -0,0 +1,150 @@
+ * $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
+ mailimf_string_write writes a string to a given stream
+int mailimf_string_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+ int * col,
+ mailimf_fields_write writes the fields to a given stream
+int mailimf_fields_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+ mailimf_envelope_fields_write writes only some fields to a given stream
+int mailimf_envelope_fields_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+ mailimf_field_write writes a field to a given stream
+int mailimf_field_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+ mailimf_quoted_string_write writes a string that is quoted
+int mailimf_quoted_string_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+int mailimf_address_list_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+int mailimf_mailbox_list_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
+ mailimf_header_string_write writes a header value and fold the header
+int mailimf_header_string_write_driver(int (* do_write)(void *, const char *, size_t), void * data,
@@ -0,0 +1,143 @@
+ * $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
+#include <libetpan/mmapstring.h>
+ mailimf_string_write_mem appends a string to a given string
+ @param f is the string
+int mailimf_string_write_mem(MMAPString * f, int * col,
+ mailimf_fields_write_mem appends the fields to a given string
+int mailimf_fields_write_mem(MMAPString * f, int * col,
+ mailimf_envelope_fields_write_mem appends some fields to a given string
+int mailimf_envelope_fields_write_mem(MMAPString * f, int * col,
+ mailimf_field_write_mem appends a field to a given string
+int mailimf_field_write_mem(MMAPString * f, int * col,
+ mailimf_quoted_string_write_mem appends a string that is quoted
+ to a given string
+int mailimf_quoted_string_write_mem(MMAPString * f, int * col,
+int mailimf_address_list_write_mem(MMAPString * f, int * col,
+int mailimf_mailbox_list_write_mem(MMAPString * f, int * col,
+ mailimf_header_string_write_mem appends a header value and fold the header
+int mailimf_header_string_write_mem(MMAPString * f, int * col,
+ * $Id: maillock.h,v 1.5 2004/11/21 21:53:31 hoa Exp $
+#ifndef MAILLOCK_H
+#define MAILLOCK_H
+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);
@@ -0,0 +1,144 @@
+ * $Id: mailmbox.h,v 1.19 2004/11/21 21:53:38 hoa Exp $
+#ifndef MAILMBOX_H
+#define MAILMBOX_H
+#include <libetpan/mailmbox_types.h>
+mailmbox_append_message_list(struct mailmbox_folder * folder,
+ carray * append_tab);
+mailmbox_append_message(struct mailmbox_folder * folder,
+ const char * data, size_t len);
+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,
+int mailmbox_fetch_msg_headers(struct mailmbox_folder * folder,
+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,
+ 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,
+int mailmbox_fetch_msg_headers_no_lock(struct mailmbox_folder * folder,
+/* append message */
+mailmbox_append_message_list_no_lock(struct mailmbox_folder * folder,
+int mailmbox_expunge_no_lock(struct mailmbox_folder * folder);
+ * $Id: mailmbox_types.h,v 1.27 2006/05/22 13:39:42 hoa Exp $
+#ifndef MAILMBOX_TYPES_H
+#define MAILMBOX_TYPES_H
+ 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_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,
+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);
@@ -0,0 +1,379 @@
+ * $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
+ mailmessage_new
+ This function will initializes a new empty message.
+ @return a new empty message will be returned.
+mailmessage * mailmessage_new(void);
+ mailmessage_free
+ This function will release the memory used by this message.
+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.
+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.
+ on error. We can assume that MAIL_NO_ERROR is always returned.
+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.
+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.
+int mailmessage_fetch_result_free(mailmessage * msg_info,
+ 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).
+ on error.
+int mailmessage_fetch(mailmessage * msg_info,
+ mailmessage_fetch_header
+ This function returns the header of the message as a string.
+ @param result The header of the message is returned in (* result)
+int mailmessage_fetch_header(mailmessage * msg_info,
+ mailmessage_fetch_body
+ This function returns the content of the message (without headers).
+ @param result The message text (without headers) is returned
+int mailmessage_fetch_body(mailmessage * msg_info,
+ mailmessage_fetch_size
+ This function returns the size of the message content.
+ @param result The length of the message content is stored in (* result).
+int mailmessage_fetch_size(mailmessage * msg_info,
+ 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 result The MIME structure is stored in (* result).
+int mailmessage_get_bodystructure(mailmessage * msg_info,
+ mailmessage_fetch_section
+ This function returns the content of a MIME part.
+ @param mime is the MIME part identifier.
+ @param result The content is returned in (* result)
+int mailmessage_fetch_section(mailmessage * msg_info,
+ mailmessage_fetch_section_header
+ This function returns the header of the message contained
+ in the given MIME part.
+ @param result The header is returned in (* result)
+int mailmessage_fetch_section_header(mailmessage * msg_info,
+ mailmessage_fetch_section_mime
+ This function returns the MIME header of the given MIME part.
+ @param result The MIME header is returned in (* result)
+int mailmessage_fetch_section_mime(mailmessage * msg_info,
+ mailmessage_fetch_section_body
+ This function returns the text part of the message contained
+ @param result The message text is returned in (* result)
+int mailmessage_fetch_section_body(mailmessage * msg_info,
+ 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 result The headers list is returned in (* result)
+int mailmessage_fetch_envelope(mailmessage * msg_info,
+ mailmessage_get_flags
+ This function returns the flags related to the message.
+ mailmessage_free().
+ @param result The flags are stored in (* result).
+int mailmessage_get_flags(mailmessage * msg_info,
+ 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.
+void mailmessage_resolve_single_fields(mailmessage * msg_info);
@@ -0,0 +1,50 @@
+ * $Id: mailmessage_types.h,v 1.9 2004/11/21 21:53:35 hoa Exp $
+#ifndef MAILMESSAGE_TYPES_H
+#define MAILMESSAGE_TYPES_H
@@ -0,0 +1,147 @@
+ * $Id: mailmh.h,v 1.27 2008/02/20 22:15:52 hoa Exp $
+#ifndef MAILMH_H
+#define MAILMH_H
+ 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;
+ 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,
+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,
+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,
+ uint32_t * pindex);
+int mailmh_folder_add_message(struct mailmh_folder * folder,
+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,
+int mailmh_folder_move_message(struct mailmh_folder * dest_folder,
+ struct mailmh_folder * src_folder,
+int mailmh_folder_update(struct mailmh_folder * folder);
+unsigned int mailmh_folder_get_message_number(struct mailmh_folder * folder);
@@ -0,0 +1,118 @@
+ * $Id: mailmime.h,v 1.18 2011/01/06 00:09:52 hoa Exp $
+#ifndef MAILMIME_H
+#define MAILMIME_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>
+int mailmime_content_parse(const char * message, size_t length,
+ struct mailmime_content ** result);
+int mailmime_description_parse(const char * message, size_t length,
+int mailmime_location_parse(const char * message, size_t length,
+int mailmime_encoding_parse(const char * message, size_t length,
+ struct mailmime_mechanism ** result);
+mailmime_field_parse(struct mailimf_optional_field * field,
+ struct mailmime_field ** result);
+int mailmime_id_parse(const char * message, size_t length,
+mailmime_fields_parse(struct mailimf_fields *
+ fields,
+ struct mailmime_fields **
+ result);
+int mailmime_version_parse(const char * message, size_t length,
+mailmime_extension_token_parse(const char * message, size_t length,
+int mailmime_parameter_parse(const char * message, size_t length,
+ struct mailmime_parameter ** result);
+int mailmime_value_parse(const char * message, size_t length,
+int mailmime_language_parse(const char * message, size_t length,
+ struct mailmime_language ** result);
@@ -0,0 +1,173 @@
+ * $Id: mailmime_content.h,v 1.16 2008/02/20 22:15:52 hoa Exp $
+#ifndef MAILMIME_CONTENT_H
+#define MAILMIME_CONTENT_H
+char * mailmime_content_charset_get(struct mailmime_content * content);
+char * mailmime_content_param_get(struct mailmime_content * content,
+ char * name);
+int mailmime_parse(const char * message, size_t length,
+ size_t * indx, struct mailmime ** result);
+int mailmime_get_section(struct mailmime * mime,
+ struct mailmime_section * section,
+char * mailmime_extract_boundary(struct mailmime_content * content_type);
+/* decode */
+int mailmime_base64_body_parse(const char * message, size_t length,
+int mailmime_quoted_printable_body_parse(const char * message, size_t length,
+ size_t * result_len, int in_header);
+int mailmime_binary_body_parse(const char * message, size_t length,
+ 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
+int mailmime_part_parse(const char * message, size_t length,
+ 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.
+ Example Usage:
+ 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
+ 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);
+ else {
+ 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;
+int mailmime_part_parse_partial(const char * message, size_t length,
+int mailmime_get_section_id(struct mailmime * mime,
+ struct mailmime_section ** result);
+ * $Id: mailmime_decode.h,v 1.14 2008/02/20 22:15:52 hoa Exp $
+#ifndef MAILMIME_DECODE_H
+#define MAILMIME_DECODE_H
+int mailmime_encoded_phrase_parse(const char * default_fromcode,
+ const char * message, size_t length,
+ size_t * indx, const char * tocode,
+mailmime_encoded_word_parse(const char * message, size_t length,
+ struct mailmime_encoded_word ** result,
+ int * p_has_fwd, int * p_missing_closing_quote);
+ * $Id: mailmime_disposition.h,v 1.11 2008/02/20 22:15:52 hoa Exp $
+#ifndef MAILMIME_DISPOSITION_H
+#define MAILMIME_DISPOSITION_H
+int mailmime_disposition_parse(const char * message, size_t length,
+ struct mailmime_disposition ** result);
+mailmime_disposition_type_parse(const char * message, size_t length,
+ struct mailmime_disposition_type ** result);
+int mailmime_disposition_guess_type(const char * message, size_t length,
+ size_t indx);
@@ -0,0 +1,503 @@
+ * $Id: mailmime_types.h,v 1.33 2011/01/06 00:09:52 hoa Exp $
+#ifndef MAILMIME_TYPES_H
+#define MAILMIME_TYPES_H
+ 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 *) */
+ 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;
+ 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 {
+ 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;
+ 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 {
+ char * enc_token;
+struct mailmime_fields {
+ clist * fld_list; /* list of (struct mailmime_field *) */
+struct mailmime_parameter {
+ char * pa_name;
+ char * pa_value;
+ MAILMIME_TYPE_ERROR,
+ MAILMIME_TYPE_DISCRETE_TYPE,
+ MAILMIME_TYPE_COMPOSITE_TYPE
+struct mailmime_type {
+ int tp_type;
+ struct mailmime_discrete_type * tp_discrete_type;
+ struct mailmime_composite_type * tp_composite_type;
+ } tp_data;
+void mailmime_attribute_free(char * attribute);
+struct mailmime_composite_type *
+mailmime_composite_type_new(int ct_type, char * ct_token);
+void mailmime_composite_type_free(struct mailmime_composite_type * ct);
+struct mailmime_content *
+mailmime_content_new(struct mailmime_type * ct_type,
+ char * ct_subtype,
+ clist * ct_parameters);
+void mailmime_content_free(struct mailmime_content * content);
+void mailmime_description_free(char * description);
+void mailmime_location_free(char * location);
+struct mailmime_discrete_type *
+mailmime_discrete_type_new(int dt_type, char * dt_extension);
+void mailmime_discrete_type_free(struct mailmime_discrete_type *
+ discrete_type);
+void mailmime_encoding_free(struct mailmime_mechanism * encoding);
+void mailmime_extension_token_free(char * extension);
+void mailmime_id_free(char * id);
+struct mailmime_mechanism * mailmime_mechanism_new(int enc_type, char * enc_token);
+void mailmime_mechanism_free(struct mailmime_mechanism * mechanism);
+struct mailmime_parameter *
+mailmime_parameter_new(char * pa_name, char * pa_value);
+void mailmime_parameter_free(struct mailmime_parameter * parameter);
+void mailmime_subtype_free(char * subtype);
+void mailmime_token_free(char * token);
+struct mailmime_type *
+mailmime_type_new(int tp_type,
+ struct mailmime_discrete_type * tp_discrete_type,
+ struct mailmime_composite_type * tp_composite_type);
+void mailmime_type_free(struct mailmime_type * type);
+void mailmime_value_free(char * value);
+struct mailmime_language {
+ clist * lg_list; /* atom (char *) */
+struct mailmime_language * mailmime_language_new(clist * lg_list);
+void mailmime_language_free(struct mailmime_language * lang);
+void mailmime_x_token_free(gchar * x_token);
+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);
+void mailmime_field_free(struct mailmime_field * field);
+struct mailmime_fields * mailmime_fields_new(clist * fld_list);
+void mailmime_fields_free(struct mailmime_fields * fields);
+struct mailmime_multipart_body {
+ clist * bd_list;
+struct mailmime_multipart_body *
+mailmime_multipart_body_new(clist * bd_list);
+void mailmime_multipart_body_free(struct mailmime_multipart_body * mp_body);
+ MAILMIME_DATA_TEXT,
+ MAILMIME_DATA_FILE
+struct mailmime_data {
+ int dt_encoding;
+ int dt_encoded;
+ const char * dt_data;
+ size_t dt_length;
+ } dt_text;
+ char * dt_filename;
+ } dt_data;
+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);
+void mailmime_data_free(struct mailmime_data * mime_data);
+ 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;
+ /* single part */
+ struct mailmime_data * mm_single; /* XXX - was body */
+ /* multi-part */
+ struct mailmime_data * mm_preamble;
+ struct mailmime_data * mm_epilogue;
+ clist * mm_mp_list;
+ } mm_multipart;
+ /* message */
+ struct mailimf_fields * mm_fields;
+ struct mailmime * mm_msg_mime;
+ } mm_message;
+ } mm_data;
+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);
+void mailmime_free(struct mailmime * mime);
+struct mailmime_encoded_word {
+ char * wd_charset;
+ char * wd_text;
+struct mailmime_encoded_word *
+mailmime_encoded_word_new(char * wd_charset, char * wd_text);
+void mailmime_encoded_word_free(struct mailmime_encoded_word * ew);
+void mailmime_charset_free(char * charset);
+void mailmime_encoded_text_free(char * text);
+struct mailmime_disposition {
+ struct mailmime_disposition_type * dsp_type;
+ clist * dsp_parms; /* struct mailmime_disposition_parm */
+ 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;
+ 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;
+ 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;
+struct mailmime_disposition *
+mailmime_disposition_new(struct mailmime_disposition_type * dsp_type,
+ clist * dsp_parms);
+void mailmime_disposition_free(struct mailmime_disposition * dsp);
+struct mailmime_disposition_type *
+mailmime_disposition_type_new(int dt_type, char * dt_extension);
+void mailmime_disposition_type_free(struct mailmime_disposition_type * dsp_type);
+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);
+void mailmime_disposition_parm_free(struct mailmime_disposition_parm *
+ dsp_parm);
+void mailmime_filename_parm_free(char * filename);
+void mailmime_creation_date_parm_free(char * date);
+void mailmime_modification_date_parm_free(char * date);
+void mailmime_read_date_parm_free(char * date);
+void mailmime_quoted_date_time_free(char * date);
+struct mailmime_section {
+ clist * sec_list; /* list of (uint32 *) */
+struct mailmime_section * mailmime_section_new(clist * list);
+void mailmime_section_free(struct mailmime_section * section);
+void mailmime_decoded_part_free(char * part);
+struct mailmime_single_fields {
+ char * fld_content_charset;
+ char * fld_content_boundary;
+ char * fld_content_name;
+ char * fld_disposition_filename;
+ char * fld_disposition_creation_date;
+ char * fld_disposition_modification_date;
+ char * fld_disposition_read_date;
+ size_t fld_disposition_size;
@@ -0,0 +1,204 @@
+ * $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
+int mailmime_transfer_encoding_get(struct mailmime_fields * fields);
+mailmime_disposition_new_filename(int type, char * filename);
+struct mailmime_fields * mailmime_fields_new_empty(void);
+int mailmime_fields_add(struct mailmime_fields * fields,
+ struct mailmime_field * field);
+struct mailmime_fields *
+mailmime_fields_new_with_data(struct mailmime_mechanism * encoding,
+ char * id,
+ char * description,
+ struct mailmime_disposition * disposition,
+ struct mailmime_language * language);
+mailmime_fields_new_with_version(struct mailmime_mechanism * encoding,
+struct mailmime_content * mailmime_get_content_message(void);
+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
+struct mailmime_data *
+mailmime_data_new_data(int encoding, int encoded,
+ const char * data, size_t length);
+mailmime_data_new_file(int encoding, int encoded,
+ char * filename);
+struct mailmime *
+mailmime_new_message_file(char * filename);
+mailmime_new_message_text(char * data_str, size_t length);
+mailmime_new_message_data(struct mailmime * msg_mime);
+mailmime_new_empty(struct mailmime_content * content,
+ struct mailmime_fields * mime_fields);
+mailmime_new_with_content(const char * content_type,
+ struct mailmime_fields * mime_fields,
+int mailmime_set_preamble_file(struct mailmime * build_info,
+int mailmime_set_epilogue_file(struct mailmime * build_info,
+int mailmime_set_preamble_text(struct mailmime * build_info,
+ char * data_str, size_t length);
+int mailmime_set_epilogue_text(struct mailmime * build_info,
+int mailmime_set_body_file(struct mailmime * build_info,
+int mailmime_set_body_text(struct mailmime * build_info,
+int mailmime_add_part(struct mailmime * build_info,
+ struct mailmime * part);
+void mailmime_remove_part(struct mailmime * mime);
+void mailmime_set_imf_fields(struct mailmime * build_info,
+mailmime_disposition_new_with_data(int type,
+ char * filename, char * creation_date, char * modification_date,
+ char * read_date, size_t size);
+void mailmime_single_fields_init(struct mailmime_single_fields * single_fields,
+ struct mailmime_fields * fld_fields,
+ struct mailmime_content * fld_content);
+struct mailmime_single_fields *
+mailmime_single_fields_new(struct mailmime_fields * fld_fields,
+void mailmime_single_fields_free(struct mailmime_single_fields *
+int mailmime_smart_add_part(struct mailmime * mime,
+ struct mailmime * mime_sub);
+int mailmime_smart_remove_part(struct mailmime * mime);
+struct mailmime_content * mailmime_content_new_with_str(const char * str);
+struct mailmime_fields * mailmime_fields_new_encoding(int type);
+struct mailmime * mailmime_multiple_new(const char * type);
+struct mailmime_fields * mailmime_fields_new_filename(int dsp_type,
+ char * filename, int encoding_type);
+mailmime_param_new_with_data(char * name, char * value);
+char * mailmime_generate_boundary(void);
+ * $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
+#define MAILMIME_WRITE_COMPATIBILITY
+int mailmime_fields_write_file(FILE * f, int * col,
+ struct mailmime_fields * fields);
+int mailmime_content_write_file(FILE * f, int * col,
+ struct mailmime_content * content);
+int mailmime_content_type_write_file(FILE * f, int * col,
+int mailmime_write_file(FILE * f, int * col,
+ struct mailmime * build_info);
+int mailmime_quoted_printable_write_file(FILE * f, int * col, int istext,
+ const char * text, size_t size);
+int mailmime_base64_write_file(FILE * f, int * col,
+int mailmime_data_write_file(FILE * f, int * col,
+ struct mailmime_data * data,
+ int istext);
+#ifdef MAILMIME_WRITE_COMPATIBILITY
+int mailmime_fields_write(FILE * f, int * col,
+int mailmime_content_write(FILE * f, int * col,
+int mailmime_content_type_write(FILE * f, int * col,
+int mailmime_write(FILE * f, int * col,
+int mailmime_quoted_printable_write(FILE * f, int * col, int istext,
+int mailmime_base64_write(FILE * f, int * col,
+int mailmime_data_write(FILE * f, int * col,
@@ -0,0 +1,73 @@
+ * $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
+int mailmime_fields_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+int mailmime_content_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+int mailmime_content_type_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+int mailmime_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+int mailmime_quoted_printable_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col, int istext,
+int mailmime_base64_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+int mailmime_data_write_driver(int (* do_write)(void *, const char *, size_t), void * data, int * col,
+ struct mailmime_data * mime_data,
+ * $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
+int mailmime_fields_write_mem(MMAPString * f, int * col,
+int mailmime_content_write_mem(MMAPString * f, int * col,
+int mailmime_content_type_write_mem(MMAPString * f, int * col,
+int mailmime_write_mem(MMAPString * f, int * col,
+int mailmime_quoted_printable_write_mem(MMAPString * f, int * col, int istext,
+int mailmime_base64_write_mem(MMAPString * f, int * col,
+int mailmime_data_write_mem(MMAPString * f, int * col,
+ * $Id: mailpop3.h,v 1.19 2010/04/05 12:56:44 hoa Exp $
+#ifndef MAILPOP3_H
+#define MAILPOP3_H
+#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
+mailpop3 * mailpop3_new(size_t pop3_progr_rate,
+ progress_function * pop3_progr_fun);
+void mailpop3_free(mailpop3 * f);
+void mailpop3_set_timeout(mailpop3 * f, time_t timeout);
+time_t mailpop3_get_timeout(mailpop3 * f);
+void mailpop3_set_progress_callback(mailpop3 * f, mailprogress_function * progr_fun, void * context);
+int mailpop3_connect(mailpop3 * f, mailstream * s);
+int mailpop3_quit(mailpop3 * f);
+int mailpop3_apop(mailpop3 * f, const char * user, const char * password);
+int mailpop3_user(mailpop3 * f, const char * user);
+int mailpop3_pass(mailpop3 * f, const char * password);
+int mailpop3_list(mailpop3 * f, carray ** result);
+int mailpop3_retr(mailpop3 * f, unsigned int indx, char ** result,
+int mailpop3_top(mailpop3 * f, unsigned int indx,
+ unsigned int count, char ** result,
+int mailpop3_dele(mailpop3 * f, unsigned int indx);
+int mailpop3_noop(mailpop3 * f);
+int mailpop3_rset(mailpop3 * f);
+void mailpop3_top_free(char * str);
+void mailpop3_retr_free(char * str);
+int mailpop3_get_msg_info(mailpop3 * f, unsigned int indx,
+ struct mailpop3_msg_info ** result);
+int mailpop3_capa(mailpop3 * f, clist ** result);
+void mailpop3_capa_resp_free(clist * capa_list);
+int mailpop3_stat(mailpop3 * f, struct mailpop3_stat_response ** result);
+void mailpop3_stat_resp_free(struct mailpop3_stat_response * stat_result);
+int mailpop3_stls(mailpop3 * f);
+int mailpop3_auth(mailpop3 * f, const char * auth_type,
+void mailpop3_set_logger(mailpop3 * session, void (* logger)(mailpop3 * session, int log_type,
+ * $Id: mailpop3_helper.h,v 1.9 2008/02/20 22:15:53 hoa Exp $
+#ifndef MAILPOP3_HELPER_H
+#define MAILPOP3_HELPER_H
+#include "mailpop3.h"
+int mailpop3_login_apop(mailpop3 * f,
+ const char * user,
+ const char * password);
+int mailpop3_login(mailpop3 * f,
+int mailpop3_header(mailpop3 * f, uint32_t indx, char ** result,
+void mailpop3_header_free(char * str);
+ * $Id: mailpop3_socket.h,v 1.16 2006/12/26 13:13:24 hoa Exp $
+#ifndef MAILPOP3_SOCKET_H
+#define MAILPOP3_SOCKET_H
+int mailpop3_socket_connect(mailpop3 * f, const char * server, uint16_t port);
+int mailpop3_socket_starttls(mailpop3 * f);
+int mailpop3_socket_starttls_with_callback(mailpop3 * f,
@@ -0,0 +1,61 @@
+ * $Id: mailpop3_ssl.h,v 1.17 2006/12/26 13:13:24 hoa Exp $
+#ifndef MAILPOP3_SSL_H
+#define MAILPOP3_SSL_H
+int mailpop3_ssl_connect(mailpop3 * f, const char * server, uint16_t port);
+int mailpop3_ssl_connect_with_callback(mailpop3 * f, const char * server, uint16_t port,
@@ -0,0 +1,131 @@
+ * $Id: mailpop3_types.h,v 1.19 2006/12/13 18:31:33 hoa Exp $
+#ifndef MAILPOP3_TYPES_H
+#define MAILPOP3_TYPES_H
+ 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 */
+ 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;
+ } 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
+ uint32_t msg_size;
+ char * msg_uidl;
+struct mailpop3_capa {
+ char * cap_name;
+ clist * cap_param; /* (char *) */
+struct mailpop3_stat_response {
+ unsigned int msgs_count;
+ size_t msgs_size;
@@ -0,0 +1,145 @@
+ * $Id: mailprivacy.h,v 1.6 2007/12/10 21:32:59 hoa Exp $
+#ifndef MAILPRIVACY_H
+#define MAILPRIVACY_H
+#include <libetpan/mailprivacy_tools.h>
+struct mailprivacy * mailprivacy_new(char * tmp_dir, int make_alternative);
+void mailprivacy_free(struct mailprivacy * privacy);
+int mailprivacy_msg_get_bodystructure(struct mailprivacy * privacy,
+ mailmessage * msg_info,
+void mailprivacy_msg_flush(struct mailprivacy * privacy,
+ mailmessage * msg_info);
+int mailprivacy_msg_fetch_section(struct mailprivacy * privacy,
+int mailprivacy_msg_fetch_section_header(struct mailprivacy * privacy,
+int mailprivacy_msg_fetch_section_mime(struct mailprivacy * privacy,
+int mailprivacy_msg_fetch_section_body(struct mailprivacy * privacy,
+void mailprivacy_msg_fetch_result_free(struct mailprivacy * privacy,
+int mailprivacy_msg_fetch(struct mailprivacy * privacy,
+int mailprivacy_msg_fetch_header(struct mailprivacy * privacy,
+int mailprivacy_register(struct mailprivacy * privacy,
+ struct mailprivacy_protocol * protocol);
+void mailprivacy_unregister(struct mailprivacy * privacy,
+char * mailprivacy_get_encryption_name(struct mailprivacy * privacy,
+ char * privacy_driver, char * privacy_encryption);
+/* deprecated */
+int mailprivacy_encrypt(struct mailprivacy * privacy,
+ char * privacy_driver, char * privacy_encryption,
+/* introduced the use of passphrase */
+int mailprivacy_encrypt_msg(struct mailprivacy * privacy,
+ mailmessage * msg,
+void mailprivacy_debug(struct mailprivacy * privacy, FILE * f);
+carray * mailprivacy_get_protocols(struct mailprivacy * privacy);
+int mailprivacy_is_encrypted(struct mailprivacy * privacy,
+ struct mailmime * mime);
+void mailprivacy_recursive_unregister_mime(struct mailprivacy * privacy,
+ * etPan! -- a mail user agent
+ * $Id: mailprivacy_gnupg.h,v 1.5 2007/10/30 00:40:39 hoa Exp $
+#ifndef MAIL_PRIVACY_GNUPG_H
+#define MAIL_PRIVACY_GNUPG_H
+int mailprivacy_gnupg_init(struct mailprivacy * privacy);
+void mailprivacy_gnupg_done(struct mailprivacy * privacy);
+clist * mailprivacy_gnupg_encryption_id_list(struct mailprivacy * privacy,
+void mailprivacy_gnupg_encryption_id_list_clear(struct mailprivacy * privacy,
+int mailprivacy_gnupg_set_encryption_id(struct mailprivacy * privacy,
+ char * user_id, char * passphrase);
@@ -0,0 +1,104 @@
+ * $Id: mailprivacy_smime.h,v 1.5 2007/10/30 00:40:39 hoa Exp $
+#ifndef MAILPRIVACY_SMIME_H
+#define MAILPRIVACY_SMIME_H
+int mailprivacy_smime_init(struct mailprivacy * privacy);
+void mailprivacy_smime_done(struct mailprivacy * privacy);
+void mailprivacy_smime_set_cert_dir(struct mailprivacy * privacy,
+ char * directory);
+ set directory where certificates of authority certifications are
+ stored.
+void mailprivacy_smime_set_CA_dir(struct mailprivacy * privacy,
+ to disable the verification of signers certificates of a
+ signed message.
+void mailprivacy_smime_set_CA_check(struct mailprivacy * privacy,
+ int enabled);
+ to store certificates of signed messages
+void mailprivacy_smime_set_store_cert(struct mailprivacy * privacy,
+ set directory where private keys are stored.
+ name of the files in that directory must be in form :
+ [email-address]-private-key.pem
+void mailprivacy_smime_set_private_keys_dir(struct mailprivacy * privacy,
+clist * mailprivacy_smime_encryption_id_list(struct mailprivacy * privacy,
+void mailprivacy_smime_encryption_id_list_clear(struct mailprivacy * privacy,
+int mailprivacy_smime_set_encryption_id(struct mailprivacy * privacy,
+ * $Id: mailprivacy_tools.h,v 1.7 2007/12/10 21:32:59 hoa Exp $
+#ifndef MAIL_PRIVACY_TOOLS_H
+#define MAIL_PRIVACY_TOOLS_H
+void mailprivacy_mime_clear(struct mailmime * mime);
+FILE * mailprivacy_get_tmp_file(struct mailprivacy * privacy,
+ char * filename, size_t size);
+int mailprivacy_get_tmp_filename(struct mailprivacy * privacy,
+mailprivacy_new_file_part(struct mailprivacy * privacy,
+ char * filename,
+ char * default_content_type, int default_encoding);
+int mailmime_substitute(struct mailmime * old_mime,
+ struct mailmime * new_mime);
+int mailprivacy_fetch_mime_body_to_file(struct mailprivacy * privacy,
+ char * filename, size_t size,
+ mailmessage * msg, struct mailmime * mime);
+int mailprivacy_get_part_from_file(struct mailprivacy * privacy,
+ int check_privacy, int reencode,
+ struct mailmime ** result_mime);
+int mail_quote_filename(char * result, size_t size, char * path);
+void mailprivacy_prepare_mime(struct mailmime * mime);
+char * mailprivacy_dup_imf_file(struct mailprivacy * privacy,
+ char * source_filename);
+mailprivacy_mime_fields_dup(struct mailprivacy * privacy,
+mailmime_parameter_dup(struct mailmime_parameter * param);
+mailmime_composite_type_dup(struct mailmime_composite_type * composite_type);
+mailmime_discrete_type_dup(struct mailmime_discrete_type * discrete_type);
+struct mailmime_type * mailmime_type_dup(struct mailmime_type * type);
+mailmime_content_dup(struct mailmime_content * content);
+int mailprivacy_fetch_decoded_to_file(struct mailprivacy * privacy,
+int mailprivacy_get_mime(struct mailprivacy * privacy,
+ char * content, size_t content_len,