Compare commits

...

133 Commits

Author SHA1 Message Date
  Dirk Zimmermann 3974a1f55a ENGINE-2 update cached autgen-result 3 years ago
  Krista Bennett f9ca0c658d Merged in original libetpan branch 3 years ago
  Krista Bennett 731cd029e1 Some gitignore stuff 3 years ago
  Firstname Lastname d2b340bd57 Fix NULL pointer dereference in mailimap_flag_list_free(). (#290) 4 years ago
  Yuri 3f77ed4d97 Build libetpan for Android with iconv by default (#289) 4 years ago
  Hoà V. DINH 88b11df954
Merge pull request #284 from markusbeth/openssl11 4 years ago
  Markus Beth f45dff1271 changes for OpenSSL 1.1.0 4 years ago
  Hoà V. DINH 900c0d565a Merge pull request #281 from itsPG/master 4 years ago
  PG Tsai d5d46b8d44 Fixed memoery leak in mailimap_acl_myrights 4 years ago
  Hoà V. DINH 683eb8891e Merge pull request #279 from shuhaodo/master 4 years ago
  Hoà V. DINH caa81edac6 Merge pull request #279 from shuhaodo/master 4 years ago
  Shuhao Zhang 0413d6dedb #275 remove 'system()' call on iOS 4 years ago
  Hoà V. DINH cc670add8e Merge pull request #278 from loomy/master 4 years ago
  Matthias Lay c788f6066c lmtp on local socket: fix socketpath checks 4 years ago
  Hoà V. DINH 3b8b5775ec Merge pull request #277 from pinotree/fix-getopt_long 4 years ago
  Pino Toscano a6c1ca0c85 Add empty element at end for getopt_long options 4 years ago
  Viet Hoa Dinh fcbe81e025 libetpan 1.8 5 years ago
  Viet Hoa Dinh 1fe8fbc032 Fixed crash #274 5 years ago
  Hoà V. DINH d4244c326e Merge pull request #273 from loomy/feature-lmtp 5 years ago
  Matthias Lay e2742e5e8c * dont alloc the +1 5 years ago
  Matthias Lay d62dfd9131 * make retcodes a standard int-array. still optional. 5 years ago
  Matthias Lay 3f184b241c LMTP: 5 years ago
  Matthias Lay 07296ae285 add local socket connect. if server-addr starts with '/' 5 years ago
  Matthias Lay 066daa8242 first version of lmtp 5 years ago
  Hoà V. DINH 5164ba2ebd Merge pull request #272 from eesheesh/master 5 years ago
  Liron Newman 618d82e6ad Generate PDBs for Release libetpan.dll too 5 years ago
  Hoà V. DINH e5e1e2ee9d Merge pull request #270 from eesheesh/master 5 years ago
  eesheesh 9b93e7fdea Add XOAUTH2 support in readmsg and other test binaries 5 years ago
  Hoà V. DINH 197e871629 Merge pull request #266 from serjepatoff/xgmraw-literalplus 5 years ago
  Sergei Epatov 9e9baafb59 Gmail xgmraw literalplus support (i18n search) 5 years ago
  Hoa V. DINH 644e6de905 Cyrus 2.1.26 5 years ago
  Hoa V. DINH f2d9aef954 Compatibility with NDK 13 5 years ago
  Hoà V. DINH 07508b7e44 Merge pull request #262 from mones/fix-256 5 years ago
  Ricardo Mones bd46e10c4b Fix #256: support micro version 5 years ago
  Hoà V. DINH 9c20666748 Merge pull request #260 from disaykin/master 5 years ago
  Dmitry Isaikin d86ad2f095 Add workaround for QIP IMAP server. This server returns non-expected response to storeFlags command. 5 years ago
  Hoà V. DINH d9977879a1 Merge pull request #255 from DarovskikhAndrei/master 5 years ago
  DarovskikhAndrei 6bf5a6e048 rename vars fd -> cancellation_fd 5 years ago
  DarovskikhAndrei 23b8e8d2f6 error status check in wait_connect (return -1 if socket is possible for write) 5 years ago
  Viet Hoa Dinh 4c36ec1850 Fixed crash with IDLE 5 years ago
  Hoà V. DINH cc1932c7ca Merge pull request #253 from disaykin/fetch-message-to-file 5 years ago
  Dmitry Isaikin 3fb26a02f2 Add possibility for downloading big IMAP attachments to a file 5 years ago
  Hoa V. DINH 77f3cdaabb Fixed memory leak (fixed #251) 5 years ago
  Hoa V. DINH 86eb55f11e Fixed so name again 5 years ago
  Hoa V. DINH d5a76eed8f bump api compatibility 5 years ago
  Hoà V. DINH 14a4226adf Merge pull request #248 from jeremiegirault/fix/header-source-inconsisteny 6 years ago
  jeremiegirault 1594ccd08d fixes header source inconsistency when using the NO_MACRO preprocessor flag 6 years ago
  Hoà V. DINH 6df668bcdf Merge pull request #246 from danieljakots/master 6 years ago
  Daniel Jakots a8d2f24350 fix 64 bits time_t issues 6 years ago
  Hoà V. DINH 0d17b6803d Merge pull request #243 from DarovskikhAndrei/master 6 years ago
  DarovskikhAndrei 33bcef0876 Build Fix 6 years ago
  DarovskikhAndrei e8cda2e487 Build Fix 6 years ago
  DarovskikhAndrei 9b9d707ebe Review fix 6 years ago
  DarovskikhAndrei 25713dd657 Review Fix 6 years ago
  DarovskikhAndrei c9aa58d7b0 BuildFix 6 years ago
  DarovskikhAndrei ffcf0e5a6b Review Fix 6 years ago
  DarovskikhAndrei 4f575cf919 Merge branch 'master' of https://github.com/DarovskikhAndrei/libetpan 6 years ago
  DarovskikhAndrei a7e10fa07f BuildFix 6 years ago
  DarovskikhAndrei ceb3047e94 add flag --with-poll for configure 6 years ago
  Hoa V. DINH b18a96ea2c android build version 4 6 years ago
  DarovskikhAndrei 9914e88394 Merge branch 'master' of https://github.com/DarovskikhAndrei/libetpan 6 years ago
  DarovskikhAndrei e6c8527cff Use poll() instead of select() for check connection status 6 years ago
  DarovskikhAndrei 2b8b8ab264 Use poll() instead of select() for check connection status 6 years ago
  DarovskikhAndrei 40ddbc50a4 fix windows config 6 years ago
  DarovskikhAndrei eb0e9f5d15 Merge branch 'master' of https://github.com/DarovskikhAndrei/libetpan 6 years ago
  DarovskikhAndrei 7c0de8f6c1 optional USE_POLL 6 years ago
  DarovskikhAndrei fee101313d optional USE_POLL 6 years ago
  Hoà V. DINH ab9dd79ec7 Merge pull request #240 from disaykin/master 6 years ago
  Dmitry Isaikin fdb35be01f Workaround issue with Rambler IMAP provider. 6 years ago
  DarovskikhAndrei c6bf020ba1 use the poll for check state of the socket instead of select. 6 years ago
  Hoà V. DINH 49c9f8c759 Merge pull request #241 from danieljakots/master 6 years ago
  Daniel Jakots 61d711536d fix typo in return code 6 years ago
  Viet Hoa Dinh da697653ce libetpan 1.7 6 years ago
  Hoà V. DINH e2105da822 Merge pull request #237 from AlexKar/master 6 years ago
  Alexander Karimov b8216b56ea Refactor mailesmtp_send functions to remove duplicated code 6 years ago
  Alexander Karimov a6bca771da Added mailsmtp_data_message_quit_no_disconnect interface 6 years ago
  Hoà V. DINH 91d6195f32 Merge pull request #235 from seaburg/master 6 years ago
  Hoa V. DINH de603c172e #225: Parse this: Tue Feb 16 2016 17:23:34 GMT+0800 6 years ago
  Hoa V. DINH 151b63de00 Fixed config build for Mac/iOS 6 years ago
  Evgeniy Yurtaev 9af139beda Add checking state of stream 6 years ago
  Viet Hoa Dinh 76c0e0ab8e Show log file if build fails 6 years ago
  Hoà V. DINH aee8fdc2fa Merge pull request #232 from avsej/master 6 years ago
  Sergey Avseyev fb308a269b Fix build on OpenIndiana 6 years ago
  Hoà V. DINH 3cfa5d17dd Merge pull request #231 from tg--/patch-1 6 years ago
  thomasg 3f3882b587 add support for berkely db-6.0 6 years ago
  Hoà V. DINH f1b7dfb2b3 Merge pull request #230 from eworm-de/openssl-method 6 years ago
  Christian Hesse 7f1f97f4d5 Negotiate highest available SSL/TLS version 6 years ago
  Hoà V. DINH 72d04344d1 Merge pull request #229 from eworm-de/gitignore 6 years ago
  Christian Hesse 55c5104d29 add compile script to .gitignore 6 years ago
  Hoà V. DINH 95b4e56f4c Merge pull request #227 from eworm-de/configure 6 years ago
  Hoa V. DINH 43df0309f4 fixed expat / curl detection 6 years ago
  Christian Hesse 2a34324e7e use AC_HELP_STRING for clean formatting in ./configure --help 6 years ago
  Hoa V. DINH 0f088343f6 SMTP OAuth2 is private 6 years ago
  Hoa V. DINH ec9f34abdc More logs when configure fails 6 years ago
  Hoa V. DINH f02538c966 Fixed build for linux 6 years ago
  Hoa V. DINH 91c91a4ce8 Disable proxy for iOS 6 years ago
  Viet Hoa Dinh 13d0ef1e88 Fixed proxy settings 6 years ago
  Hoa V. DINH 1206260410 Support for SOCKS proxy 6 years ago
  Hoà V. DINH 3af17cfa4e Merge pull request #224 from disaykin/partial-decoding 6 years ago
  Dmitry Isaikin f4140b8c25 Add support for parsing of incomplete base64 and quoted-printable MIME parts. 6 years ago
  Hoà V. DINH fae701a7cf Merge pull request #222 from kolyuchiy/imap-move 6 years ago
  Hoà V. DINH 4066986585 Merge pull request #223 from kolyuchiy/fix-tests-linking 6 years ago
  Nikolay Morev 9912eaaaa4 Add support for IMAP MOVE command 6 years ago
  Nikolay Morev 09e9251115 Fix building test targets in Xcode 6 years ago
  Hoa V. DINH 7e3b9379e7 Fixed crash (#219) 6 years ago
  Hoa V. DINH 15c854d801 Merged #211: Improvement to support wrong MIME encoding which breaks a character into 2 words 6 years ago
  Hoà V. DINH ea2a8fe616 Merge pull request #218 from chunga/master 6 years ago
  Michele Ballabio 20bd31a238 Fix number of brackets 6 years ago
  Michele Ballabio 92d58e7826 Remove some warnings 6 years ago
  Michele Ballabio 1bd0daeffe Remove some warnings 6 years ago
  Michele Ballabio efe2704762 Fix other warnings 6 years ago
  Michele Ballabio 3b14a627dd Remove some other warnings 6 years ago
  Michele Ballabio a4dd78e5ad Reformat code to be easier on the eye 6 years ago
  Michele Ballabio 45dd01361d Remove commented out code 6 years ago
  Michele Ballabio c1381cb87d Get rid of some compiler warnings (set but not used) 6 years ago
  Hoà V. DINH ffa7513b22 Merge pull request #216 from libec/master 6 years ago
  libec c7a7f0a1b5 Adds space and newline after custom command 6 years ago
  Hoa V. DINH 52f2806b75 Fixed build for linux 6 years ago
  Hoa V. Dinh c0527c7669 Fixed build 6 years ago
  Hoa V. Dinh 49dbfecef2 Namespace for md5 6 years ago
  Hoa V. Dinh f1fba1466a Make it possible to disable bitcode 6 years ago
  Hoa V. Dinh bafc71c93d build on simulator without bitcode support 6 years ago
  Hoà V. DINH f339a588b0 Merge pull request #214 from foxinushka/fix/folders-list-cyon-ch 6 years ago
  Viktor Gedzenko 0af67036ba Added workaround for XLIST on cyon.ch 6 years ago
  Hoà V. DINH b76c4cba7e Merge pull request #212 from yamori813/add_smtp_over_ssl_test 6 years ago
  libec c71ac2c062 added custom command error type 6 years ago
  libec 67677d647d Added custom IMAP command 6 years ago
  Hiroki Mori deb9313ef8 fixed comment 6 years ago
  Hiroki Mori 862e5eff55 add smtp over ssl test 6 years ago
  Hoa V. Dinh 36fd97c0f2 Android build version 2 6 years ago
  Hoa V. Dinh e918f88e31 Build version for Android 6 years ago
  Hoa V. Dinh 0d86cabdf5 Build for Android 16 6 years ago
  Hoa V. Dinh 8315c8d4be Fixed initialization 6 years ago
126 changed files with 3311 additions and 1752 deletions
Split View
  1. +19
    -0
      .gitignore
  2. +2
    -0
      README.md
  3. +1
    -0
      build-android/build.sh
  4. +11
    -5
      build-android/dependencies/cyrus-sasl/build.sh
  5. +4
    -0
      build-android/dependencies/iconv/.gitignore
  6. +26
    -0
      build-android/dependencies/iconv/build-android/jni/Android.mk
  7. +68
    -0
      build-android/dependencies/iconv/build.sh
  8. +86
    -23
      build-android/dependencies/openssl/build.sh
  9. +6
    -0
      build-android/jni/Android.mk
  10. BIN
      build-mac/autogen-result.tar.gz
  11. +11
    -3
      build-mac/dependencies/prepare-cyrus-sasl.sh
  12. +40
    -0
      build-mac/libetpan Tests.xcodeproj/project.pbxproj
  13. +2
    -0
      build-mac/libetpan.xcodeproj/project.pbxproj
  14. +2
    -1
      build-mac/update.sh
  15. +0
    -1
      build-windows/build_headers.list
  16. +4
    -2
      build-windows/libetpan/libetpan.vcxproj
  17. +43
    -27
      configure.ac
  18. +1
    -1
      src/data-types/Makefile.am
  19. +2
    -2
      src/data-types/chash.c
  20. +61
    -3
      src/data-types/connect.c
  21. +4
    -31
      src/data-types/mailstream.c
  22. +32
    -1
      src/data-types/mailstream_cfstream.c
  23. +3
    -0
      src/data-types/mailstream_compress.c
  24. +4
    -1
      src/data-types/mailstream_compress.h
  25. +0
    -10
      src/data-types/mailstream_helper.c
  26. +54
    -3
      src/data-types/mailstream_low.c
  27. +88
    -41
      src/data-types/mailstream_socket.c
  28. +121
    -63
      src/data-types/mailstream_ssl.c
  29. +2
    -0
      src/data-types/md5global.h
  30. +45
    -0
      src/data-types/md5namespace.h
  31. +1
    -3
      src/driver/implementation/db/dbdriver_message.c
  32. +0
    -2
      src/driver/implementation/imap/imapdriver.c
  33. +0
    -5
      src/driver/implementation/imap/imapdriver_cached.c
  34. +1
    -3
      src/driver/implementation/imap/imapdriver_message.c
  35. +0
    -17
      src/driver/implementation/imap/imapdriver_tools.c
  36. +0
    -3
      src/driver/implementation/maildir/maildirdriver.c
  37. +0
    -3
      src/driver/implementation/maildir/maildirdriver_cached.c
  38. +2
    -4
      src/driver/implementation/maildir/maildirdriver_cached_message.c
  39. +1
    -3
      src/driver/implementation/maildir/maildirdriver_message.c
  40. +1
    -3
      src/driver/implementation/mbox/mboxdriver_cached_message.c
  41. +1
    -2
      src/driver/implementation/mh/mhdriver_cached.c
  42. +3
    -5
      src/driver/implementation/mh/mhdriver_cached_message.c
  43. +0
    -3
      src/driver/implementation/nntp/nntpdriver.c
  44. +1
    -3
      src/driver/implementation/nntp/nntpdriver_cached_message.c
  45. +1
    -3
      src/driver/implementation/nntp/nntpstorage.c
  46. +0
    -2
      src/driver/implementation/pop3/pop3driver.c
  47. +1
    -3
      src/driver/implementation/pop3/pop3driver_cached_message.c
  48. +1
    -5
      src/driver/interface/mailmessage_tools.c
  49. +1
    -2
      src/driver/interface/mailstorage.c
  50. +7
    -20
      src/driver/tools/mailthread.c
  51. +1
    -5
      src/engine/mailengine.c
  52. +3
    -17
      src/engine/mailprivacy_gnupg.c
  53. +5
    -9
      src/engine/mailprivacy_smime.c
  54. +6
    -6
      src/engine/mailprivacy_tools.c
  55. +1
    -1
      src/low-level/feed/parser.c
  56. +2
    -0
      src/low-level/imap/acl.c
  57. +21
    -21
      src/low-level/imap/acl_parser.c
  58. +7
    -7
      src/low-level/imap/acl_parser.h
  59. +26
    -26
      src/low-level/imap/annotatemore_parser.c
  60. +9
    -9
      src/low-level/imap/annotatemore_parser.h
  61. +21
    -21
      src/low-level/imap/condstore.c
  62. +5
    -5
      src/low-level/imap/enable.c
  63. +8
    -2
      src/low-level/imap/idle.c
  64. +186
    -4
      src/low-level/imap/mailimap.c
  65. +115
    -0
      src/low-level/imap/mailimap.h
  66. +5
    -4
      src/low-level/imap/mailimap_extension.c
  67. +1
    -1
      src/low-level/imap/mailimap_extension.h
  68. +1
    -1
      src/low-level/imap/mailimap_extension_types.h
  69. +14
    -25
      src/low-level/imap/mailimap_id_parser.c
  70. +1
    -1
      src/low-level/imap/mailimap_id_parser.h
  71. +1
    -1
      src/low-level/imap/mailimap_oauth2.c
  72. +825
    -864
      src/low-level/imap/mailimap_parser.c
  73. +30
    -30
      src/low-level/imap/mailimap_parser.h
  74. +67
    -1
      src/low-level/imap/mailimap_sender.c
  75. +10
    -0
      src/low-level/imap/mailimap_sender.h
  76. +4
    -0
      src/low-level/imap/mailimap_socket.c
  77. +5
    -7
      src/low-level/imap/mailimap_sort.c
  78. +4
    -0
      src/low-level/imap/mailimap_ssl.c
  79. +52
    -2
      src/low-level/imap/mailimap_types.c
  80. +39
    -1
      src/low-level/imap/mailimap_types.h
  81. +29
    -29
      src/low-level/imap/namespace_parser.c
  82. +1
    -1
      src/low-level/imap/namespace_parser.h
  83. +9
    -9
      src/low-level/imap/qresync.c
  84. +21
    -24
      src/low-level/imap/quota_parser.c
  85. +1
    -1
      src/low-level/imap/quota_parser.h
  86. +36
    -0
      src/low-level/imap/uidplus.c
  87. +14
    -0
      src/low-level/imap/uidplus.h
  88. +27
    -27
      src/low-level/imap/uidplus_parser.c
  89. +1
    -1
      src/low-level/imap/uidplus_parser.h
  90. +9
    -9
      src/low-level/imap/xgmlabels.c
  91. +5
    -5
      src/low-level/imap/xgmmsgid.c
  92. +3
    -3
      src/low-level/imap/xgmthrid.c
  93. +14
    -11
      src/low-level/imap/xlist.c
  94. +130
    -65
      src/low-level/imf/mailimf.c
  95. +0
    -4
      src/low-level/imf/mailimf_write_generic.c
  96. +0
    -6
      src/low-level/mbox/mailmbox.c
  97. +1
    -2
      src/low-level/mh/mailmh.c
  98. +0
    -3
      src/low-level/mime/mailmime.c
  99. +72
    -23
      src/low-level/mime/mailmime_content.c
  100. +74
    -0
      src/low-level/mime/mailmime_content.h

+ 19
- 0
.gitignore View File

@ -29,6 +29,7 @@ xcuserdata/
/Makefile
/Makefile.in
/autom4te.cache/
/compile
/config.h
/config.log
/config.status
@ -156,3 +157,21 @@ third-party
/build-windows/Release
/build-windows/x64/Debug
/build-windows/x64/Release
COPYING
INSTALL
Makfile.no
README
compile
doc/.API.sgml.swp
libltdl/
src/low-level/.tags
src/low-level/.tags1
src/low-level/dt_type
src/low-level/imf/.tags
src/low-level/mime/.mailmime_types_helper.c.kate-swp
src/low-level/mime/.tags
src/low-level/tp_data.tp_discrete_type-
tests/a.out
tests/mp

+ 2
- 0
README.md View File

@ -28,6 +28,8 @@ 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`


+ 1
- 0
build-android/build.sh View File

@ -45,6 +45,7 @@ mkdir -p "$current_dir/third-party"
cd "$current_dir/third-party"
# unzip -qo "$current_dir/dependencies/openssl/openssl-android-$openssl_build_version.zip"
# unzip -qo "$current_dir/dependencies/cyrus-sasl/cyrus-sasl-android-$cyrus_sasl_build_version.zip"
# unzip -qo "$current_dir/dependencies/iconv/iconv-android-$iconv_build_version.zip"
cd "$current_dir/.."
tar xzf "$current_dir/../build-mac/autogen-result.tar.gz"


+ 11
- 5
build-android/dependencies/cyrus-sasl/build.sh View File

@ -1,11 +1,9 @@
#!/bin/sh
version=2.1.25
build_version=1
version=2.1.26
build_version=4
ARCHIVE=cyrus-sasl-$version
ANDROID_PLATFORM=android-21
openssl_build_version=1
archs="armeabi armeabi-v7a x86 x86_64"
openssl_build_version=3
package_name=cyrus-sasl-android
if test "x$ANDROID_NDK" = x ; then
@ -62,6 +60,14 @@ function build {
}
# Start building.
ANDROID_PLATFORM=android-16
archs="armeabi armeabi-v7a x86"
for arch in $archs ; do
TARGET_ARCH_ABI=$arch
build
done
ANDROID_PLATFORM=android-21
archs="arm64-v8a"
for arch in $archs ; do
TARGET_ARCH_ABI=$arch
build


+ 4
- 0
build-android/dependencies/iconv/.gitignore View File

@ -0,0 +1,4 @@
build-android/libiconv/*
build-android/obj/*
*.tar.gz
*.tar

+ 26
- 0
build-android/dependencies/iconv/build-android/jni/Android.mk View File

@ -0,0 +1,26 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := iconv
LOCAL_CFLAGS := \
-Wno-multichar \
-DANDROID \
-DLIBDIR=\"\" \
-DBUILDING_LIBICONV \
-DIN_LIBRARY
LOCAL_SRC_FILES := \
../libiconv/libcharset/lib/localcharset.c \
../libiconv/lib/iconv.c \
../libiconv/lib/relocatable.c
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../libiconv/include \
$(LOCAL_PATH)/../libiconv/libcharset \
$(LOCAL_PATH)/../libiconv/lib \
$(LOCAL_PATH)/../libiconv/libcharset/include \
$(LOCAL_PATH)/../libiconv/srclib
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../libiconv/include
include $(BUILD_STATIC_LIBRARY)

+ 68
- 0
build-android/dependencies/iconv/build.sh View File

@ -0,0 +1,68 @@
#!/bin/sh
version=1.15
build_version=1
package_name=iconv-android
current_dir="`pwd`"
if test "x$ANDROID_NDK" = x ; then
echo should set ANDROID_NDK before running this script.
exit 1
fi
function build {
cd "$current_dir/build-android"
$ANDROID_NDK/ndk-build TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI
mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
cp "$current_dir/build-android/obj/local/$TARGET_ARCH_ABI/libiconv.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
}
if test ! -f $current_dir/$package_name-$build_version.zip; then
if test ! -f $current_dir/build-android/libiconv-$version.tar.gz; then
cd "$current_dir/build-android"
curl -O http://ftp.gnu.org/gnu/libiconv/libiconv-$version.tar.gz
cd ..
fi
#rm -rf "$current_dir/build-android/libiconv"
if test ! -d $current_dir/build-android/libiconv; then
cd "$current_dir/build-android"
tar xzf "$current_dir/build-android/libiconv-$version.tar.gz"
mv -v "$current_dir/build-android/libiconv-$version" "$current_dir/build-android/libiconv"
cd "$current_dir/build-android/libiconv"
./configure
# Disable HAVE_LANGINFO_CODESET
cd "$current_dir/build-android/libiconv/libcharset"
sed -i '.original' 's/HAVE_LANGINFO_CODESET 1/HAVE_LANGINFO_CODESET 0/g' config.h
cd "$current_dir"
fi
rm -rf "$current_dir/build-android/obj"
mkdir -p "$current_dir/$package_name-$build_version/libs/$arch_dir_name"
cp -r "$current_dir/build-android/libiconv/include" "$current_dir/$package_name-$build_version"
mkdir -p "$current_dir/$package_name-$build_version"
# Start building.
ANDROID_PLATFORM=android-16
archs="armeabi armeabi-v7a x86"
for arch in $archs ; do
TARGET_ARCH_ABI=$arch
build
done
ANDROID_PLATFORM=android-21
archs="arm64-v8a"
for arch in $archs ; do
TARGET_ARCH_ABI=$arch
build
done
cd "$current_dir"
zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
rm -rf "$package_name-$build_version"
fi

+ 86
- 23
build-android/dependencies/openssl/build.sh View File

@ -1,8 +1,7 @@
#!/bin/sh
build_version=1
version=1.0.1j
android_platform=android-21
build_version=3
version=1.0.2j
package_name=openssl-android
if test "x$ANDROID_NDK" = x ; then
@ -23,7 +22,16 @@ function build_x86_64 {
arch_cflags=""
arch_ldflags=""
arch_dir_name="x86_64"
openssl_configure_mode="linux-x86_64"
openssl_configure_mode="android64"
ANDROID_PLATFORM=android-16
ARCH_FOLDER=arch-x86_64
export MACHINE=x86_64
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=x86_64
export CROSS_COMPILE="x86_64-linux-android-"
export ANDROID_DEV="$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER/usr"
export HOSTCC=gcc
build
}
@ -34,8 +42,18 @@ function build_armeabi {
arch_cflags="-mthumb"
arch_ldflags=""
arch_dir_name="armeabi"
openssl_configure_mode="android"
# openssl_configure_mode="android-armeabi"
openssl_configure_mode="android-armv7"
ANDROID_PLATFORM=android-16
ARCH_FOLDER=arch-arm
export MACHINE=armv7
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm
export CROSS_COMPILE="arm-linux-androideabi-"
export ANDROID_DEV="$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER/usr"
export HOSTCC=gcc
build
}
@ -46,7 +64,16 @@ function build_x86 {
arch_ldflags=""
arch_dir_name="x86"
openssl_configure_mode="android-x86"
ANDROID_PLATFORM=android-16
ARCH_FOLDER=arch-x86
export MACHINE=i386
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=x86
export CROSS_COMPILE="i686-linux-android-"
export ANDROID_DEV="$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER/usr"
export HOSTCC=gcc
build
}
@ -56,7 +83,38 @@ function build_armeabi_v7a {
arch_cflags="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
arch_ldflags="-march=armv7-a -Wl,--fix-cortex-a8"
arch_dir_name="armeabi-v7a"
# openssl_configure_mode="android-armeabi"
openssl_configure_mode="android-armv7"
ANDROID_PLATFORM=android-16
ARCH_FOLDER=arch-arm
export MACHINE=armv7-a
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm
export CROSS_COMPILE="arm-linux-androideabi-"
export ANDROID_DEV="$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER/usr"
export HOSTCC=gcc
build
}
function build_arm64_v8a {
toolchain=aarch64-linux-android-4.9
toolchain_name=aarch64-linux-android
arch_cflags="-march=armv8-a"
arch_ldflags="-march=armv8-a"
arch_dir_name="arm64-v8a"
# openssl_configure_mode="android64-aarch64"
openssl_configure_mode="android no-asm"
ANDROID_PLATFORM=android-21
ARCH_FOLDER=arch-arm64
export MACHINE=arm64
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=aarch64
export CROSS_COMPILE="aarch64-linux-android-"
export ANDROID_DEV="$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER/usr"
export HOSTCC=gcc
build
}
@ -69,23 +127,27 @@ function build {
tar xzf "$current_dir/packages/openssl-$version.tar.gz"
cd openssl-$version
toolchain_path="`pwd`/$toolchain_name"
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=$android_platform --toolchain=$toolchain --install-dir="$toolchain_path"
# toolchain_path="`pwd`/$toolchain_name"
toolchain_path="$ANDROID_NDK/toolchains/$toolchain/prebuilt/darwin-x86_64"
# "$ANDROID_NDK/build/tools/make-standalone-toolchain.sh" --platform=$android_platform --toolchain=$toolchain --install-dir="$toolchain_path"
toolchain_bin_path="$toolchain_path/bin"
saved_path="$PATH"
export PATH=$PATH:$toolchain_bin_path
export TOOL=arm-linux-androideabi
export ndk_toolchain_base_name="$toolchain_bin_path/$toolchain_name"
export CC=$ndk_toolchain_base_name-gcc
export CXX=$ndk_toolchain_base_name-g++
export LINK=${CXX}
export LD=$ndk_toolchain_base_name-ld
export AR=$ndk_toolchain_base_name-ar
export RANLIB=$ndk_toolchain_base_name-ranlib
export STRIP=$ndk_toolchain_base_name-strip
export CPPFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export CXXFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
export CFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export LDFLAGS="$arch_ldflags"
./Configure "$openssl_configure_mode"
# export ndk_toolchain_base_name="$toolchain_bin_path/$toolchain_name"
# export CC=$ndk_toolchain_base_name-gcc
# export CXX=$ndk_toolchain_base_name-g++
# export LINK=${CXX}
# export LD=$ndk_toolchain_base_name-ld
# export AR=$ndk_toolchain_base_name-ar
# export RANLIB=$ndk_toolchain_base_name-ranlib
# export STRIP=$ndk_toolchain_base_name-strip
# export CPPFLAGS="$arch_cflags -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -I$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER/usr/include "
# export CXXFLAGS="$CPPFLAGS -frtti -fexceptions "
# export CFLAGS="$CPPFLAGS"
# export LDFLAGS="$arch_ldflags"
export CROSS_SYSROOT="$ANDROID_NDK/platforms/$ANDROID_PLATFORM/$ARCH_FOLDER"
./Configure $openssl_configure_mode
make
mkdir -p "$current_dir/$package_name-$build_version"
@ -94,6 +156,7 @@ function build {
cp libcrypto.a libssl.a "$current_dir/$package_name-$build_version/libs/$arch_dir_name"
cd "$current_dir"
rm -rf src
export PATH="$saved_path"
}
# start building.
@ -101,7 +164,7 @@ current_dir="`pwd`"
build_armeabi
build_armeabi_v7a
build_x86
build_x86_64
build_arm64_v8a
cd "$current_dir"
zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"


+ 6
- 0
build-android/jni/Android.mk View File

@ -9,6 +9,11 @@ include $(CLEAR_VARS)
# $(error CYRUS_SASL_PATH must be set)
# endif
#
# ifeq ($(ICONV_PATH),)
# $(error ICONV_PATH must be set)
# endif
src_files = \
./src/data-types/base64.c \
./src/data-types/carray.c \
@ -124,6 +129,7 @@ src_files = \
NDK_TOOLCHAIN_VERSION := clang
LOCAL_MODULE := etpan
LOCAL_SRC_FILES := $(addprefix ../../, $(src_files))
#LOCAL_CFLAGS += -DHAVE_CONFIG_H=1 -DHAVE_ICONV=1
LOCAL_CFLAGS += -DHAVE_CONFIG_H=1
c_includes = \
src \


BIN
build-mac/autogen-result.tar.gz View File


+ 11
- 3
build-mac/dependencies/prepare-cyrus-sasl.sh View File

@ -2,11 +2,12 @@
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
version=2.1.25
version=2.1.26
ARCHIVE=cyrus-sasl-$version
ARCHIVE_NAME=$ARCHIVE.tar.gz
ARCHIVE_PATCH=$ARCHIVE.patch
url=ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/$ARCHIVE_NAME
#url=ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/$ARCHIVE_NAME
url=ftp://ftp.cyrusimap.org/cyrus-sasl/$ARCHIVE_NAME
patchfile=cyrus-2.1.25-libetpan.patch
scriptdir="`pwd`"
@ -114,6 +115,10 @@ SDK_IOS_MIN_VERSION=7.0
SDK_IOS_VERSION="`xcodebuild -showsdks 2>/dev/null | grep iphoneos | sed 's/.*iphoneos\(.*\)/\1/'`"
BUILD_DIR="$tmpdir/build"
INSTALL_PATH="${BUILD_DIR}/${LIB_NAME}/universal"
BITCODE_FLAGS="-fembed-bitcode"
if test "x$NOBITCODE" != x ; then
BITCODE_FLAGS=""
fi
for TARGET in $TARGETS; do
@ -125,13 +130,14 @@ for TARGET in $TARGETS; do
(iPhoneOS)
ARCH=arm
MARCHS="armv7 armv7s arm64"
EXTRA_FLAGS="$BITCODE_FLAGS -miphoneos-version-min=$SDK_IOS_MIN_VERSION"
;;
(iPhoneSimulator)
ARCH=i386
MARCHS="i386 x86_64"
EXTRA_FLAGS="-miphoneos-version-min=$SDK_IOS_MIN_VERSION"
;;
esac
EXTRA_FLAGS="-fembed-bitcode -miphoneos-version-min=$SDK_IOS_MIN_VERSION"
for MARCH in $MARCHS; do
echo "building for $TARGET - $MARCH"
@ -149,6 +155,7 @@ for TARGET in $TARGETS; do
make -j 8 >> "$logfile" 2>&1
if [[ "$?" != "0" ]]; then
echo "CONFIGURE FAILED"
cat "$logfile"
exit 1
fi
cd lib
@ -162,6 +169,7 @@ for TARGET in $TARGETS; do
cd ..
if [[ "$?" != "0" ]]; then
echo "BUILD FAILED"
cat "$logfile"
exit 1
fi
make clean >> "$logfile" 2>&1


+ 40
- 0
build-mac/libetpan Tests.xcodeproj/project.pbxproj View File

@ -141,6 +141,25 @@
367863A616AB61F6002F2B96 /* libetpan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678639816AB61BA002F2B96 /* libetpan.a */; };
367863A816AB61F9002F2B96 /* libetpan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678639816AB61BA002F2B96 /* libetpan.a */; };
367863A916AB61FA002F2B96 /* libetpan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678639816AB61BA002F2B96 /* libetpan.a */; };
8568A3DF1C609B8500FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E01C609BD400FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E11C609BDC00FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E21C609BE600FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E31C609BE900FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E41C609BE900FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E51C609BFA00FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
8568A3E61C609BFC00FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
8568A3E71C609C0700FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
8568A3E81C609C2200FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3E91C609C2400FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3EA1C609C2E00FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
8568A3EB1C609C3700FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3EC1C609C3900FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3ED1C609C4700FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3EE1C609C4800FF4470 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8568A3DE1C609B8500FF4470 /* libz.tbd */; };
8568A3EF1C609C5400FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
8568A3F01C609C5400FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
8568A3F11C609C5A00FF4470 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
C6ED6CF917A1862C00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFA17A1863E00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFB17A1865600A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
@ -463,6 +482,7 @@
3678623516AB4EE6002F2B96 /* smime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = smime; sourceTree = BUILT_PRODUCTS_DIR; };
3678624816AB4F32002F2B96 /* smtpsend */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = smtpsend; sourceTree = BUILT_PRODUCTS_DIR; };
3678639816AB61BA002F2B96 /* libetpan.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libetpan.a; path = "../../../Library/Developer/Xcode/DerivedData/libetpan-dazyuihjymonnybirhcistixjbll/Build/Products/Debug/libetpan.a"; sourceTree = "<group>"; };
8568A3DE1C609B8500FF4470 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
C6ED6CF817A1862C00A4A14C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
C6ED6D0817A1883000A4A14C /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
@ -478,6 +498,7 @@
3678612116AB411F002F2B96 /* libssl.dylib in Frameworks */,
3678612316AB4131002F2B96 /* libsasl2.2.dylib in Frameworks */,
3678612516AB4142002F2B96 /* libcrypto.dylib in Frameworks */,
8568A3DF1C609B8500FF4470 /* libz.tbd in Frameworks */,
3678639916AB61BA002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -486,6 +507,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8568A3EA1C609C2E00FF4470 /* libiconv.2.dylib in Frameworks */,
3678612C16AB4314002F2B96 /* CoreFoundation.framework in Frameworks */,
C6ED6CFA17A1863E00A4A14C /* Security.framework in Frameworks */,
3678612E16AB4314002F2B96 /* libssl.dylib in Frameworks */,
@ -501,8 +523,10 @@
buildActionMask = 2147483647;
files = (
3678613E16AB4411002F2B96 /* CoreFoundation.framework in Frameworks */,
8568A3E31C609BE900FF4470 /* libz.tbd in Frameworks */,
3678614016AB4411002F2B96 /* libssl.dylib in Frameworks */,
3678614116AB4411002F2B96 /* libsasl2.2.dylib in Frameworks */,
8568A3E61C609BFC00FF4470 /* libiconv.2.dylib in Frameworks */,
C6ED6CFB17A1865600A4A14C /* Security.framework in Frameworks */,
3678614216AB4411002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D0B17A1884200A4A14C /* CoreServices.framework in Frameworks */,
@ -515,8 +539,10 @@
buildActionMask = 2147483647;
files = (
3678615016AB44A6002F2B96 /* CoreFoundation.framework in Frameworks */,
8568A3E41C609BE900FF4470 /* libz.tbd in Frameworks */,
3678615216AB44A6002F2B96 /* libssl.dylib in Frameworks */,
3678615316AB44A6002F2B96 /* libsasl2.2.dylib in Frameworks */,
8568A3E71C609C0700FF4470 /* libiconv.2.dylib in Frameworks */,
C6ED6CFC17A1865700A4A14C /* Security.framework in Frameworks */,
3678615416AB44A6002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D0D17A1884400A4A14C /* CoreServices.framework in Frameworks */,
@ -535,6 +561,7 @@
3678619716AB4671002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6CFD17A1865700A4A14C /* Security.framework in Frameworks */,
3678639E16AB61DE002F2B96 /* libetpan.a in Frameworks */,
8568A3E91C609C2400FF4470 /* libz.tbd in Frameworks */,
C6ED6D0E17A1884800A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -550,6 +577,7 @@
3678619816AB4685002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6CFE17A1865800A4A14C /* Security.framework in Frameworks */,
3678639F16AB61E1002F2B96 /* libetpan.a in Frameworks */,
8568A3EB1C609C3700FF4470 /* libz.tbd in Frameworks */,
C6ED6D0F17A1884800A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -565,6 +593,7 @@
3678619916AB4689002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6CFF17A1865900A4A14C /* Security.framework in Frameworks */,
367863A016AB61E5002F2B96 /* libetpan.a in Frameworks */,
8568A3E01C609BD400FF4470 /* libz.tbd in Frameworks */,
C6ED6D1017A1884900A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -580,6 +609,7 @@
367861AD16AB47DC002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6D0017A1865900A4A14C /* Security.framework in Frameworks */,
367863A116AB61E9002F2B96 /* libetpan.a in Frameworks */,
8568A3ED1C609C4700FF4470 /* libz.tbd in Frameworks */,
C6ED6D1117A1884A00A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -589,8 +619,10 @@
buildActionMask = 2147483647;
files = (
367861B316AB48E1002F2B96 /* CoreFoundation.framework in Frameworks */,
8568A3EC1C609C3900FF4470 /* libz.tbd in Frameworks */,
367861B516AB48E1002F2B96 /* libssl.dylib in Frameworks */,
367861B616AB48E1002F2B96 /* libsasl2.2.dylib in Frameworks */,
8568A3F11C609C5A00FF4470 /* libiconv.2.dylib in Frameworks */,
C6ED6D0117A1865B00A4A14C /* Security.framework in Frameworks */,
367861B716AB48E1002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1217A1884A00A4A14C /* CoreServices.framework in Frameworks */,
@ -609,6 +641,7 @@
367861D316AB4BDA002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6D0217A1865C00A4A14C /* Security.framework in Frameworks */,
367863A316AB61F5002F2B96 /* libetpan.a in Frameworks */,
8568A3E11C609BDC00FF4470 /* libz.tbd in Frameworks */,
C6ED6D1317A1884B00A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -617,6 +650,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8568A3EF1C609C5400FF4470 /* libiconv.2.dylib in Frameworks */,
367861F116AB4D4F002F2B96 /* CoreFoundation.framework in Frameworks */,
367861F316AB4D4F002F2B96 /* libssl.dylib in Frameworks */,
367861F416AB4D4F002F2B96 /* libsasl2.2.dylib in Frameworks */,
@ -631,6 +665,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8568A3F01C609C5400FF4470 /* libiconv.2.dylib in Frameworks */,
3678620516AB4DFE002F2B96 /* CoreFoundation.framework in Frameworks */,
3678620716AB4DFE002F2B96 /* libssl.dylib in Frameworks */,
3678620816AB4DFE002F2B96 /* libsasl2.2.dylib in Frameworks */,
@ -646,6 +681,7 @@
buildActionMask = 2147483647;
files = (
3678621816AB4E63002F2B96 /* CoreFoundation.framework in Frameworks */,
8568A3E81C609C2200FF4470 /* libz.tbd in Frameworks */,
3678621A16AB4E63002F2B96 /* libssl.dylib in Frameworks */,
3678621B16AB4E63002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0417A1865D00A4A14C /* Security.framework in Frameworks */,
@ -660,8 +696,10 @@
buildActionMask = 2147483647;
files = (
3678622B16AB4EE6002F2B96 /* CoreFoundation.framework in Frameworks */,
8568A3E21C609BE600FF4470 /* libz.tbd in Frameworks */,
3678622D16AB4EE6002F2B96 /* libssl.dylib in Frameworks */,
3678622E16AB4EE6002F2B96 /* libsasl2.2.dylib in Frameworks */,
8568A3E51C609BFA00FF4470 /* libiconv.2.dylib in Frameworks */,
C6ED6D0717A1865F00A4A14C /* Security.framework in Frameworks */,
3678622F16AB4EE6002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1717A1884E00A4A14C /* CoreServices.framework in Frameworks */,
@ -674,6 +712,7 @@
buildActionMask = 2147483647;
files = (
3678623E16AB4F32002F2B96 /* CoreFoundation.framework in Frameworks */,
8568A3EE1C609C4800FF4470 /* libz.tbd in Frameworks */,
3678624016AB4F32002F2B96 /* libssl.dylib in Frameworks */,
3678624116AB4F32002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0617A1865E00A4A14C /* Security.framework in Frameworks */,
@ -768,6 +807,7 @@
3678612216AB4131002F2B96 /* libsasl2.2.dylib */,
3678612016AB411F002F2B96 /* libssl.dylib */,
3678619616AB4671002F2B96 /* libiconv.2.dylib */,
8568A3DE1C609B8500FF4470 /* libz.tbd */,
3678639816AB61BA002F2B96 /* libetpan.a */,
);
name = "External Frameworks and Libraries";


+ 2
- 0
build-mac/libetpan.xcodeproj/project.pbxproj View File

@ -591,6 +591,7 @@
8A75ECEA170414E9007F9972 /* mailimap_sort_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mailimap_sort_types.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* libetpan.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = libetpan.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BD5495471BEAC5EB00E7974E /* md5namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5namespace.h; sourceTree = "<group>"; };
C60136961776D16A00A5AF45 /* mailimap_oauth2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mailimap_oauth2.c; sourceTree = "<group>"; };
C60136971776D16A00A5AF45 /* mailimap_oauth2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mailimap_oauth2.h; sourceTree = "<group>"; };
C60E7B9816C3809400A25BF4 /* enable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = enable.c; sourceTree = "<group>"; };
@ -1131,6 +1132,7 @@
C6F9E878105335BC0059C3BA /* md5.c */,
C6F9E879105335BC0059C3BA /* md5.h */,
C6F9E87A105335BC0059C3BA /* md5global.h */,
BD5495471BEAC5EB00E7974E /* md5namespace.h */,
C6F9E87B105335BC0059C3BA /* mmapstring.c */,
C6F9E87C105335BC0059C3BA /* mmapstring.h */,
C6F9E87D105335BC0059C3BA /* mmapstring_private.h */,


+ 2
- 1
build-mac/update.sh View File

@ -43,8 +43,9 @@ if test "x$ACTION" = xbuild -o "x$ACTION" = xinstall ; then
tar xzf build-mac/autogen-result.tar.gz
export SDKROOT=
export IPHONEOS_DEPLOYMENT_TARGET=
./configure --enable-debug > "$logfile" 2>&1
./configure --with-expat=no --with-curl=no --enable-debug > "$logfile" 2>&1
if [[ "$?" != "0" ]]; then
cat "$logfile"
echo "configure failed"
exit 1
fi


+ 0
- 1
build-windows/build_headers.list View File

@ -128,7 +128,6 @@ src\low-level\mbox\mailmbox_types.h
src\low-level\mh\mailmh.h
src\low-level\mime\mailmime.h
src\low-level\mime\mailmime_content.h
src\low-level\mime\mailmime_encode.h
src\low-level\mime\mailmime_decode.h
src\low-level\mime\mailmime_disposition.h
src\low-level\mime\mailmime_types.h


+ 4
- 2
build-windows/libetpan/libetpan.vcxproj View File

@ -165,7 +165,8 @@
<AdditionalDependencies>libsasl2.lib;zlib.lib;Ws2_32.lib;ssleay32MD.lib;libeay32MD.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>../../third-party/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>C;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)libetpan.pdb</ProgramDatabaseFile>
<SubSystem>NotSet</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@ -193,7 +194,8 @@
<AdditionalDependencies>libsasl2.lib;zlib.lib;Ws2_32.lib;ssleay32MD.lib;libeay32MD.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>../../third-party/lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>C;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)libetpan.pdb</ProgramDatabaseFile>
<SubSystem>NotSet</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>


+ 43
- 27
configure.ac View File

@ -2,10 +2,11 @@
# Process this file with autoconf to produce a configure script.
m4_define([maj_version], [1])
m4_define([min_version], [6])
m4_define([api_current], [18])
m4_define([min_version], [8])
m4_define([mic_version], [0])
m4_define([api_current], [21])
m4_define([api_revision], [0])
m4_define([api_compatibility], [17])
m4_define([api_compatibility], [20])
dnl API version
dnl 1. If you have changed any of the sources for this library, the revision
dnl number must be incremented. This is a new revision of the current
@ -23,7 +24,7 @@ dnl interface.
dnl age = api_current - api_compatiblity
AC_PREREQ(2.61)
AC_INIT([libetpan],[maj_version.min_version],[libetpan-devel@lists.sourceforge.net])
AC_INIT([libetpan],[maj_version.min_version.mic_version],[libetpan-devel@lists.sourceforge.net])
AC_CONFIG_SRCDIR([src/main/libetpan_version.h.in])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([config.h])
@ -31,9 +32,10 @@ AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
dnl Version major and minor
dnl Version major, minor and micro
VERSION_MAJOR=maj_version
VERSION_MINOR=min_version
VERSION_MICRO=mic_version
dnl required version of libcurl
libcurl_major_required=0
@ -70,7 +72,7 @@ AC_SUBST(BUILD_REVISION)
BUILD_TIMESTAMP=`date +'%Y-%m-%dT%H:%M%z'`
AC_SUBST(BUILD_TIMESTAMP)
changequote(,)dnl
BUILD_FILEVERSION=`echo "${VERSION_MAJOR}.${VERSION_MINOR}.0" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
BUILD_FILEVERSION=`echo "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
AC_SUBST(BUILD_FILEVERSION)
@ -109,13 +111,13 @@ AC_PROG_CC
AC_PROG_CXX
# Compiler flags.
AC_ARG_ENABLE(debug, [ --enable-debug setup flags (gcc) for debugging (default=no)],
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug], [setup flags (gcc) for debugging (default=no)])],
if test "x$enable_debug" = xyes; then
CFLAGS="$CFLAGS -O2 -g"
fi
CPPFLAGS="$CPPFLAGS -DDEBUG"
LDFLAGS="$LDFLAGS",)
AC_ARG_ENABLE(optim, [ --enable-optim setup flags (gcc) for optimizations (default=no)],
AC_ARG_ENABLE(optim, [AC_HELP_STRING([--enable-optim], [setup flags (gcc) for optimizations (default=no)])],
if test "x$enable_debug" != "xyes" ; then
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -O2 -ffast-math -funroll-loops -g0"
@ -128,7 +130,7 @@ fi,)
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -W -Wall"
fi
AC_ARG_ENABLE(syntax, [ --enable-unstrict-syntax be lazy on syntax checking for protocols (default=no)], , [AC_DEFINE(UNSTRICT_SYNTAX, 1, [Define to be lazy on protocol syntax])])
AC_ARG_ENABLE(syntax, [AC_HELP_STRING([--enable-unstrict-syntax], [be lazy on syntax checking for protocols (default=no)])], , [AC_DEFINE(UNSTRICT_SYNTAX, 1, [Define to be lazy on protocol syntax])])
AH_VERBATIM([CONFIG_H_FIRST], [/* Check for Linux's /usr/include/features.h
*/
@ -156,6 +158,16 @@ AC_CHECK_HEADERS(netdb.h netinet/in.h sys/socket.h)
AC_CHECK_HEADERS(sys/param.h sys/select.h inttypes.h)
AC_CHECK_HEADERS(arpa/inet.h winsock2.h)
AC_ARG_WITH([poll], use poll intead of select, use_poll=yes, use_poll=no)
if test "x$use_poll" = "xyes"; then
AC_CHECK_HEADERS(sys/poll.h, [AC_DEFINE([USE_POLL], 1, [use poll instead of select])])
else
echo "poll using is off"
fi
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
@ -186,7 +198,7 @@ if test "x$has_getoptlong" = "xyes"; then
fi
dnl OpenSSL -- very primitive right now
AC_ARG_WITH(openssl, [ --with-openssl[=DIR] include OpenSSL support (default=auto)],
AC_ARG_WITH(openssl, [AC_HELP_STRING([--with-openssl[=DIR]], [include OpenSSL support (default=auto)])],
[], [with_openssl=yes])
if test "x$with_openssl" != "xno"; then
OCPPFLAGS="$CPPFLAGS"
@ -200,7 +212,7 @@ if test "x$with_openssl" != "xno"; then
AC_CHECK_HEADER(openssl/ssl.h, [
AC_CHECK_LIB(rsaref, main, [SSLLIBS="-lrsaref"])
AC_CHECK_LIB(crypto, main, [SSLLIBS="-lcrypto $SSLLIBS"], [], [$SSLLIBS])
AC_CHECK_LIB(ssl, SSL_library_init, with_openssl=yes, [], [$SSLLIBS])])
AC_CHECK_LIB(ssl, SSL_CTX_new, with_openssl=yes, [], [$SSLLIBS])])
if test "x$with_openssl" != "xyes"; then
CPPFLAGS="$OCPPFLAGS"
LDFLAGS="$OLDFLAGS"
@ -217,7 +229,7 @@ fi
AC_SUBST(SSLLIBS)
dnl GNUTLS
AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] include GnuTLS support (default=auto)],
AC_ARG_WITH(gnutls, [AC_HELP_STRING([--with-gnutls[=DIR]], [include GnuTLS support (default=auto)])],
[], [with_gnutls=no])
if test "x$with_gnutls" != "xno"; then
OCPPFLAGS="$CPPFLAGS"
@ -255,8 +267,7 @@ fi
dnl iconv
LIBICONV=""
AC_ARG_ENABLE(iconv,
[ --disable-iconv make a version not using iconv],
AC_ARG_ENABLE(iconv, [AC_HELP_STRING([--disable-iconv], [make a version not using iconv])],
enable_iconv=no, enable_iconv=yes)
if test x$enable_iconv = xyes; then
dnl get prototype
@ -343,7 +354,7 @@ DBVERS=0
DBLINKED=0
DBLIB=""
AC_ARG_ENABLE(db, [ --disable-db disable Berkeley DB (default=try to detect DB)],[enable_db=$enableval],[enable_db=yes])
AC_ARG_ENABLE(db, [AC_HELP_STRING([--disable-db], [disable Berkeley DB (default=try to detect DB)])],[enable_db=$enableval],[enable_db=yes])
dnl Check for a presence of Berkeley DB header
if test "x$enable_db" != "xyes"; then
@ -386,7 +397,7 @@ dnl Look for db3 or superior with db_create call
case "$DBVERS" in
3)
AC_MSG_RESULT([version 3.x or above])
for lib in db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db-3.2 db-3 db3 db; do
for lib in db-6.0 db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db-3.2 db-3 db3 db; do
if test "x$DBLINKED" = "x0"; then
dnl AC_CHECK_LIB($lib, db_create, [DBLIB="-l$lib"; DBLINKED=1], [])
dnl installations of libdb4 function names are defined in db.h
@ -439,8 +450,8 @@ AC_DEFINE_UNQUOTED(DBVERS, $DBVERS,
AC_SUBST(DBLIB)
dnl Threading support, if enabled
AC_ARG_ENABLE(threads, [ --disable-threads do not include multithreading support using pthread],,[enable_threads=yes])
AC_ARG_ENABLE(windows-threads, [ --enable-windows-threads include multithreading support using windows threads],[enable_windows_threads=yes],)
AC_ARG_ENABLE(threads, [AC_HELP_STRING([--disable-threads], [do not include multithreading support using pthread])],,[enable_threads=yes])
AC_ARG_ENABLE(windows-threads, [AC_HELP_STRING([--enable-windows-threads], [include multithreading support using windows threads])],[enable_windows_threads=yes],)
if test "x$enable_windows_threads" = "xyes"; then
AC_CHECK_HEADERS(pthread.h, [], [])
@ -496,7 +507,7 @@ AC_SUBST(LIBSUFFIX)
AC_SUBST(REENTRANT)
dnl liblockfile on debian systems
AC_ARG_ENABLE(lockfile, [ --disable-lockfile do not use liblockfile for locking mailboxes])
AC_ARG_ENABLE(lockfile, [AC_HELP_STRING([--disable-lockfile], [do not use liblockfile for locking mailboxes])])
if test "x$enable_lockfile" != "xno"; then
AC_CHECK_LIB(lockfile, lockfile_create,, [
if test "x$enable_lockfile" = "xyes"; then
@ -508,11 +519,14 @@ AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MAJOR, $VERSION_MAJOR,
[Define this to the major version of libEtPan])
AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MINOR, $VERSION_MINOR,
[Define this to the minor version of libEtPan])
AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MICRO, $VERSION_MICRO,
[Define this to the micro version of libEtPan])
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_MICRO)
dnl Cyrus SASL
AC_ARG_WITH(sasl, [ --with-sasl[=DIR] include SASL support (default=auto)],
AC_ARG_WITH(sasl, [AC_HELP_STRING([--with-sasl[=DIR]], [include SASL support (default=auto)])],
[], [with_sasl=yes])
if test "x$with_sasl" != "xno"; then
OCPPFLAGS="$CPPFLAGS"
@ -564,8 +578,10 @@ if test "x$enable_ipv6" != "xno"; then
dnl check for getaddrinfo and freeaddrinfo function presence
for func in "getaddrinfo" "freeaddrinfo"; do
AC_MSG_CHECKING([for $func])
AC_TRY_LINK([], [$func();],
[func_present=yes],
AC_TRY_LINK([#include <sys/socket.h>
#include <netdb.h>],
[(void)$func;],
[func_present=yes],
[func_present=no])
AC_MSG_RESULT($func_present)
@ -579,9 +595,9 @@ fi
dnl libcurl
libcurl=no
AC_ARG_WITH(curl, [ --with-curl[=DIR] curl install directory (default=auto)],
AC_ARG_WITH(curl, [AC_HELP_STRING([--with-curl[=DIR]], [curl install directory (default=auto)])],
[], [with_curl=auto])
if test "x$with_curl" != "xno"; then
if test "x$with_curl" = "xno"; then
:
elif test "x$with_curl" != "xauto"; then
OCPPFLAGS="$CPPFLAGS"
@ -637,9 +653,9 @@ fi
dnl expat
libexpat=no
AC_ARG_WITH(expat, [ --with-expat[=DIR] expat install directory (default=auto)],
AC_ARG_WITH(expat, [AC_HELP_STRING([--with-expat[=DIR]], [expat install directory (default=auto)])],
[], [with_expat=auto])
if test "x$with_expat" != "xno"; then
if test "x$with_expat" = "xno"; then
:
elif test "x$with_expat" != "xauto"; then
OCPPFLAGS="$CPPFLAGS"
@ -717,7 +733,7 @@ AS_IF([test "$with_zlib" != no], [
AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
dnl Version
VERSION="$VERSION_MAJOR.$VERSION_MINOR"
VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_MICRO"
test -d .git && VERSION="$VERSION-dev-"`date +'%Y%m%d'`
AC_DEFINE_UNQUOTED(LIBETPAN_VERSION, "$VERSION",
[Define this to the version of libEtPan])


+ 1
- 1
src/data-types/Makefile.am View File

@ -43,7 +43,7 @@ AM_CPPFLAGS = -I$(top_builddir)/include
noinst_LTLIBRARIES = libdata-types.la
libdata_types_la_SOURCES = connect.h connect.c base64.h hmac-md5.h \
md5global.h md5.h md5.c mmapstring.c mailstream_helper.c \
md5global.h md5namespace.h md5.h md5.c mmapstring.c mailstream_helper.c \
mailstream_low.c mailstream.c mailstream_socket.c \
mailstream_ssl.c carray.c clist.c chash.c \
charconv.c maillock.c base64.c mail_cache_db_types.h \


+ 2
- 2
src/data-types/chash.c View File

@ -393,12 +393,12 @@ int chash_resize(chash * hash, unsigned int size)
#ifdef NO_MACROS
LIBETPAN_EXPORT
int chash_count(chash * hash) {
unsigned int chash_count(chash * hash) {
return hash->count;
}
LIBETPAN_EXPORT
int chash_size(chash * hash) {
unsigned int chash_size(chash * hash) {
return hash->size;
}


+ 61
- 3
src/data-types/connect.c View File

@ -56,8 +56,11 @@
# include <netdb.h>
# include <netinet/in.h>
# include <sys/socket.h>
# ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
# endif
# include <unistd.h>
# include <arpa/inet.h>
# include <arpa/inet.h>
#endif
#include "syscall_wrappers.h"
@ -110,7 +113,11 @@ static int verify_sock_errors(int s)
static int wait_connect(int s, int r, time_t timeout_seconds)
{
#if defined(WIN32) || !USE_POLL
fd_set fds;
#else
struct pollfd pfd;
#endif // WIN32
struct timeval timeout;
if (r == 0) {
@ -126,8 +133,6 @@ static int wait_connect(int s, int r, time_t timeout_seconds)
}
}
FD_ZERO(&fds);
FD_SET(s, &fds);
if (timeout_seconds == 0) {
timeout = mailstream_network_delay;
}
@ -135,6 +140,10 @@ static int wait_connect(int s, int r, time_t timeout_seconds)
timeout.tv_sec = timeout_seconds;
timeout.tv_usec = 0;
}
#if defined(WIN32) || !USE_POLL
FD_ZERO(&fds);
FD_SET(s, &fds);
/* TODO: how to cancel this ? -> could be cancelled using a cancel fd */
// answer: see man 3 signal
@ -147,7 +156,21 @@ static int wait_connect(int s, int r, time_t timeout_seconds)
/* though, it's strange */
return -1;
}
#else
pfd.fd = s;
pfd.events = POLLOUT;
pfd.revents = 0;
r = poll(&pfd, 1, timeout.tv_sec * 1000 + timeout.tv_usec / 1000);
if (r <= 0) {
return -1;
}
if (pfd.revents & POLLOUT != POLLOUT) {
return -1;
}
#endif
return 0;
}
@ -167,6 +190,38 @@ int mail_tcp_connect_with_local_address(const char * server, uint16_t port,
return mail_tcp_connect_with_local_address_timeout(server, port, local_address, local_port, 0);
}
#ifndef WIN32
#include <sys/un.h>
int mail_unix_connect_socket(const char *path)
{
struct sockaddr_un sa;
int s;
if (sizeof(sa.sun_path) <= strlen(path)) {
return -1;
}
if (!(memcpy(sa.sun_path, path, sizeof(sa.sun_path)))) {
return -1;
}
sa.sun_family = AF_UNIX;
if (0 > (s = socket(AF_UNIX, SOCK_STREAM, 0)))
return -1;
if (prepare_fd(s))
goto close_socket;
if (connect(s, (struct sockaddr *) &sa, sizeof(struct sockaddr_un)))
goto close_socket;
return s;
close_socket:
Close(s);
return -1;
}
#endif
int mail_tcp_connect_with_local_address_timeout(const char * server, uint16_t port,
const char * local_address, uint16_t local_port, time_t timeout)
{
@ -184,6 +239,9 @@ int mail_tcp_connect_with_local_address_timeout(const char * server, uint16_t po
#else
int s;
int r;
if ('/' == server[0])
return mail_unix_connect_socket(server);
#endif
#ifndef HAVE_IPV6


+ 4
- 31
src/data-types/mailstream.c View File

@ -197,34 +197,6 @@ static ssize_t read_from_internal_buffer(mailstream * s,
return count;
}
static ssize_t read_through_buffer(mailstream * s, void * buf, size_t count)
{
size_t left;
char * cur_buf;
ssize_t bytes_read;
cur_buf = buf;
left = count;
while (left > 0) {
bytes_read = mailstream_low_read(s->low, cur_buf, left);
if (bytes_read < 0) {
if (count == left)
return -1;
else
return count - left;
}
else if (bytes_read == 0)
return count - left;
cur_buf += bytes_read;
left -= bytes_read;
}
return count;
}
LIBETPAN_EXPORT
ssize_t mailstream_read(mailstream * s, void * buf, size_t count)
{
@ -246,12 +218,13 @@ ssize_t mailstream_read(mailstream * s, void * buf, size_t count)
}
if (left > s->buffer_max_size) {
read_bytes = read_through_buffer(s, cur_buf, left);
read_bytes = mailstream_low_read(s->low, cur_buf, left);
if (read_bytes == -1) {
if (count == left)
return -1;
return -1;
else {
return count - left;
return count - left;
}
}


+ 32
- 1
src/data-types/mailstream_cfstream.c View File

@ -460,6 +460,19 @@ mailstream_low * mailstream_low_cfstream_open_voip(const char * hostname, int16_
return mailstream_low_cfstream_open_voip_timeout(hostname, port, voip_enabled, 0);
}
#if HAVE_CFNETWORK
static int numberIntValue(CFNumberRef nb)
{
if (nb == NULL) {
return 0;
}
int result;
CFNumberGetValue(nb, kCFNumberIntType, &result);
return result;
}
#endif
mailstream_low * mailstream_low_cfstream_open_voip_timeout(const char * hostname, int16_t port,
int voip_enabled, time_t timeout)
{
@ -483,7 +496,17 @@ mailstream_low * mailstream_low_cfstream_open_voip_timeout(const char * hostname
CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
}
#endif
#if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings();
CFNumberRef nbEnabled = CFDictionaryGetValue(proxySettings, kCFNetworkProxiesSOCKSEnable);
if (numberIntValue(nbEnabled)) {
CFReadStreamSetProperty(readStream, kCFStreamPropertySOCKSProxy, proxySettings);
CFWriteStreamSetProperty(writeStream, kCFStreamPropertySOCKSProxy, proxySettings);
}
CFRelease(proxySettings);
#endif
cfstream_data = cfstream_data_new(readStream, writeStream);
s = mailstream_low_new(cfstream_data, mailstream_cfstream_driver);
mailstream_low_set_timeout(s, timeout);
@ -823,6 +846,10 @@ static ssize_t mailstream_low_cfstream_read(mailstream_low * s,
if (cfstream_data->cancelled) {
return -1;
}
if (CFReadStreamGetStatus(cfstream_data->readStream) == kCFStreamStatusError) {
return -1;
}
if (CFReadStreamHasBytesAvailable(cfstream_data->readStream)) {
readDataFromStream(s);
@ -854,6 +881,10 @@ static ssize_t mailstream_low_cfstream_write(mailstream_low * s,
if (cfstream_data->cancelled)
return -1;
if (CFWriteStreamGetStatus(cfstream_data->writeStream) == kCFStreamStatusError) {
return -1;
}
if (CFWriteStreamCanAcceptBytes(cfstream_data->writeStream)) {
writeDataToStream(s);
return cfstream_data->writeResult;


+ 3
- 0
src/data-types/mailstream_compress.c View File

@ -103,6 +103,9 @@ mailstream_low * mailstream_low_compress_open(mailstream_low * ms)
if (compress_data == NULL)
goto err;
compress_data->compress_stream = NULL;
compress_data->decompress_stream = NULL;
/* allocate deflate state */
compress_data->compress_stream = malloc(sizeof(z_stream));
compress_data->compress_stream->zalloc = Z_NULL;


+ 4
- 1
src/data-types/mailstream_compress.h View File

@ -66,4 +66,7 @@ LIBETPAN_EXPORT
int mailstream_low_compress_interrupt_idle(mailstream_low * low);
*/
#endif
#ifdef __cplusplus
}
#endif
#endif

+ 0
- 10
src/data-types/mailstream_helper.c View File

@ -493,14 +493,9 @@ int mailstream_send_data_with_context(mailstream * s, const char * message,
static inline ssize_t get_data_size(const char * line, size_t length,
size_t * result)
{
int fix_eol;
const char * start;
size_t count;
size_t fixed_count;
start = line;
fix_eol = 0;
count = 0;
fixed_count = 0;
@ -515,7 +510,6 @@ static inline ssize_t get_data_size(const char * line, size_t length,
length --;
if (length == 0) {
fix_eol = 1;
fixed_count ++;
break;</