Build no-op versions of new IDN functions if IDN is unavailable.
authorBrendan Cully <brendan@kublai.com>
Tue, 7 Oct 2008 22:27:28 +0000 (15:27 -0700)
committerBrendan Cully <brendan@kublai.com>
Tue, 7 Oct 2008 22:27:28 +0000 (15:27 -0700)
Closes #3122, #3123.

mutt_idna.c
mutt_idna.h

index 47839e1cdcb1ac9558072d21a89adc4ebceede4f..f7aa57e0e5aae482fed7b0bf94cc4cd73e7f07f3 100644 (file)
@@ -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 */
index 8a57d60ef77c7d1479577bcf6698bb5ec83fb681..6027c808ad8c9c7f9e05ee1747f1b03d2ed37f16 100644 (file)
@@ -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