comparison src/protocols/toc/toc.c @ 3427:8fa61405af2b

[gaim-migrate @ 3453] Who never commits anything *now*, Etan? I changed most of the error message text around. If you think any of it should be different, just let me know, or send a patch. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 25 Aug 2002 10:51:24 +0000
parents 49fb2b634a2a
children 7a3f16a375a5
comparison
equal deleted inserted replaced
3426:ccbcc11a68c2 3427:8fa61405af2b
594 if (bud_list_cache_exists(gc)) 594 if (bud_list_cache_exists(gc))
595 do_import(gc, NULL); 595 do_import(gc, NULL);
596 g_snprintf(snd, sizeof snd, "toc_init_done"); 596 g_snprintf(snd, sizeof snd, "toc_init_done");
597 sflap_send(gc, snd, -1, TYPE_DATA); 597 sflap_send(gc, snd, -1, TYPE_DATA);
598 do_error_dialog(_("TOC has come back from its pause. You may now send" 598 do_error_dialog(_("TOC has come back from its pause. You may now send"
599 " messages again."), _("TOC Resume")); 599 " messages again."), NULL, GAIM_INFO);
600 } 600 }
601 } else if (!strcasecmp(c, "CONFIG")) { 601 } else if (!strcasecmp(c, "CONFIG")) {
602 c = strtok(NULL, ":"); 602 c = strtok(NULL, ":");
603 parse_toc_buddy_list(gc, c); 603 parse_toc_buddy_list(gc, c);
604 } else if (!strcasecmp(c, "NICK")) { 604 } else if (!strcasecmp(c, "NICK")) {
667 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", c); 667 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", c);
668 g_free(tmp); 668 g_free(tmp);
669 669
670 serv_got_update(gc, c, logged, evil, signon, time_idle, type, 0); 670 serv_got_update(gc, c, logged, evil, signon, time_idle, type, 0);
671 } else if (!strcasecmp(c, "ERROR")) { 671 } else if (!strcasecmp(c, "ERROR")) {
672 do_error_dialog(show_error_message(), "TOC Error"); 672 do_error_dialog(show_error_message(), NULL, GAIM_ERROR);
673 } else if (!strcasecmp(c, "EVILED")) { 673 } else if (!strcasecmp(c, "EVILED")) {
674 int lev; 674 int lev;
675 char *name; 675 char *name;
676 676
677 sscanf(strtok(NULL, ":"), "%d", &lev); 677 sscanf(strtok(NULL, ":"), "%d", &lev);
758 if (b->window) { 758 if (b->window) {
759 char error_buf[BUF_LONG]; 759 char error_buf[BUF_LONG];
760 b->gc = NULL; 760 b->gc = NULL;
761 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected" 761 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected"
762 " from chat room %s."), b->name); 762 " from chat room %s."), b->name);
763 do_error_dialog(error_buf, _("Chat Error")); 763 do_error_dialog(error_buf, NULL, GAIM_ERROR);
764 } else 764 } else
765 serv_got_chat_left(gc, id); 765 serv_got_chat_left(gc, id);
766 } else if (!strcasecmp(c, "GOTO_URL")) { 766 } else if (!strcasecmp(c, "GOTO_URL")) {
767 char *name, *url, tmp[256]; 767 char *name, *url, tmp[256];
768 768
777 url); 777 url);
778 grab_url(tmp, FALSE, toc_got_info, NULL); 778 grab_url(tmp, FALSE, toc_got_info, NULL);
779 } else if (!strcasecmp(c, "DIR_STATUS")) { 779 } else if (!strcasecmp(c, "DIR_STATUS")) {
780 } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) { 780 } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) {
781 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { 781 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) {
782 do_error_dialog(_("Password Change Successful"), _("Gaim - Password Change")); 782 do_error_dialog(_("Password Change Successful"), NULL, GAIM_INFO);
783 } else if (!strcasecmp(c, "PAUSE")) { 783 } else if (!strcasecmp(c, "PAUSE")) {
784 tdt->state = STATE_PAUSE; 784 tdt->state = STATE_PAUSE;
785 do_error_dialog(_("TOC has sent a PAUSE command. When this happens, TOC ignores" 785 do_error_dialog(_("TOC has sent a PAUSE command."), _("When this happens, TOC ignores"
786 " any messages sent to it, and may kick you off if you send a" 786 " any messages sent to it, and may kick you off if you send a"
787 " message. Gaim will prevent anything from going through. This" 787 " message. Gaim will prevent anything from going through. This"
788 " is only temporary, please be patient."), _("TOC Pause")); 788 " is only temporary, please be patient."), GAIM_WARNING);
789 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) { 789 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) {
790 char *user, *uuid, *cookie; 790 char *user, *uuid, *cookie;
791 int seq; 791 int seq;
792 char *rip, *pip, *vip, *trillian = NULL; 792 char *rip, *pip, *vip, *trillian = NULL;
793 int port; 793 int port;
1559 1559
1560 if (ft->files == 1) { 1560 if (ft->files == 1) {
1561 ft->file = fopen(ft->filename, "w"); 1561 ft->file = fopen(ft->filename, "w");
1562 if (!ft->file) { 1562 if (!ft->file) {
1563 buf = g_strdup_printf("Could not open %s for writing!", ft->filename); 1563 buf = g_strdup_printf("Could not open %s for writing!", ft->filename);
1564 do_error_dialog(buf, _("Error")); 1564 do_error_dialog(buf, strerror(errno), GAIM_ERROR);
1565 g_free(buf); 1565 g_free(buf);
1566 gaim_input_remove(ft->inpa); 1566 gaim_input_remove(ft->inpa);
1567 close(source); 1567 close(source);
1568 g_free(ft->filename); 1568 g_free(ft->filename);
1569 g_free(ft->user); 1569 g_free(ft->user);
1576 ft->file = fopen(buf, "w"); 1576 ft->file = fopen(buf, "w");
1577 g_free(buf); 1577 g_free(buf);
1578 if (!ft->file) { 1578 if (!ft->file) {
1579 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename, 1579 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename,
1580 ft->hdr.name); 1580 ft->hdr.name);
1581 do_error_dialog(buf, _("Error")); 1581 do_error_dialog(buf, strerror(errno), GAIM_ERROR);
1582 g_free(buf); 1582 g_free(buf);
1583 gaim_input_remove(ft->inpa); 1583 gaim_input_remove(ft->inpa);
1584 close(source); 1584 close(source);
1585 g_free(ft->filename); 1585 g_free(ft->filename);
1586 g_free(ft->user); 1586 g_free(ft->user);
1593 return; 1593 return;
1594 } 1594 }
1595 1595
1596 rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); 1596 rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024));
1597 if (rt < 0) { 1597 if (rt < 0) {
1598 do_error_dialog("File transfer failed; other side probably canceled.", "Error"); 1598 do_error_dialog("File transfer failed; other side probably canceled.", NULL, GAIM_ERROR);
1599 gaim_input_remove(ft->inpa); 1599 gaim_input_remove(ft->inpa);
1600 close(source); 1600 close(source);
1601 g_free(ft->user); 1601 g_free(ft->user);
1602 g_free(ft->ip); 1602 g_free(ft->ip);
1603 g_free(ft->cookie); 1603 g_free(ft->cookie);
1636 static void toc_send_file_connect(gpointer data, gint src, GaimInputCondition cond) 1636 static void toc_send_file_connect(gpointer data, gint src, GaimInputCondition cond)
1637 { 1637 {
1638 struct file_transfer *ft = data; 1638 struct file_transfer *ft = data;
1639 1639
1640 if (src == -1) { 1640 if (src == -1) {
1641 do_error_dialog(_("Could not connect for transfer!"), _("Error")); 1641 do_error_dialog(_("Could not connect for transfer."), NULL, GAIM_ERROR);
1642 g_free(ft->filename); 1642 g_free(ft->filename);
1643 g_free(ft->cookie); 1643 g_free(ft->cookie);
1644 g_free(ft->user); 1644 g_free(ft->user);
1645 g_free(ft->ip); 1645 g_free(ft->ip);
1646 g_free(ft); 1646 g_free(ft);
1678 sflap_send(ft->gc, buf, -1, TYPE_DATA); 1678 sflap_send(ft->gc, buf, -1, TYPE_DATA);
1679 1679
1680 fd = 1680 fd =
1681 proxy_connect(ft->ip, ft->port, toc_send_file_connect, ft); 1681 proxy_connect(ft->ip, ft->port, toc_send_file_connect, ft);
1682 if (fd < 0) { 1682 if (fd < 0) {
1683 do_error_dialog(_("Could not connect for transfer!"), _("Error")); 1683 do_error_dialog(_("Could not connect for transfer."), NULL, GAIM_ERROR);
1684 g_free(ft->filename); 1684 g_free(ft->filename);
1685 g_free(ft->cookie); 1685 g_free(ft->cookie);
1686 g_free(ft->user); 1686 g_free(ft->user);
1687 g_free(ft->ip); 1687 g_free(ft->ip);
1688 g_free(ft); 1688 g_free(ft);
1741 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); 1741 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8));
1742 debug_header(ft); 1742 debug_header(ft);
1743 1743
1744 if (ft->hdr.hdrtype != htons(0x120c)) { 1744 if (ft->hdr.hdrtype != htons(0x120c)) {
1745 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); 1745 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user);
1746 do_error_dialog(buf, "Error"); 1746 do_error_dialog(buf, NULL, GAIM_ERROR);
1747 gaim_input_remove(ft->inpa); 1747 gaim_input_remove(ft->inpa);
1748 close(source); 1748 close(source);
1749 g_free(ft->filename); 1749 g_free(ft->filename);
1750 g_free(ft->user); 1750 g_free(ft->user);
1751 g_free(ft->ip); 1751 g_free(ft->ip);
1797 struct file_transfer *ft = data; 1797 struct file_transfer *ft = data;
1798 struct file_header *hdr; 1798 struct file_header *hdr;
1799 char *buf; 1799 char *buf;
1800 1800
1801 if (src == -1) { 1801 if (src == -1) {
1802 do_error_dialog(_("Could not connect for transfer!"), _("Error")); 1802 do_error_dialog(_("Could not connect for transfer!"), NULL, GAIM_ERROR);
1803 fclose(ft->file); 1803 fclose(ft->file);
1804 g_free(ft->filename); 1804 g_free(ft->filename);
1805 g_free(ft->cookie); 1805 g_free(ft->cookie);
1806 g_free(ft->user); 1806 g_free(ft->user);
1807 g_free(ft->ip); 1807 g_free(ft->ip);
1827 hdr->flags = 0x02; 1827 hdr->flags = 0x02;
1828 hdr->lnameoffset = 0x1A; 1828 hdr->lnameoffset = 0x1A;
1829 hdr->lsizeoffset = 0x10; 1829 hdr->lsizeoffset = 0x10;
1830 g_snprintf(hdr->name, 64, "listing.txt"); 1830 g_snprintf(hdr->name, 64, "listing.txt");
1831 if (write(src, hdr, 256) < 0) { 1831 if (write(src, hdr, 256) < 0) {
1832 do_error_dialog(_("Could not write file header!"), _("Error")); 1832 do_error_dialog(_("Could not write file header. The file will not be transferred."), NULL, GAIM_ERROR);
1833 fclose(ft->file); 1833 fclose(ft->file);
1834 g_free(ft->filename); 1834 g_free(ft->filename);
1835 g_free(ft->cookie); 1835 g_free(ft->cookie);
1836 g_free(ft->user); 1836 g_free(ft->user);
1837 g_free(ft->ip); 1837 g_free(ft->ip);
1854 return; 1854 return;
1855 ft = g_new0(struct file_transfer, 1); 1855 ft = g_new0(struct file_transfer, 1);
1856 ft->filename = g_strdup(dirname); 1856 ft->filename = g_strdup(dirname);
1857 ft->file = fopen(ft->filename, "r"); 1857 ft->file = fopen(ft->filename, "r");
1858 if (!ft->file) { 1858 if (!ft->file) {
1859 buf = g_strdup_printf("Unable to open %s for transfer!", ft->filename); 1859 buf = g_strdup_printf("Unable to open %s for transfer.", ft->filename);
1860 do_error_dialog(buf, "Error"); 1860 do_error_dialog(buf, NULL, GAIM_ERROR);
1861 g_free(buf); 1861 g_free(buf);
1862 g_free(ft->filename); 1862 g_free(ft->filename);
1863 g_free(ft); 1863 g_free(ft);
1864 return; 1864 return;
1865 } 1865 }
1866 if (stat(dirname, &ft->st)) { 1866 if (stat(dirname, &ft->st)) {
1867 buf = g_strdup_printf("Unable to examine %s!", dirname); 1867 buf = g_strdup_printf("Unable to examine %s.", dirname);
1868 do_error_dialog(buf, "Error"); 1868 do_error_dialog(buf, NULL, GAIM_ERROR);
1869 g_free(buf); 1869 g_free(buf);
1870 g_free(ft->filename); 1870 g_free(ft->filename);
1871 g_free(ft); 1871 g_free(ft);
1872 return; 1872 return;
1873 } 1873 }
1883 sflap_send(ft->gc, buf2, -1, TYPE_DATA); 1883 sflap_send(ft->gc, buf2, -1, TYPE_DATA);
1884 1884
1885 fd = 1885 fd =
1886 proxy_connect(ft->ip, ft->port, toc_get_file_connect, ft); 1886 proxy_connect(ft->ip, ft->port, toc_get_file_connect, ft);
1887 if (fd < 0) { 1887 if (fd < 0) {
1888 do_error_dialog(_("Could not connect for transfer!"), _("Error")); 1888 do_error_dialog(_("Could not connect for transfer."), NULL, GAIM_ERROR);
1889 fclose(ft->file); 1889 fclose(ft->file);
1890 g_free(ft->filename); 1890 g_free(ft->filename);
1891 g_free(ft->cookie); 1891 g_free(ft->cookie);
1892 g_free(ft->user); 1892 g_free(ft->user);
1893 g_free(ft->ip); 1893 g_free(ft->ip);