X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mutt_idna.c;h=4c9dc50b7a5b4f01fc4ceb968eb9d15a3c55d0ff;hp=686e849b0181d60f7abe9aaaab152a885393ab5d;hb=e1ffef197d9dc7fdc79f9149c123f4cd0809ab63;hpb=16534e98723674fa391e3fc29d2a07ce419c13dd diff --git a/mutt_idna.c b/mutt_idna.c index 686e849..4c9dc50 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)) @@ -48,7 +33,7 @@ int mutt_idna_to_local (const char *in, char **out, int flags) /* Is this the right function? Interesting effects with some bad identifiers! */ if (idna_to_unicode_8z8z (in, out, 1) != IDNA_SUCCESS) goto notrans; - if (mutt_convert_string (out, "utf-8", MCharset.charset, M_ICONV_HOOK_TO) == -1) + if (mutt_convert_string (out, "utf-8", mod_cset.charset, M_ICONV_HOOK_TO) == -1) goto notrans; /* @@ -61,7 +46,7 @@ int mutt_idna_to_local (const char *in, char **out, int flags) char *t2 = NULL; char *tmp = m_strdup(*out); - if (mutt_convert_string (&tmp, MCharset.charset, "utf-8", M_ICONV_HOOK_FROM) == -1) + if (mutt_convert_string (&tmp, mod_cset.charset, "utf-8", M_ICONV_HOOK_FROM) == -1) irrev = 1; if (!irrev && idna_to_ascii_8z (tmp, &t2, 1) != IDNA_SUCCESS) irrev = 1; @@ -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); @@ -96,7 +83,7 @@ int mutt_local_to_idna (const char *in, char **out) return -1; } - if (mutt_convert_string (&tmp, MCharset.charset, "utf-8", M_ICONV_HOOK_FROM) == -1) + if (mutt_convert_string (&tmp, mod_cset.charset, "utf-8", M_ICONV_HOOK_FROM) == -1) rv = -1; if (!rv && idna_to_ascii_8z (tmp, out, 1) != IDNA_SUCCESS) rv = -2; @@ -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 */