From ad3eb6918326118a67cc7a94b8fc2483ed1bfe20 Mon Sep 17 00:00:00 2001
From: Brendan Cully <brendan@kublai.com>
Date: Tue, 7 Oct 2008 15:27:28 -0700
Subject: [PATCH] Build no-op versions of new IDN functions if IDN is
 unavailable. Closes #3122, #3123.

---
 mutt_idna.c |  7 +++----
 mutt_idna.h | 18 ++++++++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/mutt_idna.c b/mutt_idna.c
index 47839e1c..f7aa57e0 100644
--- a/mutt_idna.c
+++ b/mutt_idna.c
@@ -39,7 +39,7 @@ int mutt_local_to_idna (const char *in, char **out)
   *out = safe_strdup (in);
   return 0;
 }
-			
+
 #else
 
 /* check whether an address is an IDN */
@@ -148,9 +148,6 @@ int mutt_local_to_idna (const char *in, char **out)
   return rv;
 }
 
-#endif
-
-
 /* higher level functions */
 
 static int mbox_to_udomain (const char *mbx, char **user, char **domain)
@@ -298,3 +295,5 @@ int mutt_env_to_idna (ENVELOPE *env, char **tag, char **err)
 }
 
 #undef H_TO_IDNA
+
+#endif /* HAVE_LIBIDN */
diff --git a/mutt_idna.h b/mutt_idna.h
index 8a57d60e..6027c808 100644
--- a/mutt_idna.h
+++ b/mutt_idna.h
@@ -31,6 +31,9 @@
 int mutt_idna_to_local (const char *, char **, int);
 int mutt_local_to_idna (const char *, char **);
 
+/* Work around incompatibilities in the libidn API */
+
+#ifdef HAVE_LIBIDN
 int mutt_addrlist_to_idna (ADDRESS *, char **);
 int mutt_addrlist_to_local (ADDRESS *);
 
@@ -39,9 +42,6 @@ int mutt_env_to_idna (ENVELOPE *, char **, char **);
 
 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
@@ -51,6 +51,16 @@ const char *mutt_addr_for_display (ADDRESS *a);
 # 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
+#else
+
+#define mutt_addrlist_to_idna(addr, err) 0
+#define mutt_addrlist_to_local(addr) 0
+
+#define mutt_env_to_local(env)
+#define mutt_env_to_idna(env, tag, err) 0
+
+#define mutt_addr_for_display(a) (a->mailbox)
+
+#endif /* HAVE_LIBIDN */
 
 #endif
-- 
2.40.0