40#ifdef HAVE_STRINGPREP_H
41#include <stringprep.h>
42#elif defined(HAVE_IDN_STRINGPREP_H)
43#include <idn/stringprep.h>
45#define IDN2_SKIP_LIBIDN_COMPAT
48#elif defined(HAVE_IDN_IDN2_H)
50#elif defined(HAVE_IDN_IDNA_H)
68 while ((domain = strchr(domain,
'.')))
91 if (!input || !output)
94 return idn2_to_ascii_8z(input, output, flags | IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL);
118 char *mailbox = NULL;
119 char *reversed_user = NULL, *reversed_domain = NULL;
126 bool is_idn_encoded =
check_idn(local_domain);
128 if (is_idn_encoded && c_idn_decode)
130 if (idn2_to_unicode_8z8z(local_domain, &tmp, IDN2_ALLOW_UNASSIGNED) != IDN2_OK)
162 user, reversed_user);
179 if (is_idn_encoded && c_idn_decode)
181 if (idn2_to_ascii_8z(reversed_domain, &tmp,
182 IDN2_ALLOW_UNASSIGNED | IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL) != IDN2_OK)
195 domain, reversed_domain);
201 sprintf(mailbox,
"%s@%s",
NONULL(local_user),
NONULL(local_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)
256 sprintf(mailbox,
"%s@%s",
NONULL(intl_user),
NONULL(intl_domain));
275 static char vstring[256] = { 0 };
277 snprintf(vstring,
sizeof(vstring),
"libidn2: %s (compiled with %s)",
278 idn2_check_version(NULL), IDN2_VERSION);
const char * cc_charset(void)
Get the cached value of $charset.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
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.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
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.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
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.