changeset 14499:67a6716bf4a7

[gaim-migrate @ 17218] this should fix file xfer for some folks committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 10 Sep 2006 15:49:50 +0000
parents 26bca01c7076
children 6a2922ff3339
files libgaim/protocols/jabber/si.c
diffstat 1 files changed, 25 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/jabber/si.c	Sun Sep 10 15:13:59 2006 +0000
+++ b/libgaim/protocols/jabber/si.c	Sun Sep 10 15:49:50 2006 +0000
@@ -131,6 +131,7 @@
 	char *dstaddr, *p;
 	int i;
 	unsigned char hashval[20];
+	JabberID *dstjid;
 
 	if(!jsx->streamhosts) {
 		JabberIq *iq = jabber_iq_new(jsx->js, JABBER_IQ_ERROR);
@@ -156,25 +157,33 @@
 
 	streamhost = jsx->streamhosts->data;
 
-	jsx->gpi = gaim_proxy_info_new();
-	gaim_proxy_info_set_type(jsx->gpi, GAIM_PROXY_SOCKS5);
-	gaim_proxy_info_set_host(jsx->gpi, streamhost->host);
-	gaim_proxy_info_set_port(jsx->gpi, streamhost->port);
+	dstjid = jabber_id_new(xfer->who);
 
-	dstaddr = g_strdup_printf("%s%s%s@%s/%s", jsx->stream_id, xfer->who, jsx->js->user->node,
-			jsx->js->user->domain, jsx->js->user->resource);
+	if(dstjid != NULL) {
+		jsx->gpi = gaim_proxy_info_new();
+		gaim_proxy_info_set_type(jsx->gpi, GAIM_PROXY_SOCKS5);
+		gaim_proxy_info_set_host(jsx->gpi, streamhost->host);
+		gaim_proxy_info_set_port(jsx->gpi, streamhost->port);
+
+
+
+		dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, dstjid->node, dstjid->domain, dstjid->resource, jsx->js->user->node,
+				jsx->js->user->domain, jsx->js->user->resource);
 
-	gaim_cipher_digest_region("sha1", (guchar *)dstaddr, strlen(dstaddr),
-							  sizeof(hashval), hashval, NULL);
-	g_free(dstaddr);
-	dstaddr = g_malloc(41);
-	p = dstaddr;
-	for(i=0; i<20; i++, p+=2)
-		snprintf(p, 3, "%02x", hashval[i]);
+		gaim_cipher_digest_region("sha1", (guchar *)dstaddr, strlen(dstaddr),
+				sizeof(hashval), hashval, NULL);
+		g_free(dstaddr);
+		dstaddr = g_malloc(41);
+		p = dstaddr;
+		for(i=0; i<20; i++, p+=2)
+			snprintf(p, 3, "%02x", hashval[i]);
 
-	jsx->connect_data = gaim_proxy_connect_socks5(jsx->gpi, dstaddr, 0,
-			jabber_si_bytestreams_connect_cb, xfer);
-	g_free(dstaddr);
+		jsx->connect_data = gaim_proxy_connect_socks5(jsx->gpi, dstaddr, 0,
+				jabber_si_bytestreams_connect_cb, xfer);
+		g_free(dstaddr);
+
+		jabber_id_free(dstjid);
+	}
 
 	if (jsx->connect_data == NULL)
 	{