comparison src/proxy.c @ 8262:b5dbd1839716

[gaim-migrate @ 8985] this is jabber new-style file transfer receive support. this doesn't do much error checking or handling, but I managed to send pictures to myself from Exodus on my laptop in the living room, which would have taken twice as long were it not for VNC. i said i was going to bed 1, 2, and 3 hours ago. i should go to bed. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 15 Feb 2004 10:11:38 +0000
parents f50c059b6384
children 79b834d7c2a2
comparison
equal deleted inserted replaced
8261:7b57c3bd9db6 8262:b5dbd1839716
1312 struct PHB *phb = data; 1312 struct PHB *phb = data;
1313 1313
1314 gaim_input_remove(phb->inpa); 1314 gaim_input_remove(phb->inpa);
1315 gaim_debug(GAIM_DEBUG_INFO, "socks5 proxy", "Able to read again.\n"); 1315 gaim_debug(GAIM_DEBUG_INFO, "socks5 proxy", "Able to read again.\n");
1316 1316
1317 if (read(source, buf, 10) < 10) { 1317 if (read(source, buf, 4) < 4) {
1318 gaim_debug(GAIM_DEBUG_WARNING, "socks5 proxy", "or not...\n"); 1318 gaim_debug(GAIM_DEBUG_WARNING, "socks5 proxy", "or not...\n");
1319 close(source); 1319 close(source);
1320 1320
1321 if (phb->account == NULL || 1321 if (phb->account == NULL ||
1322 gaim_account_get_connection(phb->account) != NULL) { 1322 gaim_account_get_connection(phb->account) != NULL) {
1343 1343
1344 g_free(phb->host); 1344 g_free(phb->host);
1345 g_free(phb); 1345 g_free(phb);
1346 return; 1346 return;
1347 } 1347 }
1348
1349 /* Skip past BND.ADDR */
1350 switch(buf[3]) {
1351 case 0x01: /* the address is a version-4 IP address, with a length of 4 octets */
1352 lseek(source, 4, SEEK_CUR);
1353 break;
1354 case 0x03: /* the address field contains a fully-qualified domain name. The first
1355 octet of the address field contains the number of octets of name that
1356 follow, there is no terminating NUL octet. */
1357 read(source, buf+4, 1);
1358 lseek(source, buf[4], SEEK_CUR);
1359 break;
1360 case 0x04: /* the address is a version-6 IP address, with a length of 16 octets */
1361 lseek(source, 16, SEEK_CUR);
1362 break;
1363 }
1364
1365 /* Skip past BND.PORT */
1366 lseek(source, 2, SEEK_CUR);
1348 1367
1349 if (phb->account == NULL || 1368 if (phb->account == NULL ||
1350 gaim_account_get_connection(phb->account) != NULL) { 1369 gaim_account_get_connection(phb->account) != NULL) {
1351 1370
1352 phb->func(phb->data, source, GAIM_INPUT_READ); 1371 phb->func(phb->data, source, GAIM_INPUT_READ);
1760 } 1779 }
1761 1780
1762 return gaim_gethostbyname_async(connecthost, connectport, 1781 return gaim_gethostbyname_async(connecthost, connectport,
1763 connection_host_resolved, phb); 1782 connection_host_resolved, phb);
1764 } 1783 }
1784
1785 int
1786 gaim_proxy_connect_socks5(GaimProxyInfo *gpi, const char *host, int port,
1787 GaimInputFunction func, gpointer data)
1788 {
1789 struct PHB *phb;
1790
1791 phb = g_new0(struct PHB, 1);
1792 phb->gpi = gpi;
1793 phb->func = func;
1794 phb->data = data;
1795 phb->host = g_strdup(host);
1796 phb->port = port;
1797
1798 return gaim_gethostbyname_async(gaim_proxy_info_get_host(gpi), gaim_proxy_info_get_port(gpi),
1799 connection_host_resolved, phb);
1800 }
1801
1765 1802
1766 static void 1803 static void
1767 proxy_pref_cb(const char *name, GaimPrefType type, gpointer value, 1804 proxy_pref_cb(const char *name, GaimPrefType type, gpointer value,
1768 gpointer data) 1805 gpointer data)
1769 { 1806 {