41#ifdef HAVE_STRINGPREP_H
42#include <stringprep.h>
43#elif defined(HAVE_IDN_STRINGPREP_H)
44#include <idn/stringprep.h>
46#define IDN2_SKIP_LIBIDN_COMPAT
49#elif defined(HAVE_IDN_IDN2_H)
51#elif defined(HAVE_IDN_IDNA_H)
69 while ((domain = strchr(domain,
'.')))
92 if (!input || !output)
95 return idn2_to_ascii_8z(input, output, flags | IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL);
119 char *mailbox = NULL;
120 char *reversed_user = NULL, *reversed_domain = NULL;
127 bool is_idn_encoded =
check_idn(local_domain);
129 if (is_idn_encoded && c_idn_decode)
131 if (idn2_to_unicode_8z8z(local_domain, &tmp, IDN2_ALLOW_UNASSIGNED) != IDN2_OK)
163 user, reversed_user);
180 if (is_idn_encoded && c_idn_decode)
182 if (idn2_to_ascii_8z(reversed_domain, &tmp,
183 IDN2_ALLOW_UNASSIGNED | IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL) != IDN2_OK)
196 domain, reversed_domain);
207 FREE(&reversed_domain);
208 FREE(&reversed_user);
229 char *mailbox = NULL;
246 if (idn2_to_ascii_8z(intl_domain, &tmp,
247 IDN2_ALLOW_UNASSIGNED | IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL) != IDN2_OK)
274 static char vstring[256] = { 0 };
276 snprintf(vstring,
sizeof(vstring),
"%s (compiled with %s)",
277 idn2_check_version(NULL), IDN2_VERSION);
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
const char * cc_charset(void)
Get the cached value of $charset.
Convenience wrapper for the core headers.
#define mutt_debug(LEVEL,...)
Handling of international domain names.
#define MI_MAY_BE_IRREVERSIBLE
const char * mutt_idna_print_version(void)
Create an IDN version string.
int mutt_idna_to_ascii_lz(const char *input, char **output, uint8_t flags)
Convert a domain to Punycode.
char * mutt_idna_local_to_intl(const char *user, const char *domain)
Convert an email's domain to Punycode.
static bool check_idn(char *domain)
Is domain in Punycode?
char * mutt_idna_intl_to_local(const char *user, const char *domain, uint8_t flags)
Convert an email's domain from Punycode.
@ LL_DEBUG1
Log at debug level 1.
int mutt_ch_convert_string(char **ps, const char *from, const char *to, uint8_t flags)
Convert a string between encodings.
#define MUTT_ICONV_NO_FLAGS
No flags are set.
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
int mutt_str_asprintf(char **strp, const char *fmt,...)
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.