comparison src/protocols/msn/msn.c @ 4270:cc79431a11a7

[gaim-migrate @ 4521] Nicola's Lichtmaier (niqueco) writes: "Minor fixes: Transaction Id should be unsigned. File transfer cookie generation was broken (random only gave 2 ansers instead of 2^32-1). ... and some other random stuff..." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 09 Jan 2003 21:52:26 +0000
parents 9c7fcb211886
children fd33fa2bc9da
comparison
equal deleted inserted replaced
4269:ff0642fab1d5 4270:cc79431a11a7
73 73
74 char *sn; 74 char *sn;
75 char ip[16]; 75 char ip[16];
76 int port; 76 int port;
77 77
78 unsigned long cookie; 78 uint32_t cookie;
79 unsigned long authcookie; 79 uint32_t authcookie;
80 80
81 int len; 81 int len;
82 82
83 char *rxqueue; 83 char *rxqueue;
84 int rxlen; 84 int rxlen;
87 int msglen; 87 int msglen;
88 }; 88 };
89 89
90 struct msn_data { 90 struct msn_data {
91 int fd; 91 int fd;
92 int trId; 92 uint32_t trId;
93 int inpa; 93 int inpa;
94 94
95 char *rxqueue; 95 char *rxqueue;
96 int rxlen; 96 int rxlen;
97 gboolean msg; 97 gboolean msg;
124 char *msguser; 124 char *msguser;
125 int msglen; 125 int msglen;
126 126
127 char *sessid; 127 char *sessid;
128 char *auth; 128 char *auth;
129 int trId; 129 uint32_t trId;
130 int total; 130 int total;
131 char *user; 131 char *user;
132 GSList *txqueue; 132 GSList *txqueue;
133 }; 133 };
134 134
356 if (strchr(gc->username, '@') != strstr(gc->username, "@hotmail.com")) 356 if (strchr(gc->username, '@') != strstr(gc->username, "@hotmail.com"))
357 /* We can only get Hotmail notification from hotmail users */ 357 /* We can only get Hotmail notification from hotmail users */
358 return; 358 return;
359 359
360 if (!md->passport) { 360 if (!md->passport) {
361 g_snprintf(buf, sizeof(buf), "URL %d INBOX\r\n", ++md->trId); 361 g_snprintf(buf, sizeof(buf), "URL %u INBOX\r\n", ++md->trId);
362 362
363 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 363 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
364 return; 364 return;
365 } 365 }
366 } else { 366 } else {
532 if (ms->chat) 532 if (ms->chat)
533 add_chat_buddy(ms->chat, user, NULL); 533 add_chat_buddy(ms->chat, user, NULL);
534 ms->total++; 534 ms->total++;
535 while (ms->txqueue) { 535 while (ms->txqueue) {
536 char *send = add_cr(ms->txqueue->data); 536 char *send = add_cr(ms->txqueue->data);
537 g_snprintf(sendbuf, sizeof(sendbuf), "MSG %d N %d\r\n%s%s", ++ms->trId, 537 g_snprintf(sendbuf, sizeof(sendbuf), "MSG %u N %d\r\n%s%s", ++ms->trId,
538 strlen(MIME_HEADER) + strlen(send), 538 strlen(MIME_HEADER) + strlen(send),
539 MIME_HEADER, send); 539 MIME_HEADER, send);
540 g_free(ms->txqueue->data); 540 g_free(ms->txqueue->data);
541 ms->txqueue = g_slist_remove(ms->txqueue, ms->txqueue->data); 541 ms->txqueue = g_slist_remove(ms->txqueue, ms->txqueue->data);
542 if (msn_write(ms->fd, sendbuf, strlen(sendbuf)) < 0) { 542 if (msn_write(ms->fd, sendbuf, strlen(sendbuf)) < 0) {
573 struct msn_switchboard *ms = msn_find_writable_switch(gc); 573 struct msn_switchboard *ms = msn_find_writable_switch(gc);
574 574
575 if (!ms) 575 if (!ms)
576 return 0; 576 return 0;
577 577
578 g_snprintf(sendbuf, sizeof(sendbuf), "CAL %d %s\r\n", ++ms->trId, ms->user); 578 g_snprintf(sendbuf, sizeof(sendbuf), "CAL %u %s\r\n", ++ms->trId, ms->user);
579 if (msn_write(ms->fd, sendbuf, strlen(sendbuf)) < 0) { 579 if (msn_write(ms->fd, sendbuf, strlen(sendbuf)) < 0) {
580 msn_kill_switch(ms); 580 msn_kill_switch(ms);
581 return 0; 581 return 0;
582 } 582 }
583 } else if (isdigit(*buf)) { 583 } else if (isdigit(*buf)) {
618 } 618 }
619 619
620 cur = strstr(mime, "CO="); 620 cur = strstr(mime, "CO=");
621 if (cur && (*(cur = cur + 3) != ';')) { 621 if (cur && (*(cur = cur + 3) != ';')) {
622 if (sscanf (cur, "%x;", &colorbuf) == 1) { 622 if (sscanf (cur, "%x;", &colorbuf) == 1) {
623 char tag[MSN_BUF_LEN]; 623 char tag[64];
624 g_snprintf(tag, sizeof(tag), "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", colors[0], colors[1], colors[2]); 624 g_snprintf(tag, sizeof(tag), "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", colors[0], colors[1], colors[2]);
625 ret = g_string_append(ret, tag); 625 ret = g_string_append(ret, tag);
626 } 626 }
627 } 627 }
628 628
637 char sendbuf[MSN_BUF_LEN]; 637 char sendbuf[MSN_BUF_LEN];
638 638
639 if (!g_strncasecmp(buf, "VER MSNFTP", 10)) { 639 if (!g_strncasecmp(buf, "VER MSNFTP", 10)) {
640 640
641 /* Send the USR string. */ 641 /* Send the USR string. */
642 g_snprintf(sendbuf, sizeof(sendbuf), "USR %s %ld\r\n", 642 g_snprintf(sendbuf, sizeof(sendbuf), "USR %s %lu\r\n",
643 gc->username, mft->authcookie); 643 gc->username, (unsigned long)mft->authcookie);
644 644
645 if (msn_write(mft->fd, sendbuf, strlen(sendbuf)) < 0) { 645 if (msn_write(mft->fd, sendbuf, strlen(sendbuf)) < 0) {
646 /* TODO: Clean up */ 646 /* TODO: Clean up */
647 return 0; 647 return 0;
648 } 648 }
828 return; 828 return;
829 } 829 }
830 830
831 strncpy(mft->ip, ip, 16); 831 strncpy(mft->ip, ip, 16);
832 mft->port = atoi(port_s); 832 mft->port = atoi(port_s);
833 mft->authcookie = atoi(authcookie_s); 833 mft->authcookie = atol(authcookie_s);
834 834
835 mft->fd = proxy_connect(mft->ip, mft->port, msn_msnftp_connect, mft); 835 mft->fd = proxy_connect(mft->ip, mft->port, msn_msnftp_connect, mft);
836 836
837 if (ms->fd < 0) { 837 if (ms->fd < 0) {
838 md->file_transfers = g_slist_remove(md->file_transfers, mft); 838 md->file_transfers = g_slist_remove(md->file_transfers, mft);
1015 md = gc->proto_data; 1015 md = gc->proto_data;
1016 1016
1017 if (ms->fd != source) 1017 if (ms->fd != source)
1018 ms->fd = source; 1018 ms->fd = source;
1019 1019
1020 g_snprintf(buf, sizeof(buf), "ANS %d %s %s %s\r\n", ++ms->trId, gc->username, ms->auth, ms->sessid); 1020 g_snprintf(buf, sizeof(buf), "ANS %u %s %s %s\r\n", ++ms->trId, gc->username, ms->auth, ms->sessid);
1021 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { 1021 if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
1022 close(ms->fd); 1022 close(ms->fd);
1023 g_free(ms->sessid); 1023 g_free(ms->sessid);
1024 g_free(ms->auth); 1024 g_free(ms->auth);
1025 g_free(ms); 1025 g_free(ms);
1048 } 1048 }
1049 1049
1050 if (ms->fd != source) 1050 if (ms->fd != source)
1051 ms->fd = source; 1051 ms->fd = source;
1052 1052
1053 g_snprintf(buf, sizeof(buf), "USR %d %s %s\r\n", ++ms->trId, gc->username, ms->auth); 1053 g_snprintf(buf, sizeof(buf), "USR %u %s %s\r\n", ++ms->trId, gc->username, ms->auth);
1054 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { 1054 if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
1055 g_free(ms->auth); 1055 g_free(ms->auth);
1056 g_free(ms); 1056 g_free(ms);
1057 return; 1057 return;
1058 } 1058 }
1070 { 1070 {
1071 if(g_slist_find(connections, map->gc)) { 1071 if(g_slist_find(connections, map->gc)) {
1072 struct msn_data *md = map->gc->proto_data; 1072 struct msn_data *md = map->gc->proto_data;
1073 char buf[MSN_BUF_LEN]; 1073 char buf[MSN_BUF_LEN];
1074 1074
1075 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend)); 1075 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
1076 1076
1077 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 1077 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
1078 hide_login_progress(map->gc, _("Write error")); 1078 hide_login_progress(map->gc, _("Write error"));
1079 signoff(map->gc); 1079 signoff(map->gc);
1080 return; 1080 return;
1093 { 1093 {
1094 if(g_slist_find(connections, map->gc)) { 1094 if(g_slist_find(connections, map->gc)) {
1095 struct msn_data *md = map->gc->proto_data; 1095 struct msn_data *md = map->gc->proto_data;
1096 char buf[MSN_BUF_LEN]; 1096 char buf[MSN_BUF_LEN];
1097 1097
1098 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend)); 1098 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
1099 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 1099 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
1100 hide_login_progress(map->gc, _("Write error")); 1100 hide_login_progress(map->gc, _("Write error"));
1101 signoff(map->gc); 1101 signoff(map->gc);
1102 return; 1102 return;
1103 } 1103 }
1187 md5_init(&st); 1187 md5_init(&st);
1188 md5_append(&st, (const md5_byte_t *)hash, strlen(hash)); 1188 md5_append(&st, (const md5_byte_t *)hash, strlen(hash));
1189 md5_append(&st, (const md5_byte_t *)"Q1P7W2E4J9R8U3S5", strlen("Q1P7W2E4J9R8U3S5")); 1189 md5_append(&st, (const md5_byte_t *)"Q1P7W2E4J9R8U3S5", strlen("Q1P7W2E4J9R8U3S5"));
1190 md5_finish(&st, di); 1190 md5_finish(&st, di);
1191 1191
1192 g_snprintf(sendbuf, sizeof(sendbuf), "QRY %d msmsgs@msnmsgr.com 32\r\n", ++md->trId); 1192 g_snprintf(sendbuf, sizeof(sendbuf), "QRY %u msmsgs@msnmsgr.com 32\r\n", ++md->trId);
1193 for (i = 0; i < 16; i++) { 1193 for (i = 0; i < 16; i++) {
1194 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); 1194 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]);
1195 strcat(sendbuf, buf2); 1195 strcat(sendbuf, buf2);
1196 } 1196 }
1197 1197
1304 } 1304 }
1305 1305
1306 if (pos != tot) 1306 if (pos != tot)
1307 return 1; /* this isn't the last one in the RL, so return. */ 1307 return 1; /* this isn't the last one in the RL, so return. */
1308 1308
1309 g_snprintf(sendbuf, sizeof(sendbuf), "CHG %d NLN\r\n", ++md->trId); 1309 g_snprintf(sendbuf, sizeof(sendbuf), "CHG %u NLN\r\n", ++md->trId);
1310 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) { 1310 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
1311 hide_login_progress(gc, _("Unable to write")); 1311 hide_login_progress(gc, _("Unable to write"));
1312 signoff(gc); 1312 signoff(gc);
1313 return 0; 1313 return 0;
1314 } 1314 }
1320 md->deny = g_slist_copy(gc->deny); 1320 md->deny = g_slist_copy(gc->deny);
1321 1321
1322 if (bud_list_cache_exists(gc)) 1322 if (bud_list_cache_exists(gc))
1323 do_import(gc, NULL); 1323 do_import(gc, NULL);
1324 else { 1324 else {
1325 g_snprintf(sendbuf, sizeof(sendbuf), "BLP %d AL\r\n", ++md->trId); 1325 g_snprintf(sendbuf, sizeof(sendbuf), "BLP %u AL\r\n", ++md->trId);
1326 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) { 1326 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
1327 hide_login_progress(gc, _("Unable to write")); 1327 hide_login_progress(gc, _("Unable to write"));
1328 signoff(gc); 1328 signoff(gc);
1329 return 0; 1329 return 0;
1330 } 1330 }
1484 unlink(md->passport); 1484 unlink(md->passport);
1485 g_free(md->passport); 1485 g_free(md->passport);
1486 } 1486 }
1487 1487
1488 if( (fd = gaim_mkstemp(&(md->passport))) == NULL ) { 1488 if( (fd = gaim_mkstemp(&(md->passport))) == NULL ) {
1489 debug_printf("Error opening temp file\n"); 1489 debug_printf("Error opening temp file: %s\n", strerror(errno));
1490 } 1490 }
1491 else { 1491 else {
1492 fprintf(fd, "<html>\n"); 1492 fputs("<html>\n"
1493 fprintf(fd, "<head>\n"); 1493 "<head>\n"
1494 fprintf(fd, "<noscript>\n"); 1494 "<noscript>\n"
1495 fprintf(fd, "<meta http-equiv=Refresh content=\"0; url=http://www.hotmail.com\">\n"); 1495 "<meta http-equiv=Refresh content=\"0; url=http://www.hotmail.com\">\n"
1496 fprintf(fd, "</noscript>\n"); 1496 "</noscript>\n"
1497 fprintf(fd, "</head>\n\n"); 1497 "</head>\n\n", fd);
1498 1498
1499 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n"); 1499 fprintf(fd, "<body onload=\"document.pform.submit(); \">\n");
1500 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", passport); 1500 fprintf(fd, "<form name=\"pform\" action=\"%s\" method=\"POST\">\n\n", passport);
1501 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n"); 1501 fprintf(fd, "<input type=\"hidden\" name=\"mode\" value=\"ttl\">\n");
1502 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", gc->username); 1502 fprintf(fd, "<input type=\"hidden\" name=\"login\" value=\"%s\">\n", gc->username);
1510 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", sendbuf); // Digest me 1510 fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", sendbuf); // Digest me
1511 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); 1511 fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n");
1512 fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n"); 1512 fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n");
1513 fprintf(fd, "</form></body>\n"); 1513 fprintf(fd, "</form></body>\n");
1514 fprintf(fd, "</html>\n"); 1514 fprintf(fd, "</html>\n");
1515 fclose(fd); 1515 if (fclose(fd)) {
1516 debug_printf("Error closing temp file: %s\n", strerror(errno));
1517 unlink(md->passport);
1518 g_free(md->passport);
1519 }
1516 } 1520 }
1517 } else if (!g_strncasecmp(buf, "SYN", 3)) { 1521 } else if (!g_strncasecmp(buf, "SYN", 3)) {
1518 } else if (!g_strncasecmp(buf, "USR", 3)) { 1522 } else if (!g_strncasecmp(buf, "USR", 3)) {
1519 } else if (!g_strncasecmp(buf, "XFR", 3)) { 1523 } else if (!g_strncasecmp(buf, "XFR", 3)) {
1520 char *host = strstr(buf, "SB"); 1524 char *host = strstr(buf, "SB");
1546 tmp = host; 1550 tmp = host;
1547 GET_NEXT(tmp); 1551 GET_NEXT(tmp);
1548 } 1552 }
1549 1553
1550 if (switchboard) { 1554 if (switchboard) {
1555 int rc;
1551 struct msn_switchboard *ms = msn_find_writable_switch(gc); 1556 struct msn_switchboard *ms = msn_find_writable_switch(gc);
1552 if (!ms) 1557 if (!ms)
1553 return 1; 1558 return 1;
1554 1559
1555 GET_NEXT(tmp); 1560 GET_NEXT(tmp);
1556 1561
1557 ms->fd = proxy_connect(host, port, msn_ss_xfr_connect, ms); 1562 rc = proxy_connect(host, port, msn_ss_xfr_connect, ms);
1558 if (ms->fd < 0) { 1563 if (rc < 0) {
1559 msn_kill_switch(ms); 1564 msn_kill_switch(ms);
1560 return 1; 1565 return 1;
1561 } 1566 }
1562 ms->auth = g_strdup(tmp); 1567 ms->auth = g_strdup(tmp);
1563 } else { 1568 } else {
1569 int rc;
1564 close(md->fd); 1570 close(md->fd);
1565 gaim_input_remove(md->inpa); 1571 gaim_input_remove(md->inpa);
1566 md->inpa = 0; 1572 md->inpa = 0;
1567 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); 1573 rc = proxy_connect(host, port, msn_login_xfr_connect, gc);
1568 if (md->fd < 0) { 1574 if (rc < 0) {
1569 hide_login_progress(gc, _("Error transfering")); 1575 hide_login_progress(gc, _("Error transfering"));
1570 signoff(gc); 1576 signoff(gc);
1571 return 0; 1577 return 0;
1572 } 1578 }
1573 } 1579 }
1737 hide_login_progress(gc, _("Unable to connect to Notification Server")); 1743 hide_login_progress(gc, _("Unable to connect to Notification Server"));
1738 signoff(gc); 1744 signoff(gc);
1739 return; 1745 return;
1740 } 1746 }
1741 1747
1742 g_snprintf(buf, sizeof(buf), "VER %d MSNP5\r\n", ++md->trId); 1748 g_snprintf(buf, sizeof(buf), "VER %u MSNP5\r\n", ++md->trId);
1743 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 1749 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
1744 hide_login_progress(gc, _("Unable to talk to Notification Server")); 1750 hide_login_progress(gc, _("Unable to talk to Notification Server"));
1745 signoff(gc); 1751 signoff(gc);
1746 return; 1752 return;
1747 } 1753 }
1760 hide_login_progress(gc, _("Protocol not supported")); 1766 hide_login_progress(gc, _("Protocol not supported"));
1761 signoff(gc); 1767 signoff(gc);
1762 return 0; 1768 return 0;
1763 } 1769 }
1764 1770
1765 g_snprintf(sendbuf, sizeof(sendbuf), "INF %d\r\n", ++md->trId); 1771 g_snprintf(sendbuf, sizeof(sendbuf), "INF %u\r\n", ++md->trId);
1766 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) { 1772 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
1767 hide_login_progress(gc, _("Unable to request INF\n")); 1773 hide_login_progress(gc, _("Unable to request INF\n"));
1768 signoff(gc); 1774 signoff(gc);
1769 return 0; 1775 return 0;
1770 } 1776 }
1774 hide_login_progress(gc, _("Unable to login using MD5")); 1780 hide_login_progress(gc, _("Unable to login using MD5"));
1775 signoff(gc); 1781 signoff(gc);
1776 return 0; 1782 return 0;
1777 } 1783 }
1778 1784
1779 g_snprintf(sendbuf, sizeof(sendbuf), "USR %d MD5 I %s\r\n", ++md->trId, gc->username); 1785 g_snprintf(sendbuf, sizeof(sendbuf), "USR %u MD5 I %s\r\n", ++md->trId, gc->username);
1780 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) { 1786 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
1781 hide_login_progress(gc, _("Unable to send USR\n")); 1787 hide_login_progress(gc, _("Unable to send USR\n"));
1782 signoff(gc); 1788 signoff(gc);
1783 return 0; 1789 return 0;
1784 } 1790 }
1797 1803
1798 /* so here, we're either getting the challenge or the OK */ 1804 /* so here, we're either getting the challenge or the OK */
1799 if (!g_strcasecmp(resp, "OK")) { 1805 if (!g_strcasecmp(resp, "OK")) {
1800 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); 1806 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend);
1801 1807
1802 g_snprintf(sendbuf, sizeof(sendbuf), "SYN %d 0\r\n", ++md->trId); 1808 g_snprintf(sendbuf, sizeof(sendbuf), "SYN %u 0\r\n", ++md->trId);
1803 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) { 1809 if (msn_write(md->fd, sendbuf, strlen(sendbuf)) < 0) {
1804 hide_login_progress(gc, _("Unable to write")); 1810 hide_login_progress(gc, _("Unable to write"));
1805 signoff(gc); 1811 signoff(gc);
1806 return 0; 1812 return 0;
1807 } 1813 }
1819 1825
1820 md5_init(&st); 1826 md5_init(&st);
1821 md5_append(&st, (const md5_byte_t *)buf2, strlen(buf2)); 1827 md5_append(&st, (const md5_byte_t *)buf2, strlen(buf2));
1822 md5_finish(&st, di); 1828 md5_finish(&st, di);
1823 1829
1824 g_snprintf(sendbuf, sizeof(sendbuf), "USR %d MD5 S ", ++md->trId); 1830 g_snprintf(sendbuf, sizeof(sendbuf), "USR %u MD5 S ", ++md->trId);
1825 for (i = 0; i < 16; i++) { 1831 for (i = 0; i < 16; i++) {
1826 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]); 1832 g_snprintf(buf2, sizeof(buf2), "%02x", di[i]);
1827 strcat(sendbuf, buf2); 1833 strcat(sendbuf, buf2);
1828 } 1834 }
1829 strcat(sendbuf, "\r\n"); 1835 strcat(sendbuf, "\r\n");
1954 hide_login_progress(gc, _("Unable to connect")); 1960 hide_login_progress(gc, _("Unable to connect"));
1955 signoff(gc); 1961 signoff(gc);
1956 return; 1962 return;
1957 } 1963 }
1958 1964
1959 g_snprintf(buf, sizeof(buf), "VER %d MSNP5\r\n", ++md->trId); 1965 g_snprintf(buf, sizeof(buf), "VER %u MSNP5\r\n", ++md->trId);
1960 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 1966 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
1961 hide_login_progress(gc, _("Unable to write to server")); 1967 hide_login_progress(gc, _("Unable to write to server"));
1962 signoff(gc); 1968 signoff(gc);
1963 return; 1969 return;
1964 } 1970 }
2018 "Content-Type: text/x-msmsgscontrol\r\n" 2024 "Content-Type: text/x-msmsgscontrol\r\n"
2019 "TypingUser: "; 2025 "TypingUser: ";
2020 char buf [MSN_BUF_LEN]; 2026 char buf [MSN_BUF_LEN];
2021 if (!ms || !typing) 2027 if (!ms || !typing)
2022 return 0; 2028 return 0;
2023 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s\r\n\r\n\r\n", 2029 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s%s\r\n\r\n\r\n",
2024 ++ms->trId, 2030 ++ms->trId,
2025 strlen(header) + strlen("\r\n\r\n\r\n") + strlen(gc->username), 2031 strlen(header) + strlen("\r\n\r\n\r\n") + strlen(gc->username),
2026 header, gc->username); 2032 header, gc->username);
2027 if (msn_write(ms->fd, buf, strlen(buf)) < 0) 2033 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
2028 msn_kill_switch(ms); 2034 msn_kill_switch(ms);
2084 2090
2085 g_snprintf(header, sizeof(header), 2091 g_snprintf(header, sizeof(header),
2086 "MIME-Version: 1.0\r\n" 2092 "MIME-Version: 1.0\r\n"
2087 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n" 2093 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
2088 "Invitation-Command: CANCEL\r\n" 2094 "Invitation-Command: CANCEL\r\n"
2089 "Invitation-Cookie: %ld\r\n" 2095 "Invitation-Cookie: %lu\r\n"
2090 "Cancel-Code: REJECT\r\n", 2096 "Cancel-Code: REJECT\r\n",
2091 mft->cookie); 2097 (unsigned long)mft->cookie);
2092 2098
2093 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s\r\n\r\n", 2099 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s\r\n\r\n",
2094 ++ms->trId, strlen(header) + strlen("\r\n\r\n"), 2100 ++ms->trId, strlen(header) + strlen("\r\n\r\n"),
2095 header); 2101 header);
2096 2102
2097 md->file_transfers = g_slist_remove(md->file_transfers, mft); 2103 md->file_transfers = g_slist_remove(md->file_transfers, mft);
2098 2104
2119 2125
2120 g_snprintf(header, sizeof(header), 2126 g_snprintf(header, sizeof(header),
2121 "MIME-Version: 1.0\r\n" 2127 "MIME-Version: 1.0\r\n"
2122 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n" 2128 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
2123 "Invitation-Command: ACCEPT\r\n" 2129 "Invitation-Command: ACCEPT\r\n"
2124 "Invitation-Cookie: %ld\r\n" 2130 "Invitation-Cookie: %lu\r\n"
2125 "Launch-Application: FALSE\r\n" 2131 "Launch-Application: FALSE\r\n"
2126 "Request-Data: IP-Address:\r\n", 2132 "Request-Data: IP-Address:\r\n",
2127 mft->cookie); 2133 (unsigned long)mft->cookie);
2128 2134
2129 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s\r\n\r\n", 2135 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s\r\n\r\n",
2130 ++ms->trId, strlen(header) + strlen("\r\n\r\n"), 2136 ++ms->trId, strlen(header) + strlen("\r\n\r\n"),
2131 header); 2137 header);
2132 2138
2133 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { 2139 if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
2134 msn_kill_switch(ms); 2140 msn_kill_switch(ms);
2155 return; 2161 return;
2156 2162
2157 if (stat(name, &sb) == -1) 2163 if (stat(name, &sb) == -1)
2158 return; 2164 return;
2159 2165
2160 mft->cookie = 1 + (int)(sizeof(unsigned long) * rand() / (RAND_MAX + 1.0)); 2166 mft->cookie = 1 + (uint32_t)(4294967295.0 * rand() / (RAND_MAX + 1.0));
2161 2167
2162 g_snprintf(header, sizeof(header), 2168 g_snprintf(header, sizeof(header),
2163 "MIME-Version: 1.0\r\n" 2169 "MIME-Version: 1.0\r\n"
2164 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n" 2170 "Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n"
2165 "Application-Name: File Transfer\r\n" 2171 "Application-Name: File Transfer\r\n"
2166 "Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n" 2172 "Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n"
2167 "Invitation-Command: INVITE\r\n" 2173 "Invitation-Command: INVITE\r\n"
2168 "Invitation-Cookie: %ld\r\n" 2174 "Invitation-Cookie: %lu\r\n"
2169 "Application-File: %s\r\n" 2175 "Application-File: %s\r\n"
2170 "Application-FileSize: %ld\r\n", 2176 "Application-FileSize: %ld\r\n",
2171 mft->cookie, name, sb.st_size); 2177 (unsigned long)mft->cookie, name, sb.st_size);
2172 2178
2173 g_snprintf(buf, sizeof(buf), "MSG %d A %d\r\n%s\r\n\r\n", 2179 g_snprintf(buf, sizeof(buf), "MSG %u A %d\r\n%s\r\n\r\n",
2174 ++ms->trId, 2180 ++ms->trId,
2175 strlen(header) + strlen("\r\n\r\n"), 2181 strlen(header) + strlen("\r\n\r\n"),
2176 header); 2182 header);
2177 2183
2178 if (msn_write(ms->fd, buf, strlen(buf)) < 0) 2184 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
2241 ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message)); 2247 ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message));
2242 return 1; 2248 return 1;
2243 } 2249 }
2244 2250
2245 send = add_cr(message); 2251 send = add_cr(message);
2246 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId, 2252 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s%s", ++ms->trId,
2247 strlen(MIME_HEADER) + strlen(send), 2253 strlen(MIME_HEADER) + strlen(send),
2248 MIME_HEADER, send); 2254 MIME_HEADER, send);
2249 g_free(send); 2255 g_free(send);
2250 if (msn_write(ms->fd, buf, strlen(buf)) < 0) 2256 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
2251 msn_kill_switch(ms); 2257 msn_kill_switch(ms);
2252 debug_printf("\n"); 2258 debug_printf("\n");
2253 } else if (strcmp(who, gc->username)) { 2259 } else if (strcmp(who, gc->username)) {
2254 g_snprintf(buf, MSN_BUF_LEN, "XFR %d SB\r\n", ++md->trId); 2260 g_snprintf(buf, MSN_BUF_LEN, "XFR %u SB\r\n", ++md->trId);
2255 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2261 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2256 hide_login_progress(gc, _("Write error")); 2262 hide_login_progress(gc, _("Write error"));
2257 signoff(gc); 2263 signoff(gc);
2258 return 1; 2264 return 1;
2259 } 2265 }
2278 2284
2279 if (!ms) 2285 if (!ms)
2280 return -EINVAL; 2286 return -EINVAL;
2281 2287
2282 send = add_cr(message); 2288 send = add_cr(message);
2283 g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId, 2289 g_snprintf(buf, sizeof(buf), "MSG %u N %d\r\n%s%s", ++ms->trId,
2284 strlen(MIME_HEADER) + strlen(send), 2290 strlen(MIME_HEADER) + strlen(send),
2285 MIME_HEADER, send); 2291 MIME_HEADER, send);
2286 g_free(send); 2292 g_free(send);
2287 if (msn_write(ms->fd, buf, strlen(buf)) < 0) { 2293 if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
2288 msn_kill_switch(ms); 2294 msn_kill_switch(ms);
2299 char buf[MSN_BUF_LEN]; 2305 char buf[MSN_BUF_LEN];
2300 2306
2301 if (!ms) 2307 if (!ms)
2302 return; 2308 return;
2303 2309
2304 g_snprintf(buf, sizeof(buf), "CAL %d %s\r\n", ++ms->trId, who); 2310 g_snprintf(buf, sizeof(buf), "CAL %u %s\r\n", ++ms->trId, who);
2305 if (msn_write(ms->fd, buf, strlen(buf)) < 0) 2311 if (msn_write(ms->fd, buf, strlen(buf)) < 0)
2306 msn_kill_switch(ms); 2312 msn_kill_switch(ms);
2307 } 2313 }
2308 2314
2309 static void msn_chat_leave(struct gaim_connection *gc, int id) 2315 static void msn_chat_leave(struct gaim_connection *gc, int id)
2336 2342
2337 static void msn_set_away(struct gaim_connection *gc, char *state, char *msg) 2343 static void msn_set_away(struct gaim_connection *gc, char *state, char *msg)
2338 { 2344 {
2339 struct msn_data *md = gc->proto_data; 2345 struct msn_data *md = gc->proto_data;
2340 char buf[MSN_BUF_LEN]; 2346 char buf[MSN_BUF_LEN];
2341 char *away; 2347 const char *away;
2342 2348
2343 if (gc->away) { 2349 if (gc->away) {
2344 g_free(gc->away); 2350 g_free(gc->away);
2345 gc->away = NULL; 2351 gc->away = NULL;
2346 } 2352 }
2371 } else if (gc->is_idle) 2377 } else if (gc->is_idle)
2372 away = "IDL"; 2378 away = "IDL";
2373 else 2379 else
2374 away = "NLN"; 2380 away = "NLN";
2375 2381
2376 g_snprintf(buf, sizeof(buf), "CHG %d %s\r\n", ++md->trId, away); 2382 g_snprintf(buf, sizeof(buf), "CHG %u %s\r\n", ++md->trId, away);
2377 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2383 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2378 hide_login_progress(gc, _("Write error")); 2384 hide_login_progress(gc, _("Write error"));
2379 signoff(gc); 2385 signoff(gc);
2380 return; 2386 return;
2381 } 2387 }
2382 } 2388 }
2383 2389
2384 static void msn_set_idle(struct gaim_connection *gc, int idle) 2390 static void msn_set_idle(struct gaim_connection *gc, int idle)
2385 { 2391 {
2386 struct msn_data *md = gc->proto_data; 2392 struct msn_data *md = gc->proto_data;
2387 char buf[MSN_BUF_LEN]; 2393 char buf[64];
2388 2394
2389 if (gc->away) 2395 if (gc->away)
2390 return; 2396 return;
2391 if (idle) 2397 g_snprintf(buf, sizeof(buf),
2392 g_snprintf(buf, sizeof(buf), "CHG %d IDL\r\n", ++md->trId); 2398 idle ? "CHG %d IDL\r\n" : "CHG %u NLN\r\n", ++md->trId);
2393 else
2394 g_snprintf(buf, sizeof(buf), "CHG %d NLN\r\n", ++md->trId);
2395 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2399 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2396 hide_login_progress(gc, _("Write error")); 2400 hide_login_progress(gc, _("Write error"));
2397 signoff(gc); 2401 signoff(gc);
2398 return; 2402 return;
2399 } 2403 }
2494 l = l->next; 2498 l = l->next;
2495 } 2499 }
2496 if (l) 2500 if (l)
2497 return; 2501 return;
2498 2502
2499 g_snprintf(buf, sizeof(buf), "ADD %d FL %s %s\r\n", ++md->trId, who, who); 2503 g_snprintf(buf, sizeof(buf), "ADD %u FL %s %s\r\n", ++md->trId, who, who);
2500 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2504 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2501 hide_login_progress(gc, _("Write error")); 2505 hide_login_progress(gc, _("Write error"));
2502 signoff(gc); 2506 signoff(gc);
2503 return; 2507 return;
2504 } 2508 }
2507 static void msn_rem_buddy(struct gaim_connection *gc, char *who, char *group) 2511 static void msn_rem_buddy(struct gaim_connection *gc, char *who, char *group)
2508 { 2512 {
2509 struct msn_data *md = gc->proto_data; 2513 struct msn_data *md = gc->proto_data;
2510 char buf[MSN_BUF_LEN]; 2514 char buf[MSN_BUF_LEN];
2511 2515
2512 g_snprintf(buf, sizeof(buf), "REM %d FL %s\r\n", ++md->trId, who); 2516 g_snprintf(buf, sizeof(buf), "REM %u FL %s\r\n", ++md->trId, who);
2513 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2517 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2514 hide_login_progress(gc, _("Write error")); 2518 hide_login_progress(gc, _("Write error"));
2515 signoff(gc); 2519 signoff(gc);
2516 return; 2520 return;
2517 } 2521 }
2532 if (strlen(alias) >= BUDDY_ALIAS_MAXLEN) { 2536 if (strlen(alias) >= BUDDY_ALIAS_MAXLEN) {
2533 do_error_dialog(_("New MSN friendly name too long."), NULL, GAIM_ERROR); 2537 do_error_dialog(_("New MSN friendly name too long."), NULL, GAIM_ERROR);
2534 return; 2538 return;
2535 } 2539 }
2536 2540
2537 g_snprintf(buf, sizeof(buf), "REA %d %s %s\r\n", ++md->trId, gc->username, url_encode(alias)); 2541 g_snprintf(buf, sizeof(buf), "REA %u %s %s\r\n", ++md->trId, gc->username, url_encode(alias));
2538 g_free(alias); 2542 g_free(alias);
2539 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2543 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2540 hide_login_progress(gc, _("Write error")); 2544 hide_login_progress(gc, _("Write error"));
2541 signoff(gc); 2545 signoff(gc);
2542 return; 2546 return;
2592 struct msn_data *md = gc->proto_data; 2596 struct msn_data *md = gc->proto_data;
2593 char buf[MSN_BUF_LEN]; 2597 char buf[MSN_BUF_LEN];
2594 GSList *s, *t = NULL; 2598 GSList *s, *t = NULL;
2595 2599
2596 if (gc->permdeny == PERMIT_ALL || gc->permdeny == DENY_SOME) 2600 if (gc->permdeny == PERMIT_ALL || gc->permdeny == DENY_SOME)
2597 g_snprintf(buf, sizeof(buf), "BLP %d AL\r\n", ++md->trId); 2601 g_snprintf(buf, sizeof(buf), "BLP %u AL\r\n", ++md->trId);
2598 else 2602 else
2599 g_snprintf(buf, sizeof(buf), "BLP %d BL\r\n", ++md->trId); 2603 g_snprintf(buf, sizeof(buf), "BLP %u BL\r\n", ++md->trId);
2600 2604
2601 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2605 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2602 hide_login_progress(gc, _("Write error")); 2606 hide_login_progress(gc, _("Write error"));
2603 signoff(gc); 2607 signoff(gc);
2604 return; 2608 return;
2630 } 2634 }
2631 if ((dupl = (char *)g_slist_find(md->deny, who))) { 2635 if ((dupl = (char *)g_slist_find(md->deny, who))) {
2632 t = g_slist_append(t, who); 2636 t = g_slist_append(t, who);
2633 continue; 2637 continue;
2634 } 2638 }
2635 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); 2639 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, who, who);
2636 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2640 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2637 hide_login_progress(gc, _("Write error")); 2641 hide_login_progress(gc, _("Write error"));
2638 signoff(gc); 2642 signoff(gc);
2639 return; 2643 return;
2640 } 2644 }
2664 } 2668 }
2665 if ((dupl = (char *)g_slist_find(md->deny, who))) { 2669 if ((dupl = (char *)g_slist_find(md->deny, who))) {
2666 t = g_slist_append(t, who); 2670 t = g_slist_append(t, who);
2667 continue; 2671 continue;
2668 } 2672 }
2669 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who); 2673 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, who, who);
2670 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2674 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2671 hide_login_progress(gc, _("Write error")); 2675 hide_login_progress(gc, _("Write error"));
2672 signoff(gc); 2676 signoff(gc);
2673 return; 2677 return;
2674 } 2678 }
2705 2709
2706 if ((dupl = (char *)g_slist_find_custom(gc->deny, who, 2710 if ((dupl = (char *)g_slist_find_custom(gc->deny, who,
2707 (GCompareFunc)strcmp))) { 2711 (GCompareFunc)strcmp))) {
2708 debug_printf("MSN: Moving %s from BL to AL\n", who); 2712 debug_printf("MSN: Moving %s from BL to AL\n", who);
2709 gc->deny = g_slist_remove(gc->deny, dupl); 2713 gc->deny = g_slist_remove(gc->deny, dupl);
2710 g_snprintf(buf, sizeof(buf), "REM %d BL %s\r\n", ++md->trId, who); 2714 g_snprintf(buf, sizeof(buf), "REM %u BL %s\r\n", ++md->trId, who);
2711 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2715 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2712 hide_login_progress(gc, _("Write error")); 2716 hide_login_progress(gc, _("Write error"));
2713 signoff(gc); 2717 signoff(gc);
2714 return; 2718 return;
2715 } 2719 }
2716 } 2720 }
2717 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); 2721 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, who, who);
2718 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2722 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2719 hide_login_progress(gc, _("Write error")); 2723 hide_login_progress(gc, _("Write error"));
2720 signoff(gc); 2724 signoff(gc);
2721 return; 2725 return;
2722 } 2726 }
2725 static void msn_rem_permit(struct gaim_connection *gc, char *who) 2729 static void msn_rem_permit(struct gaim_connection *gc, char *who)
2726 { 2730 {
2727 struct msn_data *md = gc->proto_data; 2731 struct msn_data *md = gc->proto_data;
2728 char buf[MSN_BUF_LEN]; 2732 char buf[MSN_BUF_LEN];
2729 2733
2730 g_snprintf(buf, sizeof(buf), "REM %d AL %s\r\n", ++md->trId, who); 2734 g_snprintf(buf, sizeof(buf), "REM %u AL %s\r\n", ++md->trId, who);
2731 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2735 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2732 hide_login_progress(gc, _("Write error")); 2736 hide_login_progress(gc, _("Write error"));
2733 signoff(gc); 2737 signoff(gc);
2734 return; 2738 return;
2735 } 2739 }
2736 2740
2737 g_slist_append(gc->deny, who); 2741 g_slist_append(gc->deny, who);
2738 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who); 2742 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, who, who);
2739 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2743 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2740 hide_login_progress(gc, _("Write error")); 2744 hide_login_progress(gc, _("Write error"));
2741 signoff(gc); 2745 signoff(gc);
2742 return; 2746 return;
2743 } 2747 }
2762 2766
2763 if ((dupl = (char *)g_slist_find_custom(gc->permit, who, 2767 if ((dupl = (char *)g_slist_find_custom(gc->permit, who,
2764 (GCompareFunc)strcmp))) { 2768 (GCompareFunc)strcmp))) {
2765 debug_printf("MSN: Moving %s from AL to BL\n", who); 2769 debug_printf("MSN: Moving %s from AL to BL\n", who);
2766 gc->permit = g_slist_remove(gc->permit, dupl); 2770 gc->permit = g_slist_remove(gc->permit, dupl);
2767 g_snprintf(buf, sizeof(buf), "REM %d AL %s\r\n", ++md->trId, who); 2771 g_snprintf(buf, sizeof(buf), "REM %u AL %s\r\n", ++md->trId, who);
2768 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2772 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2769 hide_login_progress(gc, _("Write error")); 2773 hide_login_progress(gc, _("Write error"));
2770 signoff(gc); 2774 signoff(gc);
2771 return; 2775 return;
2772 } 2776 }
2773 } 2777 }
2774 2778
2775 2779
2776 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who); 2780 g_snprintf(buf, sizeof(buf), "ADD %u BL %s %s\r\n", ++md->trId, who, who);
2777 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2781 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2778 hide_login_progress(gc, _("Write error")); 2782 hide_login_progress(gc, _("Write error"));
2779 signoff(gc); 2783 signoff(gc);
2780 return; 2784 return;
2781 } 2785 }
2784 static void msn_rem_deny(struct gaim_connection *gc, char *who) 2788 static void msn_rem_deny(struct gaim_connection *gc, char *who)
2785 { 2789 {
2786 struct msn_data *md = gc->proto_data; 2790 struct msn_data *md = gc->proto_data;
2787 char buf[MSN_BUF_LEN]; 2791 char buf[MSN_BUF_LEN];
2788 2792
2789 g_snprintf(buf, sizeof(buf), "REM %d BL %s\r\n", ++md->trId, who); 2793 g_snprintf(buf, sizeof(buf), "REM %u BL %s\r\n", ++md->trId, who);
2790 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2794 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2791 hide_login_progress(gc, _("Write error")); 2795 hide_login_progress(gc, _("Write error"));
2792 signoff(gc); 2796 signoff(gc);
2793 return; 2797 return;
2794 } 2798 }
2795 2799
2796 g_slist_append(gc->permit, who); 2800 g_slist_append(gc->permit, who);
2797 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); 2801 g_snprintf(buf, sizeof(buf), "ADD %u AL %s %s\r\n", ++md->trId, who, who);
2798 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 2802 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
2799 hide_login_progress(gc, _("Write error")); 2803 hide_login_progress(gc, _("Write error"));
2800 signoff(gc); 2804 signoff(gc);
2801 return; 2805 return;
2802 } 2806 }