diff libpurple/protocols/msn/slplink.c @ 29214:24b341ae63f7

msn: Use the PurpleXfer size if available. This fixes file transfers not being detected as complete when there is no file on the system (the receiving end isn't able to tell how much data to expect).
author Paul Aurich <paul@darkrain42.org>
date Mon, 28 Dec 2009 21:19:51 +0000
parents bcea7c92d3f1
children 932f16167621
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c	Wed Dec 23 07:47:14 2009 +0000
+++ b/libpurple/protocols/msn/slplink.c	Mon Dec 28 21:19:51 2009 +0000
@@ -669,7 +669,7 @@
 #define MAX_FILE_NAME_LEN 0x226
 
 static gchar *
-gen_context(const char *file_name, const char *file_path)
+gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path)
 {
 	struct stat st;
 	gsize size = 0;
@@ -683,7 +683,10 @@
 	glong uni_len = 0;
 	gsize len;
 
-	if (g_stat(file_path, &st) == 0)
+	if (xfer)
+		size = purple_xfer_get_size(xfer);
+
+	if (size == 0 && g_stat(file_path, &st) == 0)
 		size = st.st_size;
 
 	if(!file_name) {
@@ -761,7 +764,7 @@
 
 	xfer->data = slpcall;
 
-	context = gen_context(fn, fp);
+	context = gen_context(xfer, fn, fp);
 
 	msn_slpcall_invite(slpcall, MSN_FT_GUID, 2, context);