diff libpurple/protocols/bonjour/bonjour_ft.c @ 21533:178fe7d45700

Fix receiving files from Gajim clients by making the SOCKS5 target hash correct.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 15 Nov 2007 23:37:36 +0000
parents 07c91ea3da0e
children 41959f031322
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour_ft.c	Thu Nov 15 22:01:48 2007 +0000
+++ b/libpurple/protocols/bonjour/bonjour_ft.c	Thu Nov 15 23:37:36 2007 +0000
@@ -33,7 +33,7 @@
 static void
 bonjour_bytestreams_init(PurpleXfer *xfer);
 static void
-bonjour_bytestreams_connect(PurpleXfer *xfer);
+bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb);
 static void
 bonjour_xfer_init(PurpleXfer *xfer);
 static void
@@ -546,7 +546,7 @@
 							xf->proxy_port = portnum;
 							purple_debug_info("bonjour", "bytestream offer parse"
 									  "jid=%s host=%s port=%d.\n", jid, host, portnum);
-							bonjour_bytestreams_connect(xfer);
+							bonjour_bytestreams_connect(xfer, pb);
 							found = TRUE;
 							break;
 						}
@@ -815,13 +815,17 @@
 	xmlnode *q_node, *tmp_node;
 	BonjourData *bd;
 
-	if(data == NULL || source < 0) {
+	if(source < 0) {
+		purple_debug_error("bonjour", "Error connecting via SOCKS5 - %s\n",
+			error_message ? error_message : "(null)");
 		xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel");
 		/* Cancel the connection */
 		purple_xfer_cancel_local(xfer);
 		return;
 	}
 
+	purple_debug_info("bonjour", "Connected successfully via SOCKS5, starting transfer.\n");
+
 	bd = xf->data;
 
 	purple_proxy_info_destroy(xf->proxy_info);
@@ -841,7 +845,7 @@
 }
 
 static void
-bonjour_bytestreams_connect(PurpleXfer *xfer)
+bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb)
 {
 	XepXfer *xf = NULL;
 	char dstaddr[41];
@@ -858,7 +862,7 @@
 	if(!xf)
 		return;
 
-	p = g_strdup_printf("%s@%s", xf->sid, xfer->who);
+	p = g_strdup_printf("%s%s%s", xf->sid, pb->name, purple_account_get_username(pb->account));
 	purple_cipher_digest_region("sha1", (guchar *)p, strlen(p),
 				    sizeof(hashval), hashval, NULL);
 	g_free(p);