changeset 30448:911ca152210c

Remove old code that was commented out, but is really just not necessary.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 19 Apr 2010 08:05:55 +0000
parents e7d298d270bc
children 5be6177e369e
files libpurple/protocols/msn/slp.c libpurple/protocols/msn/slplink.c libpurple/protocols/msn/switchboard.c
diffstat 3 files changed, 40 insertions(+), 168 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Mon Apr 19 07:41:56 2010 +0000
+++ b/libpurple/protocols/msn/slp.c	Mon Apr 19 08:05:55 2010 +0000
@@ -37,13 +37,6 @@
 /* ms to delay between sending buddy icon requests to the server. */
 #define BUDDY_ICON_DELAY 20
 
-/*
-static void msn_slp_send_ok(MsnSlpCall *slpcall, const char *branch,
-					const char *type, const char *content);
-
-static void msn_slp_send_decline(MsnSlpCall *slpcall, const char *branch,
-						 const char *type, const char *content);
-*/
 static void request_user_display(MsnUser *user);
 
 
@@ -113,7 +106,6 @@
 
 	slpcall = xfer->data;
 
-
 	if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL)
 	{
 		if (slpcall->started)
@@ -190,8 +182,6 @@
 void
 msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session)
 {
-	purple_debug_info("msn", "msn_xfer_end_cb\n");
-
 	if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) &&
 		(purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) &&
 		(purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL))
@@ -670,7 +660,7 @@
 	else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
 	{
 		/* A direct connection negotiation request */
-		char		*bridges;
+		char *bridges;
 
 		purple_debug_info("msn", "got_invite: transreqbody received\n");
 
@@ -685,8 +675,8 @@
 			 * Ok, the client supports direct TCP connection
 			 * Try to create a listening port
 			 */
-			char		*content;
-			MsnDirectConn	*dc;
+			char *content;
+			MsnDirectConn *dc;
 
 			dc = msn_dc_new(slpcall);
 
@@ -738,31 +728,6 @@
 		g_return_if_fail(slpcall->xfer != NULL);
 
 		msn_slp_process_transresp(slpcall, content);
-#if 0
-		char *ip_addrs;
-		char *temp;
-		char *nonce;
-		int port;
-
-		nonce = get_token(content, "Nonce: {", "}\r\n");
-		if (ip_addrs == NULL)
-			return;
-
-		ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
-
-		temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
-		if (temp != NULL)
-			port = atoi(temp);
-		else
-			port = -1;
-		g_free(temp);
-
-		if (port > 0)
-			got_transresp(slpcall, nonce, ip_addrs, port);
-
-		g_free(nonce);
-		g_free(ip_addrs);
-#endif
 	}
 }
 
@@ -775,16 +740,16 @@
 
 	if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
 	{
-		char		*content;
-		char		*header;
-		MsnSlpMessage	*msg;
-		MsnDirectConn	*dc;
+		char *content;
+		char *header;
+		MsnSlpMessage *msg;
+		MsnDirectConn *dc;
 
 		g_return_if_fail(slpcall->xfer != NULL);
 
-		if(slpcall->slplink->dc != NULL) {
+		if (slpcall->slplink->dc != NULL) {
 			/*
-			 * If we already have an estabilished direct connection
+			 * If we already have an established direct connection
 			 * then just start the transfer.
 			 */
 			msn_slpcall_session_init(slpcall);
@@ -855,57 +820,13 @@
 		g_free(content);
 
 		msn_slplink_queue_slpmsg(slpcall->slplink, msg);
-#if 0
-		if (slpcall->type == MSN_SLPCALL_DC)
-		{
-			/* First let's try a DirectConnection. */
 
-			MsnSlpLink *slplink;
-			MsnSlpMessage *slpmsg;
-			char *header;
-			char *content;
-			char *branch;
-
-			slplink = slpcall->slplink;
-
-			branch = rand_guid();
-
-			content = g_strdup_printf(
-				"Bridges: TRUDPv1 TCPv1\r\n"
-				"NetID: 0\r\n"
-				"Conn-Type: Direct-Connect\r\n"
-				"UPnPNat: false\r\n"
-				"ICF: false\r\n"
-			);
-
-			header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0",
-									 slplink->remote_user);
-
-			slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch,
-										"application/x-msnmsgr-transreqbody",
-										content);
-
-			slpmsg->info = "SLP INVITE";
-			slpmsg->text_body = TRUE;
-			msn_slplink_send_slpmsg(slplink, slpmsg);
-
-			g_free(header);
-			g_free(content);
-
-			g_free(branch);
-		}
-		else
-		{
-			msn_slpcall_session_init(slpcall);
-		}
-#else
 		/*
 		 * Removed because it messes up direct connection by
 		 * starting p2p transfer
 		 */
 
 		/* msn_slpcall_session_init(slpcall); */
-#endif
 	}
 	else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
 	{
@@ -915,31 +836,6 @@
 	else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
 	{
 		msn_slp_process_transresp(slpcall, content);
-#if 0
-		char *ip_addrs;
-		char *temp;
-		char *nonce;
-		int port;
-
-		nonce = get_token(content, "Nonce: {", "}\r\n");
-		if (ip_addrs == NULL)
-			return;
-
-		ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
-
-		temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
-		if (temp != NULL)
-			port = atoi(temp);
-		else
-			port = -1;
-		g_free(temp);
-
-		if (port > 0)
-			got_transresp(slpcall, nonce, ip_addrs, port);
-
-		g_free(nonce);
-		g_free(ip_addrs);
-#endif
 	}
 }
 
--- a/libpurple/protocols/msn/slplink.c	Mon Apr 19 07:41:56 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Mon Apr 19 08:05:55 2010 +0000
@@ -439,10 +439,10 @@
 	}
 }
 
-static MsnSlpMessage*
+static MsnSlpMessage *
 msn_slplink_create_ack(MsnSlpLink *slplink, MsnSlpHeader *header)
 {
-	MsnSlpMessage	*slpmsg;
+	MsnSlpMessage *slpmsg;
 
 	slpmsg = msn_slpmsg_new(slplink);
 
@@ -462,18 +462,6 @@
 {
 	MsnSlpMessage *slpmsg = msn_slplink_create_ack(slplink, header);
 
-	/*
-	slpmsg = msn_slpmsg_new(slplink);
-
-	slpmsg->session_id = msg->msnslp_header.session_id;
-	slpmsg->size       = msg->msnslp_header.total_size;
-	slpmsg->flags      = 0x02;
-	slpmsg->ack_id     = msg->msnslp_header.id;
-	slpmsg->ack_sub_id = msg->msnslp_header.ack_id;
-	slpmsg->ack_size   = msg->msnslp_header.total_size;
-	slpmsg->info = "SLP ACK";
-	*/
-
 	msn_slplink_send_slpmsg(slplink, slpmsg);
 	msn_slpmsg_destroy(slpmsg);
 }
@@ -525,21 +513,12 @@
 	guint64 offset;
 	PurpleXfer *xfer = NULL;
 
-	/*
-	if (purple_debug_is_verbose())
-		msn_slpmsg_show(msg);
-	*/
-
-#ifdef MSN_DEBUG_SLP_FILES
-#endif
 	if (header->total_size < header->length)
 	{
 		purple_debug_error("msn", "This can't be good\n");
 		g_return_if_reached();
 	}
 
-	/* data = msn_message_get_bin_data(msg, &len); */
-
 	offset = header->offset;
 
 	if (offset == 0)
@@ -655,46 +634,43 @@
 
 		purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n");
 
-		/*if (!slpcall->wasted) {*/
-			if (slpmsg->flags == 0x100)
-			{
+		if (/* !slpcall->wasted && */ slpmsg->flags == 0x100)
+		{
 #if 0
-				MsnDirectConn *directconn;
+			MsnDirectConn *directconn;
 
-				directconn = slplink->directconn;
-				if (!directconn->acked)
-					msn_directconn_send_handshake(directconn);
+			directconn = slplink->directconn;
+			if (!directconn->acked)
+				msn_directconn_send_handshake(directconn);
 #endif
-			}
-			else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 ||
-				 slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 ||
-				 slpmsg->flags == 0x1000030)
-			{
-				/* Release all the messages and send the ACK */
+		}
+		else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 ||
+		         slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 ||
+		         slpmsg->flags == 0x1000030)
+		{
+			/* Release all the messages and send the ACK */
 
-				if (slpcall != NULL && slpcall->wait_for_socket) {
-					/*
-					 * Save ack for later because we have to send
-					 * a 200 OK message to the previous direct connect
-					 * invitation before ACK but the listening socket isn't
-					 * created yet.
-					 */
-
-					purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n");
+			if (slpcall->wait_for_socket) {
+				/*
+				 * Save ack for later because we have to send
+				 * a 200 OK message to the previous direct connect
+				 * invitation before ACK but the listening socket isn't
+				 * created yet.
+				 */
+				purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n");
 
-					slpcall->slplink->dc->prev_ack = msn_slplink_create_ack(slplink, header);
-				} else {
-					purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n");
+				slpcall->slplink->dc->prev_ack = msn_slplink_create_ack(slplink, header);
+			} else if (!slpcall->wasted) {
+				purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n");
 
-					msn_slplink_send_ack(slplink, header);
-					msn_slplink_send_queued_slpmsgs(slplink);
-				}
+				msn_slplink_send_ack(slplink, header);
+				msn_slplink_send_queued_slpmsgs(slplink);
 			}
-		/*}*/
+		}
 
 		msn_slpmsg_destroy(slpmsg);
 
-		if (slpcall != NULL && !slpcall->wait_for_socket && slpcall->wasted)
+		if (!slpcall->wait_for_socket && slpcall->wasted)
 			msn_slpcall_destroy(slpcall);
 	}
 }
--- a/libpurple/protocols/msn/switchboard.c	Mon Apr 19 07:41:56 2010 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Mon Apr 19 08:05:55 2010 +0000
@@ -88,9 +88,9 @@
 
 	/* If it linked us is because its looking for trouble */
 	while (swboard->slplinks != NULL) {
+		MsnSlpLink *slplink = swboard->slplinks->data;
+
 		/* Destroy only those slplinks which use the switchboard */
-		MsnSlpLink	*slplink = swboard->slplinks->data;
-
 		if (slplink->dc == NULL)
 			msn_slplink_destroy(slplink);
 		else {