[gmime] Migrate IDN logic to libidn2
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Migrate IDN logic to libidn2
- Date: Mon, 21 May 2018 23:52:50 +0000 (UTC)
commit ebde0627c3bfaa2dbb9c5b9ffb5cae41d80b6264
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Sun May 20 09:56:26 2018 -0400
Migrate IDN logic to libidn2
Fixes issue #48
README.md | 6 +++---
configure.ac | 8 ++++----
gmime/gmime-utils.c | 4 ++--
gmime/internet-address.c | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/README.md b/README.md
index c1e02b3..7493a52 100644
--- a/README.md
+++ b/README.md
@@ -74,10 +74,10 @@ are REQUIRED:
The following packages are RECOMMENDED:
- - Libidn
+ - Libidn2 >= 2.0.0
- Libidn provides APIs needed for encoding and decoding Internationalized
- Domain Names. Libidn sources may be obtained from:
+ Libidn2 provides APIs needed for encoding and decoding Internationalized
+ Domain Names. Libidn2 sources may be obtained from:
https://www.gnu.org/software/libidn/#downloading
- GPGME >= 1.8.0 (will build with 1.2.0, but will be missing some functionality)
diff --git a/configure.ac b/configure.ac
index b2a6c6f..32feecf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -509,14 +509,14 @@ AS_IF([test "x$enable_crypto" = "xyes"], [
])
AM_CONDITIONAL(ENABLE_CRYPTO, test "x$enable_crypto" != "xno")
-dnl *****************************
-dnl *** Checks for GNU Libidn ***
-dnl *****************************
+dnl ******************************
+dnl *** Checks for GNU Libidn2 ***
+dnl ******************************
AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
[Support IDN (needs GNU Libidn)]),
libidn=$withval, libidn=yes)
if test "$libidn" != "no" ; then
- PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
+ PKG_CHECK_MODULES(LIBIDN, libidn2 >= 2.0.0, [libidn=yes], [libidn=no])
if test "$libidn" != "yes" ; then
libidn=no
AC_MSG_WARN([Libidn not found])
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index b5ccb37..d91909e 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -51,7 +51,7 @@
#include <errno.h>
#ifdef LIBIDN
-#include <idna.h>
+#include <idn2.h>
#endif
#include "gmime-utils.h"
@@ -857,7 +857,7 @@ g_mime_utils_generate_message_id (const char *fqdn)
g_string_append_c (msgid, '@');
#ifdef LIBIDN
- if (idna_to_ascii_8z (fqdn, &ascii, 0) == IDNA_SUCCESS) {
+ if (idn2_to_ascii_8z (fqdn, &ascii, 0) == IDN2_OK) {
g_string_append (msgid, ascii);
free (ascii);
} else {
diff --git a/gmime/internet-address.c b/gmime/internet-address.c
index 37dbf42..31b1e56 100644
--- a/gmime/internet-address.c
+++ b/gmime/internet-address.c
@@ -30,7 +30,7 @@
#include <errno.h>
#ifdef LIBIDN
-#include <idna.h>
+#include <idn2.h>
#endif
#include "internet-address.h"
@@ -465,7 +465,7 @@ internet_address_mailbox_get_idn_addr (InternetAddressMailbox *mailbox)
if (!mailbox->idn_addr && mailbox->at > 0) {
encoded = g_string_new ("");
g_string_append_len (encoded, mailbox->addr, mailbox->at + 1);
- if (idna_to_ascii_8z (mailbox->addr + mailbox->at + 1, &ascii, 0) == IDNA_SUCCESS) {
+ if (idn2_to_ascii_8z (mailbox->addr + mailbox->at + 1, &ascii, 0) == IDN2_OK) {
g_string_append (encoded, ascii);
free (ascii);
} else {
@@ -1547,7 +1547,7 @@ dotatom_parse (GString *str, const char **in, const char *sentinels)
if (domain != str) {
char *unicode;
- if (idna_to_unicode_8z8z (domain->str, &unicode, 0) == IDNA_SUCCESS) {
+ if (idn2_to_unicode_8z8z (domain->str, &unicode, 0) == IDN2_OK) {
g_string_append (str, unicode);
free (unicode);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]