talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 073b3b6e5c00af1f91a39803b93443e0c80caac6
parent 6d746bea45f768fcaba27ca9a066105d528ea2db
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Thu, 10 Sep 2015 21:10:21 +0200

Make IPv6 work on Windows, for connections not handled by libetpan.

Diffstat:
Mconfigure.ac | 24+++++++++++++++++-------
Msrc/common/socket.c | 4+++-
Msrc/imap.c | 12++++++++++++
3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -448,13 +448,23 @@ AC_MSG_CHECKING([whether to use IPv6]) if test x"$enable_ipv6" = xyes; then AC_MSG_RESULT(yes) AC_MSG_CHECKING([for IPv6 support]) - AC_CACHE_VAL(ac_cv_ipv6,[ - AC_TRY_COMPILE([#define INET6 - #include <sys/types.h> - #include <netinet/in.h>], - [int x = IPPROTO_IPV6; struct in6_addr a;], - ac_cv_ipv6=yes, ac_cv_ipv6=no) - ]) + if test x"$platform_win32" = xyes; then + AC_CACHE_VAL(ac_cv_ipv6,[ + AC_TRY_COMPILE([ + #include <ws2tcpip.h> + ], [struct in6_addr a;], + ac_cv_ipv6=yes, ac_cv_ipv6=no) + ]) + else + AC_CACHE_VAL(ac_cv_ipv6,[ + AC_TRY_COMPILE([ + #define INET6 + #include <sys/types.h> + #include <netinet/in.h> + ], [int x = IPPROTO_IPV6; struct in6_addr a;], + ac_cv_ipv6=yes, ac_cv_ipv6=no) + ]) + fi AC_MSG_RESULT($ac_cv_ipv6) if test $ac_cv_ipv6 = yes; then AC_DEFINE(INET6, 1, Define if you want IPv6 support.) diff --git a/src/common/socket.c b/src/common/socket.c @@ -26,13 +26,15 @@ #define _BSD_SOURCE #endif +/* This can probably be handled better, e.g. define it in config.h. */ +#define _WIN32_WINNT _WIN32_WINNT_WIN6 #include <glib.h> #include <glib/gi18n.h> #include <sys/time.h> #include <sys/types.h> #ifdef G_OS_WIN32 -# include <winsock2.h> +# include <ws2tcpip.h> # ifndef EINPROGRESS # define EINPROGRESS WSAEINPROGRESS # endif diff --git a/src/imap.c b/src/imap.c @@ -3008,13 +3008,25 @@ static gchar *imap_folder_get_path(Folder *folder) g_return_val_if_fail(folder != NULL, NULL); g_return_val_if_fail(folder->account != NULL, NULL); +#ifdef G_OS_WIN32 + gchar *sanitized_dirname = g_strdup(folder->account->recv_server); + g_strdelimit(sanitized_dirname, ":", ','); +#endif + folder_path = g_strconcat(get_imap_cache_dir(), G_DIR_SEPARATOR_S, +#ifdef G_OS_WIN32 + sanitized_dirname, +#else folder->account->recv_server, +#endif G_DIR_SEPARATOR_S, folder->account->userid, NULL); +#ifdef G_OS_WIN32 + g_free(sanitized_dirname); +#endif return folder_path; }