changeset 32215:32b2a17d2f92

Rename purple_network_listen_range_family() to purple_network_listen_range().
author andrew.victor@mxit.com
date Sat, 24 Sep 2011 20:48:59 +0000
parents 75d20c9836c1
children d2ef8926b960
files ChangeLog.API libpurple/network.c libpurple/network.h libpurple/plugins/perl/common/Network.xs libpurple/protocols/bonjour/bonjour_ft.c libpurple/protocols/irc/dcc_send.c libpurple/protocols/jabber/si.c libpurple/protocols/msn/slpcall.c libpurple/protocols/oscar/peer.c libpurple/protocols/simple/simple.c libpurple/protocols/yahoo/yahoo_filexfer.c libpurple/stun.c
diffstat 12 files changed, 28 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sat Sep 24 20:36:47 2011 +0000
+++ b/ChangeLog.API	Sat Sep 24 20:48:59 2011 +0000
@@ -58,6 +58,8 @@
 		* purple_connection_error now takes a PurpleConnectionError
 		  as the second parameter
 		* purple_network_listen_family renamed to purple_network_listen
+		* purple_network_listen_range_family renamed to
+		  purple_network_listen_range
 		* purple_notify_user_info_add_pair renamed to
 		  purple_notify_user_info_add_pair_html
 		* purple_notify_user_info_get_entries returns a GQueue instead of
--- a/libpurple/network.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/network.c	Sat Sep 24 20:48:59 2011 +0000
@@ -542,7 +542,7 @@
 }
 
 PurpleNetworkListenData *
-purple_network_listen_range_family(unsigned short start, unsigned short end,
+purple_network_listen_range(unsigned short start, unsigned short end,
                                    int socket_family, int socket_type,
                                    PurpleNetworkListenCallback cb,
                                    gpointer cb_data)
@@ -566,15 +566,6 @@
 	return ret;
 }
 
-PurpleNetworkListenData *
-purple_network_listen_range(unsigned short start, unsigned short end,
-                            int socket_type, PurpleNetworkListenCallback cb,
-                            gpointer cb_data)
-{
-	return purple_network_listen_range_family(start, end, AF_UNSPEC,
-	                                          socket_type, cb, cb_data);
-}
-
 void purple_network_listen_cancel(PurpleNetworkListenData *listen_data)
 {
 	if (listen_data->mapping_data != NULL)
--- a/libpurple/network.h	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/network.h	Sat Sep 24 20:48:59 2011 +0000
@@ -183,11 +183,22 @@
  * the listening socket, and add a new watcher on the new socket accept
  * returned.
  *
+ * Libpurple does not currently do any port mapping (stateful firewall hole
+ * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped
+ * addresses, a mapping is done).
+ *
  * @param start The port number to bind to, or 0 to pick a random port.
  *              Users are allowed to override this arg in prefs.
  * @param end The highest possible port in the range of ports to listen on,
  *            or 0 to pick a random port.  Users are allowed to override this
  *            arg in prefs.
+ * @param socket_family The protocol family of the socket.  This should be
+ *                      AF_INET for IPv4 or AF_INET6 for IPv6.  IPv6 sockets
+ *                      may or may not be able to accept IPv4 connections
+ *                      based on the system configuration (use
+ *                      purple_socket_speaks_ipv4 to check).  If an IPv6
+ *                      socket doesn't accept V4-mapped addresses, you will
+ *                      need a second listener to support both v4 and v6.
  * @param socket_type The type of socket to open for listening.
  *   This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP.
  * @param cb The callback to be invoked when the port to listen on is available.
@@ -199,29 +210,7 @@
  *         the pending listener, or NULL if unable to obtain a local
  *         socket to listen on.
  */
-PurpleNetworkListenData *purple_network_listen_range(unsigned short start,
-		unsigned short end, int socket_type,
-		PurpleNetworkListenCallback cb, gpointer cb_data);
-
-/**
- * \copydoc purple_network_listen_range
- *
- * Libpurple does not currently do any port mapping (stateful firewall hole
- * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped
- * addresses, a mapping is done).
- *
- * @param socket_family The protocol family of the socket.  This should be
- *                      AF_INET for IPv4 or AF_INET6 for IPv6.  IPv6 sockets
- *                      may or may not be able to accept IPv4 connections
- *                      based on the system configuration (use
- *                      purple_socket_speaks_ipv4 to check).  If an IPv6
- *                      socket doesn't accept V4-mapped addresses, you will
- *                      need a second listener to support both v4 and v6.
- * @since 2.7.0
- * @deprecated This function will be renamed to purple_network_listen_range
- *             in 3.0.0.
- */
-PurpleNetworkListenData *purple_network_listen_range_family(
+PurpleNetworkListenData *purple_network_listen_range(
 	unsigned short start, unsigned short end, int socket_family,
 	int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data);
 
--- a/libpurple/plugins/perl/common/Network.xs	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/plugins/perl/common/Network.xs	Sat Sep 24 20:48:59 2011 +0000
@@ -31,9 +31,10 @@
 	gpointer cb_data
 
 Purple::NetworkListenData
-purple_network_listen_range(start, end, socket_type, cb, cb_data)
+purple_network_listen_range(start, end, socket_family, socket_type, cb, cb_data)
 	unsigned short start
 	unsigned short end
+	int socket_family
 	int socket_type
 	Purple::NetworkListenCallback cb
 	gpointer cb_data
--- a/libpurple/protocols/bonjour/bonjour_ft.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/bonjour/bonjour_ft.c	Sat Sep 24 20:48:59 2011 +0000
@@ -793,7 +793,7 @@
 	xf = purple_xfer_get_protocol_data(xfer);
 
 	purple_network_listen_map_external(FALSE);
-	xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
+	xf->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM,
 						      bonjour_bytestreams_listen, xfer);
 	purple_network_listen_map_external(TRUE);
 	if (xf->listen_data == NULL)
--- a/libpurple/protocols/irc/dcc_send.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/irc/dcc_send.c	Sat Sep 24 20:48:59 2011 +0000
@@ -339,7 +339,7 @@
 	purple_xfer_ref(xfer);
 
 	/* Create a listening socket */
-	xd->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
+	xd->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM,
 			irc_dccsend_network_listen_cb, xfer);
 	if (xd->listen_data == NULL) {
 		purple_xfer_unref(xfer);
--- a/libpurple/protocols/jabber/si.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/jabber/si.c	Sat Sep 24 20:48:59 2011 +0000
@@ -959,7 +959,7 @@
 		purple_debug_info("jabber", "Skipping attempting local streamhost.\n");
 		jsx->listen_data = NULL;
 	} else
-		jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
+		jsx->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM,
 				jabber_si_xfer_bytestreams_listen_cb, xfer);
 
 	if (jsx->listen_data == NULL) {
--- a/libpurple/protocols/msn/slpcall.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Sat Sep 24 20:48:59 2011 +0000
@@ -731,6 +731,7 @@
 
 			dc->listen_data = purple_network_listen_range(
 				0, 0,
+				AF_UNSPEC,
 				SOCK_STREAM,
 				msn_dc_listen_socket_created_cb,
 				dc
@@ -832,6 +833,7 @@
 
 		dc->listen_data = purple_network_listen_range(
 			0, 0,
+			AF_UNSPEC,
 			SOCK_STREAM,
 			msn_dc_listen_socket_created_cb,
 			dc
--- a/libpurple/protocols/oscar/peer.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/oscar/peer.c	Sat Sep 24 20:48:59 2011 +0000
@@ -842,7 +842,7 @@
 		 */
 		conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING;
 
-		conn->listen_data = purple_network_listen_range(5190, 5290, SOCK_STREAM,
+		conn->listen_data = purple_network_listen_range(5190, 5290, AF_UNSPEC, SOCK_STREAM,
 				peer_connection_establish_listener_cb, conn);
 		if (conn->listen_data != NULL)
 		{
--- a/libpurple/protocols/simple/simple.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/simple/simple.c	Sat Sep 24 20:48:59 2011 +0000
@@ -1823,7 +1823,7 @@
 	}
 
 	/* create socket for incoming connections */
-	sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM,
+	sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_DGRAM,
 				simple_udp_host_resolved_listen_cb, sip);
 	if (sip->listen_data == NULL) {
 		purple_connection_error(sip->gc,
@@ -1893,7 +1893,7 @@
 	/* TCP case */
 	if(!sip->udp) {
 		/* create socket for incoming connections */
-		sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM,
+		sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_STREAM,
 					simple_tcp_connect_listen_cb, sip);
 		if (sip->listen_data == NULL) {
 			purple_connection_error(sip->gc,
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Sat Sep 24 20:48:59 2011 +0000
@@ -1570,7 +1570,7 @@
 
 	p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer));
 	if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER )
-		if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer))
+		if(purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer))
 			return;
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -1871,7 +1871,7 @@
 			purple_xfer_cancel_remote(xfer);
 			return;
 		}
-		if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) {
+		if(!purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) {
 			purple_xfer_cancel_remote(xfer);
 			return;
 		}
--- a/libpurple/stun.c	Sat Sep 24 20:36:47 2011 +0000
+++ b/libpurple/stun.c	Sat Sep 24 20:48:59 2011 +0000
@@ -338,7 +338,7 @@
 		return;
 	}
 
-	if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) {
+	if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, hbn_listen_cb, hosts)) {
 		while (hosts) {
 			hosts = g_slist_delete_link(hosts, hosts);
 			g_free(hosts->data);