Mercurial > pidgin.yaz
comparison src/protocols/msn/msn.c @ 3720:34c95669952f
[gaim-migrate @ 3853]
WIN32 ifdef removals
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Wed, 16 Oct 2002 21:14:51 +0000 |
parents | da6e3c984985 |
children | a20bf3d247ff |
comparison
equal
deleted
inserted
replaced
3719:5233e2276a72 | 3720:34c95669952f |
---|---|
180 } | 180 } |
181 | 181 |
182 static int msn_write(int fd, void *data, int len) | 182 static int msn_write(int fd, void *data, int len) |
183 { | 183 { |
184 debug_printf("MSN C: %s", data); | 184 debug_printf("MSN C: %s", data); |
185 #ifndef _WIN32 | |
186 return write(fd, data, len); | 185 return write(fd, data, len); |
187 #else | |
188 return send(fd, data, len, 0); | |
189 #endif | |
190 } | 186 } |
191 | 187 |
192 static char *url_decode(const char *msg) | 188 static char *url_decode(const char *msg) |
193 { | 189 { |
194 static char buf[MSN_BUF_LEN]; | 190 static char buf[MSN_BUF_LEN]; |
458 struct gaim_connection *gc = ms->gc; | 454 struct gaim_connection *gc = ms->gc; |
459 struct msn_data *md = gc->proto_data; | 455 struct msn_data *md = gc->proto_data; |
460 | 456 |
461 if (ms->inpa) | 457 if (ms->inpa) |
462 gaim_input_remove(ms->inpa); | 458 gaim_input_remove(ms->inpa); |
463 #ifndef _WIN32 | |
464 close(ms->fd); | 459 close(ms->fd); |
465 #else | |
466 closesocket(ms->fd); | |
467 #endif | |
468 g_free(ms->rxqueue); | 460 g_free(ms->rxqueue); |
469 if (ms->msg) | 461 if (ms->msg) |
470 g_free(ms->msguser); | 462 g_free(ms->msguser); |
471 if (ms->sessid) | 463 if (ms->sessid) |
472 g_free(ms->sessid); | 464 g_free(ms->sessid); |
704 int len; | 696 int len; |
705 | 697 |
706 /* This is really stupid and I hate to put this here. */ | 698 /* This is really stupid and I hate to put this here. */ |
707 if (ms->fd != source) | 699 if (ms->fd != source) |
708 ms->fd = source; | 700 ms->fd = source; |
709 #ifndef _WIN32 | |
710 len = read(ms->fd, buf, sizeof(buf)); | 701 len = read(ms->fd, buf, sizeof(buf)); |
711 #else | |
712 len = recv(ms->fd, buf, sizeof(buf), 0); | |
713 #endif | |
714 if (len <= 0) { | 702 if (len <= 0) { |
715 msn_kill_switch(ms); | 703 msn_kill_switch(ms); |
716 return; | 704 return; |
717 } | 705 } |
718 | 706 |
784 struct gaim_connection *gc = ms->gc; | 772 struct gaim_connection *gc = ms->gc; |
785 struct msn_data *md; | 773 struct msn_data *md; |
786 char buf[MSN_BUF_LEN]; | 774 char buf[MSN_BUF_LEN]; |
787 | 775 |
788 if (source == -1 || !g_slist_find(connections, gc)) { | 776 if (source == -1 || !g_slist_find(connections, gc)) { |
789 #ifndef _WIN32 | |
790 close(source); | 777 close(source); |
791 #else | |
792 closesocket(source); | |
793 #endif | |
794 g_free(ms->sessid); | 778 g_free(ms->sessid); |
795 g_free(ms->auth); | 779 g_free(ms->auth); |
796 g_free(ms); | 780 g_free(ms); |
797 return; | 781 return; |
798 } | 782 } |
802 if (ms->fd != source) | 786 if (ms->fd != source) |
803 ms->fd = source; | 787 ms->fd = source; |
804 | 788 |
805 g_snprintf(buf, sizeof(buf), "ANS %d %s %s %s\r\n", ++ms->trId, gc->username, ms->auth, ms->sessid); | 789 g_snprintf(buf, sizeof(buf), "ANS %d %s %s %s\r\n", ++ms->trId, gc->username, ms->auth, ms->sessid); |
806 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { | 790 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { |
807 #ifndef _WIN32 | |
808 close(ms->fd); | 791 close(ms->fd); |
809 #else | |
810 closesocket(ms->fd); | |
811 #endif | |
812 g_free(ms->sessid); | 792 g_free(ms->sessid); |
813 g_free(ms->auth); | 793 g_free(ms->auth); |
814 g_free(ms); | 794 g_free(ms); |
815 return; | 795 return; |
816 } | 796 } |
824 struct msn_switchboard *ms = data; | 804 struct msn_switchboard *ms = data; |
825 struct gaim_connection *gc = ms->gc; | 805 struct gaim_connection *gc = ms->gc; |
826 char buf[MSN_BUF_LEN]; | 806 char buf[MSN_BUF_LEN]; |
827 | 807 |
828 if (source == -1 || !g_slist_find(connections, gc)) { | 808 if (source == -1 || !g_slist_find(connections, gc)) { |
829 #ifndef _WIN32 | |
830 close(source); | 809 close(source); |
831 #else | |
832 closesocket(source); | |
833 #endif | |
834 if (g_slist_find(connections, gc)) { | 810 if (g_slist_find(connections, gc)) { |
835 msn_kill_switch(ms); | 811 msn_kill_switch(ms); |
836 do_error_dialog(_("Gaim was unable to send an MSN message"), | 812 do_error_dialog(_("Gaim was unable to send an MSN message"), |
837 _("Gaim encountered an error communicating with the " | 813 _("Gaim encountered an error communicating with the " |
838 "MSN switchboard server. Please try again later."), GAIM_ERROR); | 814 "MSN switchboard server. Please try again later."), GAIM_ERROR); |
1360 msn_kill_switch(ms); | 1336 msn_kill_switch(ms); |
1361 return 1; | 1337 return 1; |
1362 } | 1338 } |
1363 ms->auth = g_strdup(tmp); | 1339 ms->auth = g_strdup(tmp); |
1364 } else { | 1340 } else { |
1365 #ifndef _WIN32 | |
1366 close(md->fd); | 1341 close(md->fd); |
1367 #else | |
1368 closesocket(md->fd); | |
1369 #endif | |
1370 gaim_input_remove(md->inpa); | 1342 gaim_input_remove(md->inpa); |
1371 md->inpa = 0; | 1343 md->inpa = 0; |
1372 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); | 1344 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); |
1373 if (md->fd < 0) { | 1345 if (md->fd < 0) { |
1374 hide_login_progress(gc, "Error transfering"); | 1346 hide_login_progress(gc, "Error transfering"); |
1451 struct msn_data *md = gc->proto_data; | 1423 struct msn_data *md = gc->proto_data; |
1452 char buf[MSN_BUF_LEN]; | 1424 char buf[MSN_BUF_LEN]; |
1453 int cont = 1; | 1425 int cont = 1; |
1454 int len; | 1426 int len; |
1455 | 1427 |
1456 #ifndef _WIN32 | |
1457 len = read(md->fd, buf, sizeof(buf)); | 1428 len = read(md->fd, buf, sizeof(buf)); |
1458 #else | |
1459 len = recv(md->fd, buf, sizeof(buf), 0); | |
1460 #endif | |
1461 if (len <= 0) { | 1429 if (len <= 0) { |
1462 hide_login_progress_error(gc, _("Error reading from server")); | 1430 hide_login_progress_error(gc, _("Error reading from server")); |
1463 signoff(gc); | 1431 signoff(gc); |
1464 return; | 1432 return; |
1465 } | 1433 } |
1531 struct gaim_connection *gc = data; | 1499 struct gaim_connection *gc = data; |
1532 struct msn_data *md; | 1500 struct msn_data *md; |
1533 char buf[MSN_BUF_LEN]; | 1501 char buf[MSN_BUF_LEN]; |
1534 | 1502 |
1535 if (!g_slist_find(connections, gc)) { | 1503 if (!g_slist_find(connections, gc)) { |
1536 #ifndef _WIN32 | |
1537 close(source); | 1504 close(source); |
1538 #else | |
1539 closesocket(source); | |
1540 #endif | |
1541 return; | 1505 return; |
1542 } | 1506 } |
1543 | 1507 |
1544 md = gc->proto_data; | 1508 md = gc->proto_data; |
1545 | 1509 |
1667 host[i] = 0; | 1631 host[i] = 0; |
1668 port = atoi(x); | 1632 port = atoi(x); |
1669 } else | 1633 } else |
1670 port = 1863; | 1634 port = 1863; |
1671 | 1635 |
1672 #ifndef _WIN32 | |
1673 close(md->fd); | 1636 close(md->fd); |
1674 #else | |
1675 closesocket(md->fd); | |
1676 #endif | |
1677 gaim_input_remove(md->inpa); | 1637 gaim_input_remove(md->inpa); |
1678 md->inpa = 0; | 1638 md->inpa = 0; |
1679 md->fd = 0; | 1639 md->fd = 0; |
1680 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); | 1640 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); |
1681 md->sl = time(NULL); | 1641 md->sl = time(NULL); |
1702 struct msn_data *md = gc->proto_data; | 1662 struct msn_data *md = gc->proto_data; |
1703 char buf[MSN_BUF_LEN]; | 1663 char buf[MSN_BUF_LEN]; |
1704 int cont = 1; | 1664 int cont = 1; |
1705 int len; | 1665 int len; |
1706 | 1666 |
1707 #ifndef _WIN32 | |
1708 len = read(md->fd, buf, sizeof(buf)); | 1667 len = read(md->fd, buf, sizeof(buf)); |
1709 #else | |
1710 len = recv(md->fd, buf, sizeof(buf), 0); | |
1711 #endif | |
1712 if (len <= 0) { | 1668 if (len <= 0) { |
1713 hide_login_progress(gc, _("Error reading from server")); | 1669 hide_login_progress(gc, _("Error reading from server")); |
1714 signoff(gc); | 1670 signoff(gc); |
1715 return; | 1671 return; |
1716 } | 1672 } |
1760 struct gaim_connection *gc = data; | 1716 struct gaim_connection *gc = data; |
1761 struct msn_data *md; | 1717 struct msn_data *md; |
1762 char buf[1024]; | 1718 char buf[1024]; |
1763 | 1719 |
1764 if (!g_slist_find(connections, gc)) { | 1720 if (!g_slist_find(connections, gc)) { |
1765 #ifndef _WIN32 | |
1766 close(source); | 1721 close(source); |
1767 #else | |
1768 closesocket(source); | |
1769 #endif | |
1770 return; | 1722 return; |
1771 } | 1723 } |
1772 | 1724 |
1773 md = gc->proto_data; | 1725 md = gc->proto_data; |
1774 | 1726 |
1811 } | 1763 } |
1812 | 1764 |
1813 static void msn_close(struct gaim_connection *gc) | 1765 static void msn_close(struct gaim_connection *gc) |
1814 { | 1766 { |
1815 struct msn_data *md = gc->proto_data; | 1767 struct msn_data *md = gc->proto_data; |
1816 #ifndef _WIN32 | |
1817 close(md->fd); | 1768 close(md->fd); |
1818 #else | |
1819 closesocket(md->fd); | |
1820 #endif | |
1821 if (md->inpa) | 1769 if (md->inpa) |
1822 gaim_input_remove(md->inpa); | 1770 gaim_input_remove(md->inpa); |
1823 g_free(md->rxqueue); | 1771 g_free(md->rxqueue); |
1824 if (md->msg) | 1772 if (md->msg) |
1825 g_free(md->msguser); | 1773 g_free(md->msguser); |