Mercurial > pidgin
comparison src/protocols/msn/msn.c @ 4186:9615c6996348
[gaim-migrate @ 4417]
Felipe Contreras (revo) writes:
" This fixes two problems with msn ft.
1. Application-Name is not always the same we should
check for Application-GUID.
2. GET_NEXT was changed recently, I added GET_NEXT_LINE
wich does a better job for multiple lines to fix it.
Now it works for me ;)"
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 03 Jan 2003 16:23:29 +0000 |
parents | 1bd663beada5 |
children | 511c2b63caa4 |
comparison
equal
deleted
inserted
replaced
4185:e52b0571ca95 | 4186:9615c6996348 |
---|---|
146 (tmp)++; \ | 146 (tmp)++; \ |
147 *(tmp)++ = 0; \ | 147 *(tmp)++ = 0; \ |
148 while (*(tmp) && *(tmp) == ' ') \ | 148 while (*(tmp) && *(tmp) == ' ') \ |
149 (tmp)++; | 149 (tmp)++; |
150 | 150 |
151 #define GET_NEXT_LINE(tmp,s) strsep (&tmp, " "); s = strsep (&tmp, "\r"); | |
151 | 152 |
152 static char *msn_normalize(const char *s) | 153 static char *msn_normalize(const char *s) |
153 { | 154 { |
154 static char buf[BUF_LEN]; | 155 static char buf[BUF_LEN]; |
155 | 156 |
760 { | 761 { |
761 struct msn_file_transfer *mft; | 762 struct msn_file_transfer *mft; |
762 struct msn_data *md = ms->gc->proto_data; | 763 struct msn_data *md = ms->gc->proto_data; |
763 char *tmp = msg; | 764 char *tmp = msg; |
764 | 765 |
765 if (strstr(msg, "Application-Name: File Transfer") && | 766 if (strstr(msg, "Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}") && |
766 strstr(msg, "Invitation-Command: INVITE")) { | 767 strstr(msg, "Invitation-Command: INVITE")) { |
767 | 768 |
768 /* | 769 /* |
769 * First invitation message, requesting an ACCEPT or CANCEL from | 770 * First invitation message, requesting an ACCEPT or CANCEL from |
770 * the recipient. Used in incoming file transfers. | 771 * the recipient. Used in incoming file transfers. |
772 | 773 |
773 char *filename; | 774 char *filename; |
774 char *cookie_s, *filesize_s; | 775 char *cookie_s, *filesize_s; |
775 size_t filesize; | 776 size_t filesize; |
776 | 777 |
777 tmp = strstr(msg, "Invitation-Cookie"); | 778 tmp = strstr(msg, "Invitation-Cookie:"); |
778 GET_NEXT(tmp); | 779 GET_NEXT_LINE(tmp, cookie_s); |
779 cookie_s = tmp; | 780 GET_NEXT_LINE(tmp, filename); |
780 GET_NEXT(tmp); | 781 GET_NEXT_LINE(tmp, filesize_s); |
781 GET_NEXT(tmp); | |
782 filename = tmp; | |
783 | |
784 /* Needed for filenames with spaces */ | |
785 tmp = strchr(tmp, '\r'); | |
786 *tmp = '\0'; | |
787 tmp += 2; | |
788 | |
789 GET_NEXT(tmp); | |
790 filesize_s = tmp; | |
791 GET_NEXT(tmp); | |
792 | 782 |
793 mft = g_new0(struct msn_file_transfer, 1); | 783 mft = g_new0(struct msn_file_transfer, 1); |
794 mft->gc = ms->gc; | 784 mft->gc = ms->gc; |
795 mft->type = MFT_SENDFILE_IN; | 785 mft->type = MFT_SENDFILE_IN; |
796 mft->sn = g_strdup(ms->msguser); | 786 mft->sn = g_strdup(ms->msguser); |
819 * the request. Used in incoming file transfers. | 809 * the request. Used in incoming file transfers. |
820 */ | 810 */ |
821 | 811 |
822 char *cookie_s, *ip, *port_s, *authcookie_s; | 812 char *cookie_s, *ip, *port_s, *authcookie_s; |
823 | 813 |
824 tmp = strstr(msg, "Invitation-Cookie"); | 814 tmp = strstr(msg, "Invitation-Cookie:"); |
825 GET_NEXT(tmp); | 815 GET_NEXT_LINE(tmp, cookie_s); |
826 cookie_s = tmp; | 816 GET_NEXT_LINE(tmp, ip); |
827 GET_NEXT(tmp); | 817 GET_NEXT_LINE(tmp, port_s); |
828 GET_NEXT(tmp); | 818 GET_NEXT_LINE(tmp, authcookie_s); |
829 ip = tmp; | 819 GET_NEXT_LINE(tmp, authcookie_s); |
830 GET_NEXT(tmp); | |
831 GET_NEXT(tmp); | |
832 port_s = tmp; | |
833 GET_NEXT(tmp); | |
834 GET_NEXT(tmp); | |
835 authcookie_s = tmp; | |
836 GET_NEXT(tmp); | |
837 | 820 |
838 mft = find_mft_by_cookie(ms->gc, atoi(cookie_s)); | 821 mft = find_mft_by_cookie(ms->gc, atoi(cookie_s)); |
839 | 822 |
840 if (!mft) | 823 if (!mft) |
841 { | 824 { |