changeset 30092:1d657e98667b

Set file transfers to "completed" if the other user tells us they've received the file. Fixes a bug where we show the file transfer as canceled by us in the event where we're sending them a file that they already have.
author Mark Doliner <mark@kingant.net>
date Tue, 06 Apr 2010 08:18:47 +0000
parents 29df7408df03
children c726b1461159
files libpurple/protocols/oscar/oft.c libpurple/protocols/oscar/peer.h
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oft.c	Sun Apr 04 04:31:54 2010 +0000
+++ b/libpurple/protocols/oscar/oft.c	Tue Apr 06 08:18:47 2010 +0000
@@ -496,6 +496,15 @@
 static void
 peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame)
 {
+	/*
+	 * The core ft code sets the xfer to completed automatically if we've
+	 * sent all bytes to the other user.  But this function can be called
+	 * even if we haven't sent all bytes to the other user (in the case
+	 * where the user already has this file on their computer and the
+	 * checksum matches).
+	 */
+	purple_xfer_set_completed(conn->xfer, TRUE);
+
 	purple_input_remove(conn->watcher_incoming);
 	conn->watcher_incoming = 0;
 	conn->xfer->fd = conn->fd;
--- a/libpurple/protocols/oscar/peer.h	Sun Apr 04 04:31:54 2010 +0000
+++ b/libpurple/protocols/oscar/peer.h	Tue Apr 06 08:18:47 2010 +0000
@@ -45,7 +45,7 @@
 #define PEER_TYPE_PROMPT 0x0101 /* "I am going to send you this file, is that ok?" */
 #define PEER_TYPE_RESUMEACCEPT 0x0106 /* We are accepting the resume */
 #define PEER_TYPE_ACK 0x0202 /* "Yes, it is ok for you to send me that file" */
-#define PEER_TYPE_DONE 0x0204 /* "I received that file with no problems, thanks a bunch" */
+#define PEER_TYPE_DONE 0x0204 /* "I received that file with no problems" or "I already have that file, great!" */
 #define PEER_TYPE_RESUME 0x0205 /* Resume transferring, sent by whoever receives */
 #define PEER_TYPE_RESUMEACK 0x0207 /* Our resume accept was ACKed */