# HG changeset patch # User Sadrul Habib Chowdhury # Date 1196473152 0 # Node ID a4237a2117abedd02be85a9cd2e3b4908a0dd7fc # Parent 760a8e02414260de0014c505d75db69d8d1c4a74# Parent 65ef019c000b42f08a8df7410612b6b98ced904a merge of 'b4353646b7529c2dd814bc707b8b269efe420120' and 'cf97e20583ba14a840946c79a5d5182fb4a6648f' diff -r 760a8e024142 -r a4237a2117ab libpurple/network.c --- a/libpurple/network.c Fri Nov 30 22:36:33 2007 +0000 +++ b/libpurple/network.c Sat Dec 01 01:39:12 2007 +0000 @@ -182,22 +182,22 @@ /* Make sure the IP address entered by the user is valid */ if ((ip != NULL) && (purple_network_ip_atoi(ip) != NULL)) return ip; - } - - /* Check if STUN discovery was already done */ - stun = purple_stun_discover(NULL); - if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) - return stun->publicip; + } else { + /* Check if STUN discovery was already done */ + stun = purple_stun_discover(NULL); + if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) + return stun->publicip; - /* Attempt to get the IP from a NAT device using UPnP */ - ip = purple_upnp_get_public_ip(); - if (ip != NULL) - return ip; + /* Attempt to get the IP from a NAT device using UPnP */ + ip = purple_upnp_get_public_ip(); + if (ip != NULL) + return ip; - /* Attempt to get the IP from a NAT device using NAT-PMP */ - ip = purple_pmp_get_public_ip(); - if (ip != NULL) - return ip; + /* Attempt to get the IP from a NAT device using NAT-PMP */ + ip = purple_pmp_get_public_ip(); + if (ip != NULL) + return ip; + } /* Just fetch the IP of the local system */ return purple_network_get_local_system_ip(fd); @@ -362,7 +362,7 @@ listen_data->cb_data = cb_data; listen_data->socket_type = socket_type; - if (!listen_map_external) + if (!listen_map_external || !purple_prefs_get_bool("/purple/network/map_ports")) { purple_debug_info("network", "Skipping external port mapping.\n"); /* The pmp_map_cb does what we want to do */ @@ -677,11 +677,13 @@ purple_prefs_add_none ("/purple/network"); purple_prefs_add_bool ("/purple/network/auto_ip", TRUE); purple_prefs_add_string("/purple/network/public_ip", ""); + purple_prefs_add_bool ("/purple/network/map_ports", TRUE); purple_prefs_add_bool ("/purple/network/ports_range_use", FALSE); purple_prefs_add_int ("/purple/network/ports_range_start", 1024); purple_prefs_add_int ("/purple/network/ports_range_end", 2048); - purple_upnp_discover(NULL, NULL); + if(purple_prefs_get_bool("/purple/network/map_ports") || purple_prefs_get_bool("/purple/network/auto_ip")) + purple_upnp_discover(NULL, NULL); #ifdef HAVE_LIBNM nm_context = libnm_glib_init(); diff -r 760a8e024142 -r a4237a2117ab libpurple/protocols/bonjour/issues.txt --- a/libpurple/protocols/bonjour/issues.txt Fri Nov 30 22:36:33 2007 +0000 +++ b/libpurple/protocols/bonjour/issues.txt Sat Dec 01 01:39:12 2007 +0000 @@ -2,5 +2,4 @@ ============= Known issues =============== ========================================== -* File transfers * Typing notifications diff -r 760a8e024142 -r a4237a2117ab libpurple/protocols/bonjour/jabber.c --- a/libpurple/protocols/bonjour/jabber.c Fri Nov 30 22:36:33 2007 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Sat Dec 01 01:39:12 2007 +0000 @@ -620,7 +620,7 @@ } memset(&my_addr, 0, sizeof(struct sockaddr_in)); - my_addr.sin_family = PF_INET; + my_addr.sin_family = AF_INET; /* Attempt to find a free port */ bind_successful = FALSE; diff -r 760a8e024142 -r a4237a2117ab libpurple/protocols/bonjour/mdns_avahi.c --- a/libpurple/protocols/bonjour/mdns_avahi.c Fri Nov 30 22:36:33 2007 +0000 +++ b/libpurple/protocols/bonjour/mdns_avahi.c Sat Dec 01 01:39:12 2007 +0000 @@ -155,7 +155,7 @@ /* Make sure it isn't us */ if (purple_utf8_strcasecmp(name, account->username) != 0) { if (!avahi_service_resolver_new(avahi_service_browser_get_client(b), - interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, + interface, protocol, name, type, domain, AVAHI_PROTO_INET, 0, _resolver_callback, account)) { purple_debug_warning("bonjour", "_browser_callback -- Error initiating resolver: %s\n", avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); @@ -315,14 +315,14 @@ case PUBLISH_START: publish_result = avahi_entry_group_add_service_strlst( idata->group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_UNSPEC, 0, + AVAHI_PROTO_INET, 0, purple_account_get_username(data->account), ICHAT_SERVICE, NULL, NULL, data->port_p2pj, lst); break; case PUBLISH_UPDATE: publish_result = avahi_entry_group_update_service_txt_strlst( idata->group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_UNSPEC, 0, + AVAHI_PROTO_INET, 0, purple_account_get_username(data->account), ICHAT_SERVICE, NULL, lst); break; @@ -354,7 +354,7 @@ g_return_val_if_fail(idata != NULL, FALSE); - idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, ICHAT_SERVICE, NULL, 0, _browser_callback, data->account); + idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, ICHAT_SERVICE, NULL, 0, _browser_callback, data->account); if (!idata->sb) { purple_debug_error("bonjour", @@ -400,7 +400,7 @@ purple_account_get_username(data->account)); ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_UNSPEC, flags, svc_name, + AVAHI_PROTO_INET, flags, svc_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len); g_free(svc_name); @@ -486,7 +486,7 @@ name = g_strdup_printf("%s." ICHAT_SERVICE "local", buddy->name); idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC, - AVAHI_PROTO_UNSPEC, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, + AVAHI_PROTO_INET, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, _buddy_icon_record_cb, buddy); g_free(name); diff -r 760a8e024142 -r a4237a2117ab pidgin/gtkprefs.c --- a/pidgin/gtkprefs.c Fri Nov 30 22:36:33 2007 +0000 +++ b/pidgin/gtkprefs.c Sat Dec 01 01:39:12 2007 +0000 @@ -1211,6 +1211,9 @@ vbox = pidgin_make_frame (ret, _("Ports")); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + pidgin_prefs_checkbox(_("_Enable automatic router port forwarding"), + "/purple/network/map_ports", vbox); + ports_checkbox = pidgin_prefs_checkbox(_("_Manually specify range of ports to listen on"), "/purple/network/ports_range_use", vbox);