| 132 } |
132 } |
| 133 |
133 |
| 134 const char * |
134 const char * |
| 135 gaim_network_get_my_ip(int fd) |
135 gaim_network_get_my_ip(int fd) |
| 136 { |
136 { |
| 137 const char *ip = NULL; |
137 char *ip = NULL; |
| 138 const char *controlURL = NULL; |
138 char *controlURL = NULL; |
| 139 |
139 |
| 140 /* Check if the user specified an IP manually */ |
140 /* Check if the user specified an IP manually */ |
| 141 if (!gaim_prefs_get_bool("/core/network/auto_ip")) { |
141 if (!gaim_prefs_get_bool("/core/network/auto_ip")) { |
| 142 ip = gaim_network_get_public_ip(); |
142 ip = gaim_network_get_public_ip(); |
| 143 if (ip != NULL) |
143 if (ip != NULL) |
| 234 if((controlURL = gaim_upnp_discover()) != NULL) { |
235 if((controlURL = gaim_upnp_discover()) != NULL) { |
| 235 if(!gaim_upnp_set_port_mapping(controlURL, port, "TCP")) { |
236 if(!gaim_upnp_set_port_mapping(controlURL, port, "TCP")) { |
| 236 gaim_upnp_remove_port_mapping(controlURL, port, "TCP"); |
237 gaim_upnp_remove_port_mapping(controlURL, port, "TCP"); |
| 237 gaim_upnp_set_port_mapping(controlURL, port, "TCP"); |
238 gaim_upnp_set_port_mapping(controlURL, port, "TCP"); |
| 238 } |
239 } |
| |
240 free(controlURL); |
| 239 } |
241 } |
| 240 |
242 |
| 241 gaim_debug_info("network", "Listening on port: %hu\n", gaim_network_get_port_from_fd(listenfd)); |
243 gaim_debug_info("network", "Listening on port: %hu\n", gaim_network_get_port_from_fd(listenfd)); |
| 242 return listenfd; |
244 return listenfd; |
| 243 } |
245 } |