# HG changeset patch # User Yoshiki Yazawa # Date 1270629711 -32400 # Node ID 0869bfe2738f9f77ddfa852f359533972d6a1ef8 # Parent 1f1d58d35746d0faa5e2f341fe5532d252603d36# Parent c2155cf648f9084c96994c748604fb327ed3e953 merged with im.pidgin.pidgin diff -r 1f1d58d35746 -r 0869bfe2738f libpurple/ft.c --- a/libpurple/ft.c Wed Apr 07 17:41:12 2010 +0900 +++ b/libpurple/ft.c Wed Apr 07 17:41:51 2010 +0900 @@ -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); } } diff -r 1f1d58d35746 -r 0869bfe2738f libpurple/protocols/oscar/family_icq.c --- a/libpurple/protocols/oscar/family_icq.c Wed Apr 07 17:41:12 2010 +0900 +++ b/libpurple/protocols/oscar/family_icq.c Wed Apr 07 17:41:51 2010 +0900 @@ -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); diff -r 1f1d58d35746 -r 0869bfe2738f libpurple/protocols/oscar/oft.c --- a/libpurple/protocols/oscar/oft.c Wed Apr 07 17:41:12 2010 +0900 +++ b/libpurple/protocols/oscar/oft.c Wed Apr 07 17:41:51 2010 +0900 @@ -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; diff -r 1f1d58d35746 -r 0869bfe2738f libpurple/protocols/oscar/peer.h --- a/libpurple/protocols/oscar/peer.h Wed Apr 07 17:41:12 2010 +0900 +++ b/libpurple/protocols/oscar/peer.h Wed Apr 07 17:41:51 2010 +0900 @@ -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 */