Mercurial > pidgin
diff src/network.c @ 8838:518455386538
[gaim-migrate @ 9604]
-Fix the compile error in perl that was my fault
-Rename a network.c function and change it's signature (is that work
applicable in c?)
-Make rendezvous crash when trying to sign on
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Wed, 28 Apr 2004 03:16:40 +0000 |
| parents | beb7be215db3 |
| children | 01c3db200c8f |
line wrap: on
line diff
--- a/src/network.c Wed Apr 28 03:10:31 2004 +0000 +++ b/src/network.c Wed Apr 28 03:16:40 2004 +0000 @@ -30,11 +30,35 @@ #include "network.h" #include "prefs.h" +const unsigned char * +gaim_network_ip_atoi(const char *ip) +{ + static unsigned char ret[4]; + gchar delimiter = '.'; + gchar **split; + int i; + + g_return_val_if_fail(ip != NULL, NULL); + + split = g_strsplit(ip, &delimiter, 4); + for (i = 0; split[i] != NULL; i++) + ret[i] = atoi(split[i]); + g_strfreev(split); + + /* i should always be 4 */ + if (i != 4) + return NULL; + + return ret; +} + void gaim_network_set_public_ip(const char *ip) { g_return_if_fail(ip != NULL); + /* XXX - Ensure the IP address is valid */ + gaim_prefs_set_string("/core/network/public_ip", ip); } @@ -69,6 +93,7 @@ tmp = inet_ntoa(addr.sin_addr); strncpy(ip, tmp, sizeof(ip)); + return ip; } @@ -106,7 +131,7 @@ } const char * -gaim_network_get_ip_for_account(const GaimAccount *account, int fd) +gaim_network_get_my_ip(int fd) { const char *ip = NULL;
