264 |
/* for receiving (chat or file), connect to listening host */ |
/* for receiving (chat or file), connect to listening host */ |
265 |
if (DCC_IS_RECV(ptr_dcc->type)) |
if (DCC_IS_RECV(ptr_dcc->type)) |
266 |
{ |
{ |
267 |
if (cfg_proxy_use) |
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1) |
268 |
|
return 0; |
269 |
|
if (cfg_proxy_use) |
270 |
{ |
{ |
271 |
memset (&addr, 0, sizeof (addr)); |
memset (&addr, 0, sizeof (addr)); |
272 |
addr.sin_addr.s_addr = htonl (ptr_dcc->addr); |
addr.sin_addr.s_addr = htonl (ptr_dcc->addr); |
273 |
ip4 = inet_ntoa(addr.sin_addr); |
ip4 = inet_ntoa(addr.sin_addr); |
274 |
|
|
275 |
memset (&addr, 0, sizeof (addr)); |
memset (&addr, 0, sizeof (addr)); |
276 |
addr.sin_port = htons (cfg_proxy_port); |
addr.sin_port = htons (cfg_proxy_port); |
277 |
addr.sin_family = AF_INET; |
addr.sin_family = AF_INET; |
278 |
if ((hostent = gethostbyname (cfg_proxy_address)) == NULL) |
if ((hostent = gethostbyname (cfg_proxy_address)) == NULL) |
279 |
return 0; |
return 0; |
280 |
memcpy(&(addr.sin_addr),*(hostent->h_addr_list), sizeof(struct in_addr)); |
memcpy(&(addr.sin_addr),*(hostent->h_addr_list), sizeof(struct in_addr)); |
281 |
|
connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)); |
282 |
if (connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)) == -1) |
if (pass_proxy(ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1) |
283 |
return 0; |
return 0; |
|
if (pass_proxy(ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1) |
|
|
return 0; |
|
284 |
} |
} |
285 |
else |
else |
286 |
{ |
{ |
287 |
memset (&addr, 0, sizeof (addr)); |
memset (&addr, 0, sizeof (addr)); |
288 |
addr.sin_port = htons (ptr_dcc->port); |
addr.sin_port = htons (ptr_dcc->port); |
289 |
addr.sin_family = AF_INET; |
addr.sin_family = AF_INET; |
290 |
addr.sin_addr.s_addr = htonl (ptr_dcc->addr); |
addr.sin_addr.s_addr = htonl (ptr_dcc->addr); |
291 |
if (connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)) == -1) |
connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)); |
292 |
return 0; |
} |
|
} |
|
|
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1) |
|
|
return 0; |
|
293 |
} |
} |
294 |
|
|
295 |
return 1; |
return 1; |