Mercurial > pidgin.yaz
changeset 30471:447f882d1ea5
I'm not sure what this stuff is, but it looks old and useless.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 05 May 2010 08:11:05 +0000 |
parents | 99f81d97cbe6 |
children | 2caada025b1d |
files | libpurple/protocols/msn/directconn.c |
diffstat | 1 files changed, 0 insertions(+), 229 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c Wed May 05 07:33:55 2010 +0000 +++ b/libpurple/protocols/msn/directconn.c Wed May 05 08:11:05 2010 +0000 @@ -777,107 +777,6 @@ } */ break; -#if 0 - { - guint64 file_size; - int bytes_written; - PurpleXfer *xfer; - MsnSlpHeader *h = &dc->header; - - if (packet_length < DC_PACKET_HEADER_SIZE) - return DC_TRANSFER_FALLBACK; - - /* - * TODO: MSN Messenger 7.0 sends BYE with flags 0x0000000 so we'll get rid of - * 0x1000000 bit but file data is always sent with flags 0x1000030 in both - * MSN Messenger and Live.*/ - switch (h->flags) { - case 0x0000000: - case 0x1000000: - msn_dc_send_ack(dc); - if (strncmp(dc->buffer, "BYE", 3) == 0) { - /* Remote side cancelled the transfer. */ - purple_xfer_cancel_remote(dc->slpcall->xfer); - return DC_TRANSFER_CANCELLED; - } - break; - - case 0x1000030: - /* File data */ - xfer = dc->slpcall->xfer; - file_size = purple_xfer_get_size(xfer); - - /* Packet sanity checks */ - if ( h->session_id != dc->slpcall->session_id || - h->offset >= file_size || - h->total_size != file_size || - h->length != packet_length - DC_PACKET_HEADER_SIZE || - h->offset + h->length > file_size) { - - purple_debug_warning("msn", "msn_dc_recv_process_packet_cb: packet range check error!\n"); - purple_xfer_cancel_local(dc->slpcall->xfer); - return DC_TRANSFER_CANCELLED; - } - - bytes_written = fwrite(dc->buffer, 1, h->length, xfer->dest_fp); - if (bytes_written != h->length) { - purple_debug_warning("msn", "msn_dc_recv_process_packet_cb: cannot write whole packet to file!\n"); - purple_xfer_cancel_local(dc->slpcall->xfer); - return DC_TRANSFER_CANCELLED; - } - - xfer->bytes_sent = (h->offset + h->length); - xfer->bytes_remaining = h->total_size - xfer->bytes_sent; - - purple_xfer_update_progress(xfer); - - if (xfer->bytes_remaining == 0) { - /* ACK only the last data packet */ - msn_dc_send_data_ack(dc); - purple_xfer_set_completed(xfer, TRUE); - dc->state = DC_STATE_BYE; - } - break; - default: - /* - * TODO: Packet with unknown flags. Should we ACK these? - */ - msn_dc_send_ack(dc); - - purple_debug_warning( - "msn", - "msn_dc_recv_process_packet_cb: received packet with unknown flags: 0x%08x\n", - dc->header.flags - ); - } - break; - } - - case DC_STATE_BYE: - /* TODO: Check! */ - switch (dc->header.flags) { - case 0x0000000: - case 0x1000000: - msn_dc_send_ack(dc); - if (strncmp(dc->buffer, "BYE", 3) == 0) { - dc->state = DC_STATE_COMPLETED; - return DC_TRANSFER_COMPLETED; - } - break; - - default: - /* - * TODO: Packet with unknown flags. Should we ACK these? - */ - msn_dc_send_ack(dc); - purple_debug_warning( - "msn", - "msn_dc_recv_process_packet_cb: received packet with unknown flags: 0x%08x\n", - dc->header.flags - ); - } - break; -#endif } return DC_PROCESS_OK; @@ -963,134 +862,6 @@ } } -#if 0 -static gboolean -msn_dc_send_next_packet(MsnDirectConn *dc) -{ - MsnSlpMessage *msg; - - if(g_queue_is_empty(dc->out_queue)) - return TRUE; - - msg = g_queue_peek_head(dc->out_queue); - msn_slplink_send_msgpart(dc->slplink, msg); - - - - PurpleXfer *xfer; - int bytes_read; - - g_return_val_if_fail(dc != NULL, FALSE); - g_return_val_if_fail(dc->slpcall != NULL, FALSE); - - xfer = dc->slpcall->xfer; - - bytes_read = fread(dc->buffer, 1, DC_MAX_BODY_SIZE, xfer->dest_fp); - - if (bytes_read > 0) { - dc->header.session_id = dc->slpcall->session_id; - /* Only increment seq. ID before sending BYE */ - dc->header.id = dc->slpcall->slplink->slp_seq_id; - dc->header.offset = xfer->bytes_sent; - dc->header.total_size = xfer->size; - dc->header.length = bytes_read; - dc->header.flags = 0x1000030; - dc->header.ack_id = rand() % G_MAXUINT32; - dc->header.ack_sub_id = 0; - dc->header.ack_size = 0; - - msn_dc_send_packet(dc); - - xfer->bytes_sent += bytes_read; - xfer->bytes_remaining -= bytes_read; - purple_xfer_update_progress(xfer); - - if (xfer->bytes_remaining == 0) { - purple_xfer_set_completed(xfer, TRUE); - - /* Increment seq. ID for the next BYE message */ - dc->slpcall->slplink->slp_seq_id++; - dc->state = DC_STATE_DATA_ACK; - } - - } else { - /* File read error */ - purple_xfer_cancel_local(xfer); - return FALSE; - } - - return TRUE; -} - -static int -msn_dc_send_process_packet_cb(MsnDirectConn *dc, guint32 packet_length) -{ - g_return_val_if_fail(dc != NULL, DC_TRANSFER_CANCELLED); - - switch (dc->state) { - case DC_STATE_FOO: { - if (packet_length != 4) - return DC_TRANSFER_FALLBACK; - - if (memcmp(dc->in_buffer, "\4\0\0\0foo", 8) != 0) - return DC_TRANSFER_FALLBACK; - - dc->state = DC_STATE_HANDSHAKE; - break; - } - - case DC_STATE_HANDSHAKE: { - if (packet_length != DC_PACKET_HEADER_SIZE) - return DC_TRANSFER_FALLBACK; - - /* TODO: Check! */ - msn_dc_send_handshake_reply(dc); - dc->state = DC_STATE_TRANSFER; - - purple_xfer_set_request_denied_fnc(dc->slpcall->xfer, msn_dc_xfer_send_cancel); - purple_xfer_set_cancel_send_fnc(dc->slpcall->xfer, msn_dc_xfer_send_cancel); - purple_xfer_set_end_fnc(dc->slpcall->xfer, msn_dc_xfer_end); - purple_xfer_start(dc->slpcall->xfer, -1, NULL, 0); - break; - } - - case DC_STATE_HANDSHAKE_REPLY: - /* TODO: Check! */ - dc->state = DC_STATE_TRANSFER; - break; - - case DC_STATE_TRANSFER: { - switch (dc->header.flags) { - case 0x0000000: - case 0x1000000: - msn_dc_send_ack(dc); - if (strncmp(dc->buffer, "BYE", 3) == 0) { - /* Remote side cancelled the transfer. */ - purple_xfer_cancel_remote(dc->slpcall->xfer); - return DC_TRANSFER_CANCELLED; - } - break; - } - break; - } - - case DC_STATE_DATA_ACK: { - /* TODO: Check! */ - msn_dc_send_bye(dc); - dc->state = DC_STATE_BYE_ACK; - break; - } - - case DC_STATE_BYE_ACK: - /* TODO: Check! */ - dc->state = DC_STATE_COMPLETED; - return DC_TRANSFER_COMPLETED; - } - - return DC_TRANSFER_OK; -} -#endif - static gboolean msn_dc_timeout(gpointer data) {