changeset 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 6320ea98b28d
children 999555fbbbd9
files src/protocols/jabber/si.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/si.c	Thu May 26 03:29:07 2005 +0000
+++ b/src/protocols/jabber/si.c	Thu May 26 03:51:40 2005 +0000
@@ -681,7 +681,7 @@
 	JabberSIXfer *jsx;
 	GaimXfer *xfer;
 	xmlnode *si, *file, *feature, *x, *field, *option, *value;
-	const char *stream_id, *filename, *filesize_c, *profile;
+	const char *stream_id, *filename, *filesize_c, *profile, *from;
 	size_t filesize = 0;
 
 	if(!(si = xmlnode_get_child(packet, "si")))
@@ -709,6 +709,15 @@
 	if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data")))
 		return;
 
+	if(!(from = xmlnode_get_attrib(packet, "from")))
+		return;
+
+	/* if they've already sent us this file transfer with the same damn id
+	 * then we're gonna ignore it, until I think of something better to do
+	 * with it */
+	if((xfer = jabber_si_xfer_find(js, stream_id, from)))
+		return;
+
 	jsx = g_new0(JabberSIXfer, 1);
 
 	for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) {
@@ -742,8 +751,7 @@
 	jsx->stream_id = g_strdup(stream_id);
 	jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id"));
 
-	xfer = gaim_xfer_new(js->gc->account, GAIM_XFER_RECEIVE,
-			xmlnode_get_attrib(packet, "from"));
+	xfer = gaim_xfer_new(js->gc->account, GAIM_XFER_RECEIVE, from);
 	xfer->data = jsx;
 
 	gaim_xfer_set_filename(xfer, filename);