]
)
-AC_CHECK_LIB(idn, idna_to_ascii_from_utf8)
+if test "x$with_idn" != "xno"; then
+ AC_CHECK_LIB(idn, stringprep_check_version)
+ AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
+ AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
+ AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
+fi
if test "$need_md5" = "yes"
then
goto notrans;
/* Is this the right function? Interesting effects with some bad identifiers! */
- if (idna_to_unicode_utf8_from_utf8 (in, out, 1, 0) != IDNA_SUCCESS)
+ if (idna_to_unicode_8z8z (in, out, 1) != IDNA_SUCCESS)
goto notrans;
if (mutt_convert_string (out, "utf-8", Charset, M_ICONV_HOOK_TO) == -1)
goto notrans;
char *tmp = safe_strdup (*out);
if (mutt_convert_string (&tmp, Charset, "utf-8", M_ICONV_HOOK_FROM) == -1)
irrev = 1;
- if (!irrev && idna_to_ascii_from_utf8 (tmp, &t2, 1, 0) != IDNA_SUCCESS)
+ if (!irrev && idna_to_ascii_8z (tmp, &t2, 1) != IDNA_SUCCESS)
irrev = 1;
if (!irrev && ascii_strcasecmp (t2, in))
{
if (mutt_convert_string (&tmp, Charset, "utf-8", M_ICONV_HOOK_FROM) == -1)
rv = -1;
- if (!rv && idna_to_ascii_from_utf8 (tmp, out, 1, 0) != IDNA_SUCCESS)
+ if (!rv && idna_to_ascii_8z (tmp, out, 1) != IDNA_SUCCESS)
rv = -2;
FREE (&tmp);
const char *mutt_addr_for_display (ADDRESS *a);
+/* Work around incompatibilities in the libidn API */
+
+#ifdef HAVE_LIBIDN
+# if (!defined(HAVE_IDNA_TO_ASCII_8Z) && defined(HAVE_IDNA_TO_ASCII_FROM_UTF8))
+# define idna_to_ascii_8z(a,b,c) idna_to_ascii_from_utf8(a,b,(c)&1,((c)&2)?1:0)
+# endif
+# if (!defined(HAVE_IDNA_TO_ASCII_LZ) && defined(HAVE_IDNA_TO_ASCII_FROM_LOCALE))
+# define idna_to_ascii_lz(a,b,c) idna_to_ascii_from_locale(a,b,(c)&1,((c)&2)?1:0)
+# endif
+# if (!defined(HAVE_IDNA_TO_UNICODE_8Z8Z) && defined(HAVE_IDNA_TO_UNICODE_UTF8_FROM_UTF8))
+# define idna_to_unicode_8z8z(a,b,c) idna_to_unicode_utf8_from_utf8(a,b,(c)&1,((c)&2)?1:0)
+# endif
+#endif
+
#endif
# include "mutt_ssl.h"
#endif
-#ifdef HAVE_LIBIDN
-#include <idna.h>
-#endif
+#include "mutt_idna.h"
#include <unistd.h>
#include <netinet/in.h>
snprintf (port, sizeof (port), "%d", conn->account.port);
# ifdef HAVE_LIBIDN
- if (idna_to_ascii_from_locale (conn->account.host, &host_idna, 1, 0) != IDNA_SUCCESS)
+ if (idna_to_ascii_lz (conn->account.host, &host_idna, 1) != IDNA_SUCCESS)
{
mutt_error (_("Bad IDN \"%s\"."), conn->account.host);
return -1;
sin.sin_family = AF_INET;
# ifdef HAVE_LIBIDN
- if (idna_to_ascii_from_locale (conn->account.host, &host_idna, 1, 0) != IDNA_SUCCESS)
+ if (idna_to_ascii_lz (conn->account.host, &host_idna, 1) != IDNA_SUCCESS)
{
mutt_error (_("Bad IDN \"%s\"."), conn->account.host);
return -1;