changeset 11411:8caea199b018

[gaim-migrate @ 13648] adding stun committer: Tailor Script <tailor@pidgin.im>
author Thomas Butter <tbutter>
date Thu, 01 Sep 2005 18:47:49 +0000
parents bc374facaeb2
children 4be6232ffcd3
files src/network.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/network.c	Thu Sep 01 15:28:43 2005 +0000
+++ b/src/network.c	Thu Sep 01 18:47:49 2005 +0000
@@ -29,6 +29,7 @@
 #include "account.h"
 #include "network.h"
 #include "prefs.h"
+#include "stun.h"
 #include "upnp.h"
 
 
@@ -68,11 +69,17 @@
 gaim_network_get_public_ip(void)
 {
 	const char *ip;
+	struct stun_nattype *stun;
 
 	ip = gaim_prefs_get_string("/core/network/public_ip");
 
-	if (ip == NULL || *ip == '\0')
+	if (ip == NULL || *ip == '\0') {
+		/* Check if STUN discovery was already done */
+		stun = gaim_stun_discover(NULL);
+		if(stun && stun->status>1)
+			return stun->publicip;
 		return NULL;
+	}	
 
 	return ip;
 }