changeset 30217:d0b0f0d17046

Fix Yahoo file transfers that get stuck saying \"Waiting for transfer to begin\". The IP address and its parts should be unsigned. Also, this math was a bit too complicated. Integer division means we don't need to care about the fractional part. Fixes #12213.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 22 Jun 2010 05:30:36 +0000
parents 91869ed3ba59
children 317cbbf56c2f
files ChangeLog libpurple/protocols/yahoo/yahoo_filexfer.c
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 22 01:40:18 2010 +0000
+++ b/ChangeLog	Tue Jun 22 05:30:36 2010 +0000
@@ -32,6 +32,8 @@
 	* Fall back to connecting to scsa.msg.yahoo.com (not configurable) if the
 	  HTTP-based connect server lookup fails.  This does not work for Yahoo
 	  JAPAN accounts.
+	* Fix file transfers that get stuck with "Waiting for transfer to
+	  begin".
 
 version 2.7.1 (05/29/2010):
 	General:
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Tue Jun 22 01:40:18 2010 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Tue Jun 22 05:30:36 2010 +0000
@@ -983,8 +983,8 @@
 	struct yahoo_xfer_data *xd;
 	struct sockaddr_in *addr;
 	struct yahoo_packet *pkt;
-	long actaddr;
-	long a,b,c,d;
+	unsigned long actaddr;
+	unsigned char a,b,c,d;
 	PurpleConnection *gc;
 	PurpleAccount *account;
 	YahooData *yd;
@@ -1018,19 +1018,19 @@
 	/* TODO:actually, u must try with addr no.1 , if its not working addr no.2 ..... */
 	addr = hosts->data;
 	actaddr = addr->sin_addr.s_addr;
-	d = actaddr % 256;
-	actaddr = (actaddr - d) / 256;
-	c = actaddr % 256;
-	actaddr = (actaddr - c) / 256;
-	b = actaddr % 256;
-	actaddr = (actaddr - b) / 256;
-	a = actaddr;
+	d = actaddr & 0xff;
+	actaddr >>= 8;
+	c = actaddr & 0xff;
+	actaddr >>= 8;
+	b = actaddr & 0xff;
+	actaddr >>= 8;
+	a = actaddr & 0xff;
 	if(yd->jp)
 		xd->port = YAHOOJP_XFER_RELAY_PORT;
 	else
 		xd->port = YAHOO_XFER_RELAY_PORT;
 
-	url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a);
+	url = g_strdup_printf("%u.%u.%u.%u", d, c, b, a);
 
 	/* Free the address... */
 	g_free(hosts->data);