pidgin: 200434e5: I'm not sure what this stuff is, but it ...

qulogic at pidgin.im qulogic at pidgin.im
Fri May 21 18:02:37 EDT 2010


-----------------------------------------------------------------
Revision: 200434e5a426d139cc3fcf71a12b4b6da547b8a7
Ancestor: c85c4f19d48540c7fda75542a68092330ac9f39e
Author: qulogic at pidgin.im
Date: 2010-05-05T08:11:05
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/200434e5a426d139cc3fcf71a12b4b6da547b8a7

Modified files:
        libpurple/protocols/msn/directconn.c

ChangeLog: 

I'm not sure what this stuff is, but it looks old and useless.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/directconn.c	844d1322c78477b16ebc96e94cea1788dd4f3349
+++ libpurple/protocols/msn/directconn.c	a8398f4b1813bf94755be824ebafeaf5c8a2e137
@@ -777,107 +777,6 @@ msn_dc_process_packet(MsnDirectConn *dc,
 		}
 		*/
 		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,135 +862,7 @@ msn_dc_recv_cb(gpointer data, gint fd, P
 	}
 }
 
-#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)
 {
 	MsnDirectConn *dc = data;


More information about the Commits mailing list