Mon, 05 Nov 2018 18:57:24 -0600
network: Drop unused purple_network_convert_idn_to_ascii()
purple_network_convert_idn_to_ascii() isn't used in tree. GLib has
g_hostname_to_ascii(), which seems to do the same thing. This patch
removes the former in favor of the latter. As a result, libidn is
no longer a direct dependency of libpurple, only the Jabber prpl.
| ChangeLog.API | file | annotate | diff | comparison | revisions | |
| libpurple/network.c | file | annotate | diff | comparison | revisions | |
| libpurple/network.h | file | annotate | diff | comparison | revisions |
--- a/ChangeLog.API Fri Nov 02 01:37:22 2018 +0000 +++ b/ChangeLog.API Mon Nov 05 18:57:24 2018 -0600 @@ -429,6 +429,8 @@ * PurpleEventLoopUiOps. Manually drive the GLib event loop yourself. See GLib Main Event Loop docs. * purple_get_tzoff_str(). Use g_date_time_format, instead. + * purple_network_convert_idn_to_ascii. Use g_hostname_to_ascii, + instead. * purple_network_listen_family. Use purple_network_listen, instead. * purple_network_listen_map_external * purple_network_listen_range_family. Use purple_network_listen,
--- a/libpurple/network.c Fri Nov 02 01:37:22 2018 +0000 +++ b/libpurple/network.c Mon Nov 05 18:57:24 2018 -0600 @@ -49,10 +49,6 @@ #include "stun.h" #include "upnp.h" -#ifdef USE_IDN -#include <idna.h> -#endif - /* * Calling sizeof(struct ifreq) isn't always correct on * Mac OS X (and maybe others). @@ -712,32 +708,6 @@ } } -int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out) -{ -#ifdef USE_IDN - char *tmp; - int ret; - - g_return_val_if_fail(out != NULL, -1); - - ret = idna_to_ascii_8z(in, &tmp, IDNA_USE_STD3_ASCII_RULES); - if (ret != IDNA_SUCCESS) { - *out = NULL; - return ret; - } - - *out = g_strdup(tmp); - /* This *MUST* be freed with free, not g_free */ - free(tmp); - return 0; -#else - g_return_val_if_fail(out != NULL, -1); - - *out = g_strdup(in); - return 0; -#endif -} - gboolean _purple_network_set_common_socket_flags(int fd) {
--- a/libpurple/network.h Fri Nov 02 01:37:22 2018 +0000 +++ b/libpurple/network.h Mon Nov 05 18:57:24 2018 -0600 @@ -301,26 +301,6 @@ void purple_network_remove_port_mapping(gint fd); /** - * purple_network_convert_idn_to_ascii: - * @in: The hostname to be converted. - * @out: The output buffer where an allocated string will be returned. - * The caller is responsible for freeing this. - * - * Convert a UTF-8 domain name to ASCII in accordance with the IDNA - * specification. If libpurple is compiled without IDN support, this function - * copies the input into the output buffer. - * - * Because this function is used by DNS resolver child/threads, it uses no - * other libpurple API and is threadsafe. - * - * In general, a buffer of about 512 bytes is the appropriate size to use. - * - * Returns: 0 on success, -1 if the out is NULL, or an error code - * that currently corresponds to the Idna_rc enum in libidn. - */ -int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out); - -/** * purple_network_init: * * Initializes the network subsystem.