src/protocols/jabber/si.c

changeset 10939
91cca1a726ce
parent 10687
5ac4b470bee8
child 10940
3a7fc8684d13
--- 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);

mercurial