Mercurial > pidgin.yaz
changeset 6270:1bf6fd117797
[gaim-migrate @ 6767]
IRC should now use the new IP code. Or it'll break horribly and nobody's
DCC sends will work. One of those.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 22 Jul 2003 08:23:51 +0000 |
parents | 0a902bd3e170 |
children | 08672f5033a7 |
files | src/protocols/irc/irc.c |
diffstat | 1 files changed, 5 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/irc/irc.c Tue Jul 22 08:22:08 2003 +0000 +++ b/src/protocols/irc/irc.c Tue Jul 22 08:23:51 2003 +0000 @@ -2566,29 +2566,6 @@ *se = "offline"; } -static int -getlocalip(char *ip) /* Thanks, libfaim */ -{ - struct hostent *hptr; - char localhost[129]; - long unsigned add; - - /* XXX if available, use getaddrinfo() */ - /* XXX allow client to specify which IP to use for multihomed boxes */ - - if (gethostname(localhost, 128) < 0) - return -1; - - if (!(hptr = gethostbyname(localhost))) - return -1; - - memcpy(&add, hptr->h_addr_list[0], 4); - add = htonl(add); - g_snprintf(ip, 11, "%lu", add); - - return 0; -} - static void dcc_chat_connected(gpointer data, gint source, GdkInputCondition condition) { @@ -2851,6 +2828,7 @@ int len; struct sockaddr_in addr; char buf[IRC_BUF_LEN]; + const char *ip; /* Create a socket */ chat = g_new0 (struct dcc_chat, 1); @@ -2869,7 +2847,10 @@ len = sizeof (addr); getsockname (chat->fd, (struct sockaddr *) &addr, &len); chat->port = ntohs (addr.sin_port); - getlocalip(chat->ip_address); + + ip = gaim_xfers_get_ip_for_account(gaim_connection_get_account(gc)); + strncpy(chat->ip_address, ip, INET6_ADDRSTRLEN); + chat->inpa = gaim_input_add (chat->fd, GAIM_INPUT_READ, dcc_chat_connected, chat);