diff libpurple/network.h @ 27711:7fbf964c6c6c

Move the IDN support into the DNS routines. This turned out to be cleaner than I first thought, so here we go. All libpurple DNS routines support IDN when built against GNU libidn.
author Paul Aurich <paul@darkrain42.org>
date Sun, 19 Jul 2009 23:45:13 +0000
parents 6e4afab5576d
children c55bba399426
line wrap: on
line diff
--- a/libpurple/network.h	Sun Jul 19 22:40:10 2009 +0000
+++ b/libpurple/network.h	Sun Jul 19 23:45:13 2009 +0000
@@ -268,6 +268,25 @@
 void purple_network_remove_port_mapping(gint fd);	
 
 /**
+ * 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.
+ *
+ * @param in      The hostname to be converted.
+ * @param out     The output buffer where an allocated string will be returned.
+ *                The caller is responsible for freeing this.
+ * @returns       0 on success, -1 if the out is NULL, or an error code
+ *                that currently corresponds to the Idna_rc enum in libidn.
+ * @since 2.6.0
+ */
+int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out);
+
+/**
  * Initializes the network subsystem.
  */
 void purple_network_init(void);