changeset 29689:18042a99d213

merge of '466f38a98b4f03139b06e14b4528e0489a2f0bce' and '919b4430c2e8ef456651ed7a88d4ee34e736c92c'
author John Bailey <rekkanoryo@rekkanoryo.org>
date Thu, 08 Apr 2010 03:22:01 +0000
parents c2155cf648f9 (diff) 9f482e11f066 (current diff)
children ba65c87144fa
files
diffstat 4 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/ft.c	Thu Apr 08 03:21:27 2010 +0000
+++ b/libpurple/ft.c	Thu Apr 08 03:22:01 2010 +0000
@@ -57,6 +57,8 @@
 		PURPLE_XFER_READY_UI   = 0x1,
 		PURPLE_XFER_READY_PRPL = 0x2,
 	} ready;
+
+	/* TODO: Should really use a PurpleCircBuffer for this. */
 	GByteArray *buffer;
 } PurpleXferPrivData;
 
@@ -1147,7 +1149,7 @@
 		}
 
 		if (priv->buffer) {
-			priv->buffer = g_byte_array_append(priv->buffer, buffer, result);
+			g_byte_array_append(priv->buffer, buffer, result);
 			g_free(buffer);
 			buffer = priv->buffer->data;
 			result = priv->buffer->len;
@@ -1157,7 +1159,10 @@
 
 		if (r == -1) {
 			purple_xfer_cancel_remote(xfer);
-			g_free(buffer);
+			if (!priv->buffer)
+				/* We don't free buffer if priv->buffer is set, because in
+				   that case buffer doesn't belong to us. */
+				g_free(buffer);
 			return;
 		} else if (r == result) {
 			/*
@@ -1175,10 +1180,10 @@
 			/*
 			 * Remove what we wrote
 			 * If we wrote the whole buffer the byte array will be empty
-			 * Otherwise we'll kee what wasn't sent for next time.
+			 * Otherwise we'll keep what wasn't sent for next time.
 			 */
 			buffer = NULL;
-			priv->buffer = g_byte_array_remove_range(priv->buffer, 0, r);
+			g_byte_array_remove_range(priv->buffer, 0, r);
 		}
 	}
 
--- a/libpurple/protocols/oscar/family_icq.c	Thu Apr 08 03:21:27 2010 +0000
+++ b/libpurple/protocols/oscar/family_icq.c	Thu Apr 08 03:22:01 2010 +0000
@@ -177,7 +177,7 @@
 	byte_stream_putle16(&bs, snacid); /* eh. */
 	byte_stream_putle16(&bs, 0x042e); /* shrug. */
 	byte_stream_putle16(&bs, passwdlen+1);
-	byte_stream_putstr(&bs, passwd);
+	byte_stream_putraw(&bs, (const guint8 *)passwd, passwdlen);
 	byte_stream_putle8(&bs, '\0');
 
 	flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs);
--- a/libpurple/protocols/oscar/oft.c	Thu Apr 08 03:21:27 2010 +0000
+++ b/libpurple/protocols/oscar/oft.c	Thu Apr 08 03:22:01 2010 +0000
@@ -496,6 +496,16 @@
 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).
+	 */
+	if (!purple_xfer_is_completed(conn->xfer))
+		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	Thu Apr 08 03:21:27 2010 +0000
+++ b/libpurple/protocols/oscar/peer.h	Thu Apr 08 03:22:01 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 */