| 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 { |