Mercurial > pidgin
comparison src/protocols/jabber/si.c @ 10939:45598096d197
[gaim-migrate @ 12729]
this prevents a jabber ft crash (went into oldstatus a while ago)
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 26 May 2005 03:51:40 +0000 |
parents | b256ce6b85b8 |
children | 999555fbbbd9 |
comparison
equal
deleted
inserted
replaced
10938:6320ea98b28d | 10939:45598096d197 |
---|---|
679 void jabber_si_parse(JabberStream *js, xmlnode *packet) | 679 void jabber_si_parse(JabberStream *js, xmlnode *packet) |
680 { | 680 { |
681 JabberSIXfer *jsx; | 681 JabberSIXfer *jsx; |
682 GaimXfer *xfer; | 682 GaimXfer *xfer; |
683 xmlnode *si, *file, *feature, *x, *field, *option, *value; | 683 xmlnode *si, *file, *feature, *x, *field, *option, *value; |
684 const char *stream_id, *filename, *filesize_c, *profile; | 684 const char *stream_id, *filename, *filesize_c, *profile, *from; |
685 size_t filesize = 0; | 685 size_t filesize = 0; |
686 | 686 |
687 if(!(si = xmlnode_get_child(packet, "si"))) | 687 if(!(si = xmlnode_get_child(packet, "si"))) |
688 return; | 688 return; |
689 | 689 |
705 | 705 |
706 if(!(feature = xmlnode_get_child(si, "feature"))) | 706 if(!(feature = xmlnode_get_child(si, "feature"))) |
707 return; | 707 return; |
708 | 708 |
709 if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) | 709 if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) |
710 return; | |
711 | |
712 if(!(from = xmlnode_get_attrib(packet, "from"))) | |
713 return; | |
714 | |
715 /* if they've already sent us this file transfer with the same damn id | |
716 * then we're gonna ignore it, until I think of something better to do | |
717 * with it */ | |
718 if((xfer = jabber_si_xfer_find(js, stream_id, from))) | |
710 return; | 719 return; |
711 | 720 |
712 jsx = g_new0(JabberSIXfer, 1); | 721 jsx = g_new0(JabberSIXfer, 1); |
713 | 722 |
714 for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { | 723 for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { |
740 | 749 |
741 jsx->js = js; | 750 jsx->js = js; |
742 jsx->stream_id = g_strdup(stream_id); | 751 jsx->stream_id = g_strdup(stream_id); |
743 jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id")); | 752 jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id")); |
744 | 753 |
745 xfer = gaim_xfer_new(js->gc->account, GAIM_XFER_RECEIVE, | 754 xfer = gaim_xfer_new(js->gc->account, GAIM_XFER_RECEIVE, from); |
746 xmlnode_get_attrib(packet, "from")); | |
747 xfer->data = jsx; | 755 xfer->data = jsx; |
748 | 756 |
749 gaim_xfer_set_filename(xfer, filename); | 757 gaim_xfer_set_filename(xfer, filename); |
750 if(filesize > 0) | 758 if(filesize > 0) |
751 gaim_xfer_set_size(xfer, filesize); | 759 gaim_xfer_set_size(xfer, filesize); |