comparison src/protocols/toc/toc.c @ 3630:9682c0e022c6

[gaim-migrate @ 3753] Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 11 Oct 2002 03:14:01 +0000
parents bdd0bebd2d04
children da6e3c984985
comparison
equal deleted inserted replaced
3629:afc5bb164c5a 3630:9682c0e022c6
22 22
23 23
24 #ifdef HAVE_CONFIG_H 24 #ifdef HAVE_CONFIG_H
25 #include <config.h> 25 #include <config.h>
26 #endif 26 #endif
27
28 #ifndef _WIN32
27 #include <netdb.h> 29 #include <netdb.h>
28 #include <gtk/gtk.h>
29 #include <unistd.h> 30 #include <unistd.h>
30 #include <errno.h>
31 #include <netinet/in.h> 31 #include <netinet/in.h>
32 #include <arpa/inet.h> 32 #include <arpa/inet.h>
33 #include <sys/socket.h>
34 #else
35 #include <winsock.h>
36 #endif
37
38 #include <gtk/gtk.h>
39 #include <errno.h>
33 #include <string.h> 40 #include <string.h>
34 #include <stdlib.h> 41 #include <stdlib.h>
35 #include <stdio.h> 42 #include <stdio.h>
36 #include <time.h> 43 #include <time.h>
37 #include <sys/socket.h>
38 #include <sys/types.h> 44 #include <sys/types.h>
39 #include <sys/stat.h> 45 #include <sys/stat.h>
40 #include "prpl.h" 46 #include "prpl.h"
41 #include "multi.h" 47 #include "multi.h"
42 #include "gaim.h" 48 #include "gaim.h"
43 #include "proxy.h" 49 #include "proxy.h"
44 50
51 #ifdef _WIN32
52 #include "win32dep.h"
53 #endif
54
45 #include "pixmaps/protocols/oscar/admin_icon.xpm" 55 #include "pixmaps/protocols/oscar/admin_icon.xpm"
46 #include "pixmaps/protocols/oscar/aol_icon.xpm" 56 #include "pixmaps/protocols/oscar/aol_icon.xpm"
47 #include "pixmaps/protocols/oscar/away_icon.xpm" 57 #include "pixmaps/protocols/oscar/away_icon.xpm"
48 #include "pixmaps/protocols/oscar/dt_icon.xpm" 58 #include "pixmaps/protocols/oscar/dt_icon.xpm"
49 #include "pixmaps/protocols/oscar/free_icon.xpm" 59 #include "pixmaps/protocols/oscar/free_icon.xpm"
50 #include "pixmaps/protocols/oscar/wireless_icon.xpm" 60 #include "pixmaps/protocols/oscar/wireless_icon.xpm"
61
62 /* for win32 compatability */
63 G_MODULE_IMPORT GSList *connections;
51 64
52 #define REVISION "penguin" 65 #define REVISION "penguin"
53 66
54 #define TYPE_SIGNON 1 67 #define TYPE_SIGNON 1
55 #define TYPE_DATA 2 68 #define TYPE_DATA 2
132 145
133 static void toc_login_callback(gpointer, gint, GaimInputCondition); 146 static void toc_login_callback(gpointer, gint, GaimInputCondition);
134 static void toc_callback(gpointer, gint, GaimInputCondition); 147 static void toc_callback(gpointer, gint, GaimInputCondition);
135 static void accept_file_dialog(struct ft_request *); 148 static void accept_file_dialog(struct ft_request *);
136 149
150 /* The following were added for win32 port - Herman */
151
152 int toc_write(int fd, const void *buffer, int len)
153 {
154 #ifndef _WIN32
155 return write(fd, buffer, len);
156 #else
157 return send(fd, buffer, len, 0);
158 #endif
159 }
160
161 int toc_read(int fd, void *buffer, int size)
162 {
163 #ifndef _WIN32
164 return read(fd, buffer, size);
165 #else
166 return recv(fd, buffer, size, 0);
167 #endif
168 }
169
170 int toc_soc_close( int fd )
171 {
172 #ifndef _WIN32
173 return close(fd);
174 #else
175 return closesocket(fd);
176 #endif
177 }
178
179
137 /* ok. this function used to take username/password, and return 0 on success. 180 /* ok. this function used to take username/password, and return 0 on success.
138 * now, it takes username/password, and returns NULL on error or a new gaim_connection 181 * now, it takes username/password, and returns NULL on error or a new gaim_connection
139 * on success. */ 182 * on success. */
140 static void toc_login(struct aim_user *user) 183 static void toc_login(struct aim_user *user)
141 { 184 {
171 struct gaim_connection *gc = data; 214 struct gaim_connection *gc = data;
172 struct toc_data *tdt; 215 struct toc_data *tdt;
173 char buf[80]; 216 char buf[80];
174 217
175 if (!g_slist_find(connections, data)) { 218 if (!g_slist_find(connections, data)) {
176 close(source); 219 toc_soc_close(source);
177 return; 220 return;
178 } 221 }
179 222
180 tdt = gc->proto_data; 223 tdt = gc->proto_data;
181 224
188 231
189 if (tdt->toc_fd == 0) 232 if (tdt->toc_fd == 0)
190 tdt->toc_fd = source; 233 tdt->toc_fd = source;
191 234
192 debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n"); 235 debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n");
193 if (write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { 236 if (toc_write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) {
194 hide_login_progress(gc, "Disconnected."); 237 hide_login_progress(gc, "Disconnected.");
195 signoff(gc); 238 signoff(gc);
196 return; 239 return;
197 } 240 }
198 tdt->state = STATE_FLAPON; 241 tdt->state = STATE_FLAPON;
209 static void toc_close(struct gaim_connection *gc) 252 static void toc_close(struct gaim_connection *gc)
210 { 253 {
211 if (gc->inpa > 0) 254 if (gc->inpa > 0)
212 gaim_input_remove(gc->inpa); 255 gaim_input_remove(gc->inpa);
213 gc->inpa = 0; 256 gc->inpa = 0;
214 close(((struct toc_data *)gc->proto_data)->toc_fd); 257 toc_soc_close(((struct toc_data *)gc->proto_data)->toc_fd);
215 g_free(gc->proto_data); 258 g_free(gc->proto_data);
216 } 259 }
217 260
218 static int escape_message(char *msg) 261 static int escape_message(char *msg)
219 { 262 {
325 if (type != TYPE_SIGNON) { 368 if (type != TYPE_SIGNON) {
326 obuf[slen] = '\0'; 369 obuf[slen] = '\0';
327 slen += 1; 370 slen += 1;
328 } 371 }
329 372
330 return write(tdt->toc_fd, obuf, slen); 373 return toc_write(tdt->toc_fd, obuf, slen);
331 } 374 }
332 375
333 static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) 376 static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen)
334 { 377 {
335 struct toc_data *tdt = (struct toc_data *)gc->proto_data; 378 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
336 struct sflap_hdr *hdr; 379 struct sflap_hdr *hdr;
337 int ret; 380 int ret;
338 381
339 if (read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) { 382 if (toc_read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) {
340 debug_printf("error, couldn't read flap header\n"); 383 debug_printf("error, couldn't read flap header\n");
341 return -1; 384 return -1;
342 } 385 }
343 386
344 hdr = (struct sflap_hdr *)buffer; 387 hdr = (struct sflap_hdr *)buffer;
352 if (ntohs(hdr->len) > 0) { 395 if (ntohs(hdr->len) > 0) {
353 int count = 0; 396 int count = 0;
354 ret = 0; 397 ret = 0;
355 do { 398 do {
356 count += ret; 399 count += ret;
357 ret = read(tdt->toc_fd, 400 ret = toc_read(tdt->toc_fd,
358 buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len) - count); 401 buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len) - count);
359 } while (count + ret < ntohs(hdr->len) && ret > 0); 402 } while (count + ret < ntohs(hdr->len) && ret > 0);
360 buffer[sizeof(struct sflap_hdr) + count + ret] = '\0'; 403 buffer[sizeof(struct sflap_hdr) + count + ret] = '\0';
361 return ret; 404 return ret;
362 } else 405 } else
1354 return m; 1397 return m;
1355 } 1398 }
1356 1399
1357 static struct prpl *my_protocol = NULL; 1400 static struct prpl *my_protocol = NULL;
1358 1401
1359 void toc_init(struct prpl *ret) 1402 G_MODULE_EXPORT void toc_init(struct prpl *ret)
1360 { 1403 {
1361 struct proto_user_opt *puo; 1404 struct proto_user_opt *puo;
1362 ret->protocol = PROTO_TOC; 1405 ret->protocol = PROTO_TOC;
1363 ret->options = OPT_PROTO_CORRECT_TIME; 1406 ret->options = OPT_PROTO_CORRECT_TIME;
1364 ret->name = g_strdup("TOC"); 1407 ret->name = g_strdup("TOC");
1411 my_protocol = ret; 1454 my_protocol = ret;
1412 } 1455 }
1413 1456
1414 #ifndef STATIC 1457 #ifndef STATIC
1415 1458
1416 void *gaim_prpl_init(struct prpl *prpl) 1459 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl)
1417 { 1460 {
1418 toc_init(prpl); 1461 toc_init(prpl);
1419 prpl->plug->desc.api_version = PLUGIN_API_VERSION; 1462 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
1420 } 1463 }
1421 1464
1514 1557
1515 if (ft->hdr.hdrtype != 0x202) { 1558 if (ft->hdr.hdrtype != 0x202) {
1516 char *buf; 1559 char *buf;
1517 frombase64(ft->cookie, &buf, NULL); 1560 frombase64(ft->cookie, &buf, NULL);
1518 1561
1519 read(source, ft, 8); 1562 toc_read(source, ft, 8);
1520 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1563 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1521 debug_header(ft); 1564 debug_header(ft);
1522 1565
1523 ft->hdr.hdrtype = 0x202; 1566 ft->hdr.hdrtype = 0x202;
1524 memcpy(ft->hdr.bcookie, buf, 8); 1567 memcpy(ft->hdr.bcookie, buf, 8);
1525 g_free(buf); 1568 g_free(buf);
1526 ft->hdr.encrypt = 0; ft->hdr.compress = 0; 1569 ft->hdr.encrypt = 0; ft->hdr.compress = 0;
1527 debug_header(ft); 1570 debug_header(ft);
1528 write(source, ft, 256); 1571 toc_write(source, ft, 256);
1529 1572
1530 if (ft->files == 1) { 1573 if (ft->files == 1) {
1531 ft->file = fopen(ft->filename, "w"); 1574 ft->file = fopen(ft->filename, "w");
1532 if (!ft->file) { 1575 if (!ft->file) {
1533 buf = g_strdup_printf("Could not open %s for writing!", ft->filename); 1576 buf = g_strdup_printf("Could not open %s for writing!", ft->filename);
1534 do_error_dialog(buf, strerror(errno), GAIM_ERROR); 1577 do_error_dialog(buf, strerror(errno), GAIM_ERROR);
1535 g_free(buf); 1578 g_free(buf);
1536 gaim_input_remove(ft->inpa); 1579 gaim_input_remove(ft->inpa);
1537 close(source); 1580 toc_soc_close(source);
1538 g_free(ft->filename); 1581 g_free(ft->filename);
1539 g_free(ft->user); 1582 g_free(ft->user);
1540 g_free(ft->ip); 1583 g_free(ft->ip);
1541 g_free(ft->cookie); 1584 g_free(ft->cookie);
1542 g_free(ft); 1585 g_free(ft);
1549 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename, 1592 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename,
1550 ft->hdr.name); 1593 ft->hdr.name);
1551 do_error_dialog(buf, strerror(errno), GAIM_ERROR); 1594 do_error_dialog(buf, strerror(errno), GAIM_ERROR);
1552 g_free(buf); 1595 g_free(buf);
1553 gaim_input_remove(ft->inpa); 1596 gaim_input_remove(ft->inpa);
1554 close(source); 1597 toc_soc_close(source);
1555 g_free(ft->filename); 1598 g_free(ft->filename);
1556 g_free(ft->user); 1599 g_free(ft->user);
1557 g_free(ft->ip); 1600 g_free(ft->ip);
1558 g_free(ft->cookie); 1601 g_free(ft->cookie);
1559 g_free(ft); 1602 g_free(ft);
1561 } 1604 }
1562 1605
1563 return; 1606 return;
1564 } 1607 }
1565 1608
1566 rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); 1609 rt = toc_read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024));
1567 if (rt < 0) { 1610 if (rt < 0) {
1568 do_error_dialog("File transfer failed; other side probably canceled.", NULL, GAIM_ERROR); 1611 do_error_dialog("File transfer failed; other side probably canceled.", NULL, GAIM_ERROR);
1569 gaim_input_remove(ft->inpa); 1612 gaim_input_remove(ft->inpa);
1570 close(source); 1613 toc_soc_close(source);
1571 g_free(ft->user); 1614 g_free(ft->user);
1572 g_free(ft->ip); 1615 g_free(ft->ip);
1573 g_free(ft->cookie); 1616 g_free(ft->cookie);
1574 if (ft->file) 1617 if (ft->file)
1575 fclose(ft->file); 1618 fclose(ft->file);
1585 ft->hdr.filesleft = htons(ntohs(ft->hdr.filesleft) - 1); 1628 ft->hdr.filesleft = htons(ntohs(ft->hdr.filesleft) - 1);
1586 ft->hdr.partsleft = htons(ntohs(ft->hdr.partsleft) - 1); 1629 ft->hdr.partsleft = htons(ntohs(ft->hdr.partsleft) - 1);
1587 ft->hdr.recvcsum = ft->hdr.checksum; /* uh... */ 1630 ft->hdr.recvcsum = ft->hdr.checksum; /* uh... */
1588 ft->hdr.nrecvd = htons(ntohs(ft->hdr.nrecvd) + 1); 1631 ft->hdr.nrecvd = htons(ntohs(ft->hdr.nrecvd) + 1);
1589 ft->hdr.flags = 0; 1632 ft->hdr.flags = 0;
1590 write(source, ft, 256); 1633 toc_write(source, ft, 256);
1591 debug_header(ft); 1634 debug_header(ft);
1592 ft->recvsize = 0; 1635 ft->recvsize = 0;
1593 fclose(ft->file); 1636 fclose(ft->file);
1594 if (ft->hdr.filesleft == 0) { 1637 if (ft->hdr.filesleft == 0) {
1595 gaim_input_remove(ft->inpa); 1638 gaim_input_remove(ft->inpa);
1596 close(source); 1639 toc_soc_close(source);
1597 g_free(ft->filename); 1640 g_free(ft->filename);
1598 g_free(ft->user); 1641 g_free(ft->user);
1599 g_free(ft->ip); 1642 g_free(ft->ip);
1600 g_free(ft->cookie); 1643 g_free(ft->cookie);
1601 g_free(ft); 1644 g_free(ft);
1669 if (cond & GAIM_INPUT_WRITE) { 1712 if (cond & GAIM_INPUT_WRITE) {
1670 int remain = MIN(ntohl(ft->hdr.totsize) - ft->recvsize, 1024); 1713 int remain = MIN(ntohl(ft->hdr.totsize) - ft->recvsize, 1024);
1671 int i; 1714 int i;
1672 for (i = 0; i < remain; i++) 1715 for (i = 0; i < remain; i++)
1673 fscanf(ft->file, "%c", &buf[i]); 1716 fscanf(ft->file, "%c", &buf[i]);
1674 write(source, buf, remain); 1717 toc_write(source, buf, remain);
1675 ft->recvsize += remain; 1718 ft->recvsize += remain;
1676 if (ft->recvsize == ntohl(ft->hdr.totsize)) { 1719 if (ft->recvsize == ntohl(ft->hdr.totsize)) {
1677 gaim_input_remove(ft->inpa); 1720 gaim_input_remove(ft->inpa);
1678 ft->inpa = gaim_input_add(source, GAIM_INPUT_READ, 1721 ft->inpa = gaim_input_add(source, GAIM_INPUT_READ,
1679 toc_get_file_callback, ft); 1722 toc_get_file_callback, ft);
1683 1726
1684 if (ft->hdr.hdrtype == htons(0x1108)) { 1727 if (ft->hdr.hdrtype == htons(0x1108)) {
1685 struct tm *fortime; 1728 struct tm *fortime;
1686 struct stat st; 1729 struct stat st;
1687 1730
1688 read(source, ft, 8); 1731 toc_read(source, ft, 8);
1689 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1732 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1690 debug_header(ft); 1733 debug_header(ft);
1691 1734
1692 stat(ft->filename, &st); 1735 stat(ft->filename, &st);
1693 fortime = localtime(&st.st_mtime); 1736 fortime = localtime(&st.st_mtime);
1694 g_snprintf(buf, sizeof(buf), "%2d/%2d/%4d %2d:%2d %8ld %s\r\n", 1737 g_snprintf(buf, sizeof(buf), "%2d/%2d/%4d %2d:%2d %8ld %s\r\n",
1695 fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, 1738 fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900,
1696 fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size, 1739 fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size,
1697 g_basename(ft->filename)); 1740 g_basename(ft->filename));
1698 write(source, buf, ntohl(ft->hdr.size)); 1741 toc_write(source, buf, ntohl(ft->hdr.size));
1699 return; 1742 return;
1700 } 1743 }
1701 1744
1702 if (ft->hdr.hdrtype == htons(0x1209)) { 1745 if (ft->hdr.hdrtype == htons(0x1209)) {
1703 read(source, ft, 8); 1746 toc_read(source, ft, 8);
1704 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1747 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1705 debug_header(ft); 1748 debug_header(ft);
1706 return; 1749 return;
1707 } 1750 }
1708 1751
1709 if (ft->hdr.hdrtype == htons(0x120b)) { 1752 if (ft->hdr.hdrtype == htons(0x120b)) {
1710 read(source, ft, 8); 1753 toc_read(source, ft, 8);
1711 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1754 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1712 debug_header(ft); 1755 debug_header(ft);
1713 1756
1714 if (ft->hdr.hdrtype != htons(0x120c)) { 1757 if (ft->hdr.hdrtype != htons(0x120c)) {
1715 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); 1758 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user);
1716 do_error_dialog(buf, NULL, GAIM_ERROR); 1759 do_error_dialog(buf, NULL, GAIM_ERROR);
1717 gaim_input_remove(ft->inpa); 1760 gaim_input_remove(ft->inpa);
1718 close(source); 1761 toc_soc_close(source);
1719 g_free(ft->filename); 1762 g_free(ft->filename);
1720 g_free(ft->user); 1763 g_free(ft->user);
1721 g_free(ft->ip); 1764 g_free(ft->ip);
1722 g_free(ft->cookie); 1765 g_free(ft->cookie);
1723 if (ft->file) 1766 if (ft->file)
1727 } 1770 }
1728 1771
1729 ft->hdr.hdrtype = 0x0101; 1772 ft->hdr.hdrtype = 0x0101;
1730 ft->hdr.totfiles = htons(1); ft->hdr.filesleft = htons(1); 1773 ft->hdr.totfiles = htons(1); ft->hdr.filesleft = htons(1);
1731 ft->hdr.flags = 0x20; 1774 ft->hdr.flags = 0x20;
1732 write(source, ft, 256); 1775 toc_write(source, ft, 256);
1733 return; 1776 return;
1734 } 1777 }
1735 1778
1736 if (ft->hdr.hdrtype == 0x0101) { 1779 if (ft->hdr.hdrtype == 0x0101) {
1737 read(source, ft, 8); 1780 toc_read(source, ft, 8);
1738 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1781 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1739 debug_header(ft); 1782 debug_header(ft);
1740 1783
1741 gaim_input_remove(ft->inpa); 1784 gaim_input_remove(ft->inpa);
1742 ft->inpa = gaim_input_add(source, GAIM_INPUT_WRITE, 1785 ft->inpa = gaim_input_add(source, GAIM_INPUT_WRITE,
1743 toc_get_file_callback, ft); 1786 toc_get_file_callback, ft);
1744 return; 1787 return;
1745 } 1788 }
1746 1789
1747 if (ft->hdr.hdrtype == 0x0202) { 1790 if (ft->hdr.hdrtype == 0x0202) {
1748 read(source, ft, 8); 1791 toc_read(source, ft, 8);
1749 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1792 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1750 debug_header(ft); 1793 debug_header(ft);
1751 1794
1752 gaim_input_remove(ft->inpa); 1795 gaim_input_remove(ft->inpa);
1753 close(source); 1796 toc_soc_close(source);
1754 g_free(ft->filename); 1797 g_free(ft->filename);
1755 g_free(ft->user); 1798 g_free(ft->user);
1756 g_free(ft->ip); 1799 g_free(ft->ip);
1757 g_free(ft->cookie); 1800 g_free(ft->cookie);
1758 if (ft->file) 1801 if (ft->file)
1796 g_snprintf(hdr->idstring, 32, "OFT_Windows ICBMFT V1.1 32"); 1839 g_snprintf(hdr->idstring, 32, "OFT_Windows ICBMFT V1.1 32");
1797 hdr->flags = 0x02; 1840 hdr->flags = 0x02;
1798 hdr->lnameoffset = 0x1A; 1841 hdr->lnameoffset = 0x1A;
1799 hdr->lsizeoffset = 0x10; 1842 hdr->lsizeoffset = 0x10;
1800 g_snprintf(hdr->name, 64, "listing.txt"); 1843 g_snprintf(hdr->name, 64, "listing.txt");
1801 if (write(src, hdr, 256) < 0) { 1844 if (toc_write(src, hdr, 256) < 0) {
1802 do_error_dialog(_("Could not write file header. The file will not be transferred."), NULL, GAIM_ERROR); 1845 do_error_dialog(_("Could not write file header. The file will not be transferred."), NULL, GAIM_ERROR);
1803 fclose(ft->file); 1846 fclose(ft->file);
1804 g_free(ft->filename); 1847 g_free(ft->filename);
1805 g_free(ft->cookie); 1848 g_free(ft->cookie);
1806 g_free(ft->user); 1849 g_free(ft->user);
1887 ft->ip = g_strdup(fr->ip); 1930 ft->ip = g_strdup(fr->ip);
1888 ft->port = fr->port; 1931 ft->port = fr->port;
1889 ft->files = fr->files; 1932 ft->files = fr->files;
1890 1933
1891 ft->window = window = gtk_file_selection_new(_("Gaim - Save As...")); 1934 ft->window = window = gtk_file_selection_new(_("Gaim - Save As..."));
1892 g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->filename ? fr->filename : ""); 1935 g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : "");
1893 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); 1936 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
1894 gtk_signal_connect(GTK_OBJECT(window), "destroy", 1937 gtk_signal_connect(GTK_OBJECT(window), "destroy",
1895 GTK_SIGNAL_FUNC(cancel_callback), ft); 1938 GTK_SIGNAL_FUNC(cancel_callback), ft);
1896 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked", 1939 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked",
1897 GTK_SIGNAL_FUNC(cancel_callback), ft); 1940 GTK_SIGNAL_FUNC(cancel_callback), ft);