Mercurial > pidgin
diff libpurple/network.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 0c2efa69492b |
children |
line wrap: on
line diff
--- a/libpurple/network.c Sat Jun 02 02:30:13 2012 +0000 +++ b/libpurple/network.c Sat Jun 02 02:30:49 2012 +0000 @@ -391,14 +391,9 @@ return FALSE; } -static gboolean listen_map_external = TRUE; -void purple_network_listen_map_external(gboolean map_external) -{ - listen_map_external = map_external; -} - static PurpleNetworkListenData * -purple_network_do_listen(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) +purple_network_do_listen(unsigned short port, int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data) { int listenfd = -1; int flags; @@ -503,7 +498,7 @@ listen_data->cb_data = cb_data; listen_data->socket_type = socket_type; - if (!purple_socket_speaks_ipv4(listenfd) || !listen_map_external || + if (!purple_socket_speaks_ipv4(listenfd) || !map_external || !purple_prefs_get_bool("/purple/network/map_ports")) { purple_debug_info("network", "Skipping external port mapping.\n"); @@ -531,27 +526,19 @@ } PurpleNetworkListenData * -purple_network_listen_family(unsigned short port, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, +purple_network_listen(unsigned short port, int socket_family, int socket_type, + gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { g_return_val_if_fail(port != 0, NULL); - return purple_network_do_listen(port, socket_family, socket_type, + return purple_network_do_listen(port, socket_family, socket_type, map_external, cb, cb_data); } PurpleNetworkListenData * -purple_network_listen(unsigned short port, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data) -{ - return purple_network_listen_family(port, AF_UNSPEC, socket_type, - cb, cb_data); -} - -PurpleNetworkListenData * -purple_network_listen_range_family(unsigned short start, unsigned short end, - int socket_family, int socket_type, +purple_network_listen_range(unsigned short start, unsigned short end, + int socket_family, int socket_type, gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { @@ -566,7 +553,7 @@ } for (; start <= end; start++) { - ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, cb, cb_data); + ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, map_external, cb, cb_data); if (ret != NULL) break; } @@ -574,15 +561,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) @@ -1003,7 +981,7 @@ if (stun_server && stun_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for STUN server\n"); - purple_dnsquery_a_account(NULL, stun_server, 3478, purple_network_ip_lookup_cb, + purple_dnsquery_a(NULL, stun_server, 3478, purple_network_ip_lookup_cb, &stun_ip); } else { purple_debug_info("network", @@ -1021,7 +999,7 @@ if (turn_server && turn_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for TURN server\n"); - purple_dnsquery_a_account(NULL, turn_server, + purple_dnsquery_a(NULL, turn_server, purple_prefs_get_int("/purple/network/turn_port"), purple_network_ip_lookup_cb, &turn_ip); } else {