--- a/libpurple/network.c Sat Nov 02 04:03:11 2019 -0400
+++ b/libpurple/network.c Sun Nov 03 16:26:09 2019 -0500
@@ -150,14 +150,12 @@
purple_network_get_local_system_ip_from_gio(GSocketConnection *sockconn)
GInetSocketAddress *inetsockaddr;
addr = g_socket_connection_get_local_address(sockconn, NULL);
if ((inetsockaddr = G_INET_SOCKET_ADDRESS(addr)) != NULL) {
@@ -165,14 +163,14 @@
g_inet_socket_address_get_address(inetsockaddr);
if (g_inet_address_get_family(inetaddr) == G_SOCKET_FAMILY_IPV4 &&
!g_inet_address_get_is_loopback(inetaddr)) {
- gchar *tmp = g_inet_address_to_string(inetaddr);
- g_snprintf(ip, 16, "%s", tmp);
+ ip = g_inet_address_to_string(inetaddr);
+ return g_strdup("0.0.0.0"); @@ -311,10 +309,10 @@
return purple_network_get_local_system_ip(fd);
purple_network_get_my_ip_from_gio(GSocketConnection *sockconn)
+ const gchar *ip = NULL; PurpleStunNatDiscovery *stun;
/* Check if the user specified an IP manually */
@@ -322,25 +320,25 @@
ip = purple_network_get_public_ip();
/* Make sure the IP address entered by the user is valid */
if ((ip != NULL) && (purple_network_is_ipv4(ip))) {
/* Check if STUN discovery was already done */
stun = purple_stun_discover(NULL);
if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) {
+ return g_strdup(stun->publicip); /* Attempt to get the IP from a NAT device using UPnP */
ip = purple_upnp_get_public_ip();
/* Attempt to get the IP from a NAT device using NAT-PMP */
ip = purple_pmp_get_public_ip();
--- a/libpurple/network.h Sat Nov 02 04:03:11 2019 -0400
+++ b/libpurple/network.h Sun Nov 03 16:26:09 2019 -0500
@@ -126,13 +126,9 @@
* IP address returned by purple_network_get_local_system_ip_from_gio()
- * Note: The returned string is a pointer to a static buffer. If this
- * function is called twice, it may be important to make a copy
- * of the returned string.
* Returns: The local IP address to be used.
-const char *purple_network_get_my_ip_from_gio(GSocketConnection *sockconn);
+gchar *purple_network_get_my_ip_from_gio(GSocketConnection *sockconn); --- a/libpurple/protocols/jabber/si.c Sat Nov 02 04:03:11 2019 -0400
+++ b/libpurple/protocols/jabber/si.c Sun Nov 03 16:26:09 2019 -0500
@@ -429,7 +429,7 @@
char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/
purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_again_cb\n");
@@ -528,6 +528,8 @@
jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer));
jabber_si_xfer_bytestreams_send_read_again_resp_cb(xfer, source,
@@ -858,7 +860,7 @@
purple_network_get_all_local_system_ips();
gboolean has_public_ip = FALSE;
jsx->local_streamhost_fd = sock;
@@ -895,6 +897,7 @@
/* The listener for the local proxy */
purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ,