From: Pierre Habouzit Date: Mon, 9 Apr 2007 23:56:27 +0000 (+0200) Subject: fix idn support properly X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=f308b90cecbb9570ab072bd90b04bd58cd9d6274;p=apps%2Fmadmutt.git fix idn support properly Signed-off-by: Pierre Habouzit --- diff --git a/configure.ac b/configure.ac index 476b0d2..e0c347c 100644 --- a/configure.ac +++ b/configure.ac @@ -412,6 +412,7 @@ AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn], [Use GNU libidn for domain names]) fi CPPFLAGS="$CPPFLAGS $IDN_CFLAGS" LDFLAGS="$LDFLAGS $IDN_LIBS" + AC_DEFINE(HAVE_LIBIDN, 1, [IDN Support]) ],[AC_MSG_ERROR([could not find libidn])]) fi ]) @@ -737,7 +738,6 @@ AC_OUTPUT(Makefile m4/Makefile po/Makefile.in apidoc/Makefile apidoc/doxygen.cfg - doc/Makefile doc/instdoc.sh lib-lib/Makefile lib-lua/Makefile lib-mime/Makefile diff --git a/lib-sys/mutt_socket.c b/lib-sys/mutt_socket.c index fa054ae..72473bc 100644 --- a/lib-sys/mutt_socket.c +++ b/lib-sys/mutt_socket.c @@ -26,6 +26,9 @@ #include "mutt_signal.h" #include "mutt_ssl.h" +#ifdef HAVE_LIBIDN +#include +#endif #include "mutt_idna.h" /* support for multiple socket connections */ diff --git a/mutt_idna.c b/mutt_idna.c index 686e849..84e470d 100644 --- a/mutt_idna.c +++ b/mutt_idna.c @@ -19,24 +19,9 @@ /* The low-level interface we use. */ -#ifndef HAVE_LIBIDN - -int mutt_idna_to_local (const char *in, char **out, int flags __attribute__ ((unused))) -{ - *out = m_strdup(in); - return 1; -} - -int mutt_local_to_idna (const char *in, char **out) -{ - *out = m_strdup(in); - return 0; -} - -#else - -int mutt_idna_to_local (const char *in, char **out, int flags) +static int mutt_idna_to_local (const char *in, char **out, int flags) { +#ifdef HAVE_LIBIDN *out = NULL; if (!option (OPTUSEIDN)) @@ -80,12 +65,14 @@ int mutt_idna_to_local (const char *in, char **out, int flags) notrans: p_delete(out); +#endif *out = m_strdup(in); return 1; } -int mutt_local_to_idna (const char *in, char **out) +static int mutt_local_to_idna (const char *in, char **out) { +#ifdef HAVE_LIBIDN int rv = 0; char *tmp = m_strdup(in); @@ -107,10 +94,11 @@ int mutt_local_to_idna (const char *in, char **out) *out = m_strdup(in); } return rv; -} - +#else + *out = m_strdup(in); + return 0; #endif - +} /* higher level functions */ diff --git a/mutt_idna.h b/mutt_idna.h index 777130f..15dec33 100644 --- a/mutt_idna.h +++ b/mutt_idna.h @@ -14,9 +14,6 @@ #define MI_MAY_BE_IRREVERSIBLE (1 << 0) -int mutt_idna_to_local (const char *, char **, int); -int mutt_local_to_idna (const char *, char **); - int mutt_addrlist_to_idna (address_t *, char **); int mutt_addrlist_to_local (address_t *);