comparison src/network.c @ 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 d3755a7ddd82
children e1ab173ef3b5
comparison
equal deleted inserted replaced
11410:bc374facaeb2 11411:8caea199b018
27 27
28 #include "debug.h" 28 #include "debug.h"
29 #include "account.h" 29 #include "account.h"
30 #include "network.h" 30 #include "network.h"
31 #include "prefs.h" 31 #include "prefs.h"
32 #include "stun.h"
32 #include "upnp.h" 33 #include "upnp.h"
33 34
34 35
35 const unsigned char * 36 const unsigned char *
36 gaim_network_ip_atoi(const char *ip) 37 gaim_network_ip_atoi(const char *ip)
66 67
67 const char * 68 const char *
68 gaim_network_get_public_ip(void) 69 gaim_network_get_public_ip(void)
69 { 70 {
70 const char *ip; 71 const char *ip;
72 struct stun_nattype *stun;
71 73
72 ip = gaim_prefs_get_string("/core/network/public_ip"); 74 ip = gaim_prefs_get_string("/core/network/public_ip");
73 75
74 if (ip == NULL || *ip == '\0') 76 if (ip == NULL || *ip == '\0') {
75 return NULL; 77 /* Check if STUN discovery was already done */
78 stun = gaim_stun_discover(NULL);
79 if(stun && stun->status>1)
80 return stun->publicip;
81 return NULL;
82 }
76 83
77 return ip; 84 return ip;
78 } 85 }
79 86
80 static const char * 87 static const char *