| 848 for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { |
848 for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { |
| 849 sh = tmp->data; |
849 sh = tmp->data; |
| 850 |
850 |
| 851 /* TODO: deal with zeroconf proxies */ |
851 /* TODO: deal with zeroconf proxies */ |
| 852 |
852 |
| 853 if (!(sh->jid && sh->host && sh->port > 0)) |
853 if (!sh->jid) { |
| 854 continue; |
854 continue; |
| 855 |
855 } else if (!sh->host) { |
| 856 purple_debug_info( |
856 continue; |
| 857 "jabber", |
857 } else if (sh->port <= 0) { |
| 858 "jabber_si_xfer_bytestreams_send_local_info() will be looking " |
858 continue; |
| 859 "at jsx %p: jsx->streamhosts %p and sh->jid %p\n", |
859 } else if (g_list_find_custom(jsx->streamhosts, sh->jid, |
| 860 jsx, jsx->streamhosts, sh->jid); |
860 jabber_si_compare_jid) != NULL) { |
| 861 if (g_list_find_custom(jsx->streamhosts, sh->jid, |
|
| 862 jabber_si_compare_jid) != NULL) { |
|
| 863 continue; |
861 continue; |
| 864 } |
862 } |
| 865 |
863 |
| 866 streamhost_count++; |
864 streamhost_count++; |
| 867 streamhost = purple_xmlnode_new_child(query, "streamhost"); |
865 streamhost = purple_xmlnode_new_child(query, "streamhost"); |
| 944 g_clear_object(&jsx->service); |
942 g_clear_object(&jsx->service); |
| 945 } |
943 } |
| 946 } |
944 } |
| 947 |
945 |
| 948 if (jsx->service) { |
946 if (jsx->service) { |
| 949 GList *l = NULL; |
|
| 950 gchar *public_ip; |
947 gchar *public_ip; |
| 951 gboolean has_public_ip = FALSE; |
948 |
| 952 |
949 /* Include the localhost's IPs (for in-network transfers) */ |
| |
950 local_ips = purple_network_get_all_local_system_ips(); |
| |
951 |
| |
952 /* Include the public IP (assuming there is a port mapped somehow) */ |
| 953 public_ip = purple_network_get_my_ip_from_gio( |
953 public_ip = purple_network_get_my_ip_from_gio( |
| 954 G_SOCKET_CONNECTION(jsx->js->stream)); |
954 G_SOCKET_CONNECTION(jsx->js->stream)); |
| 955 |
955 if (!purple_strequal(public_ip, "0.0.0.0") && |
| 956 /* Include the localhost's IPs (for in-network transfers) */ |
956 g_list_find_custom(local_ips, public_ip, (GCompareFunc)g_strcmp0) == |
| 957 local_ips = purple_network_get_all_local_system_ips(); |
957 NULL) { |
| 958 for (l = local_ips; l; l = l->next) { |
|
| 959 gchar *local_ip = l->data; |
|
| 960 if (purple_strequal(local_ip, public_ip)) { |
|
| 961 has_public_ip = TRUE; |
|
| 962 } |
|
| 963 } |
|
| 964 |
|
| 965 /* Include the public IP (assuming there is a port mapped somehow) */ |
|
| 966 if (!has_public_ip && !purple_strequal(public_ip, "0.0.0.0")) { |
|
| 967 local_ips = g_list_append(local_ips, public_ip); |
958 local_ips = g_list_append(local_ips, public_ip); |
| |
959 } else { |
| |
960 g_free(public_ip); |
| 968 } |
961 } |
| 969 |
962 |
| 970 g_signal_connect( |
963 g_signal_connect( |
| 971 G_OBJECT(jsx->service), "incoming", |
964 G_OBJECT(jsx->service), "incoming", |
| 972 G_CALLBACK(jabber_si_xfer_bytestreams_send_connected_cb), NULL); |
965 G_CALLBACK(jabber_si_xfer_bytestreams_send_connected_cb), NULL); |