diff libpurple/protocols/msn/slplink.c @ 30868:5964f65c17ed

Avoid duplicated code using a util function to check the flags.
author masca@cpw.pidgin.im
date Thu, 05 Aug 2010 23:42:42 +0000
parents 6b73ff4fcc69
children d9ca3798faa5
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c	Thu Aug 05 23:16:49 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Thu Aug 05 23:42:42 2010 +0000
@@ -332,9 +332,8 @@
 	slpmsg->parts = g_list_append(slpmsg->parts, part);
 	msn_slplink_send_part(slplink, part);
 
-	if ((slpmsg->flags == P2P_MSN_OBJ_DATA || 
-	     slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
-	     slpmsg->flags == P2P_FILE_DATA) &&
+
+	if (msn_p2p_msg_is_data(slpmsg->flags) &&
 		(slpmsg->slpcall != NULL))
 	{
 		slpmsg->slpcall->progress = TRUE;
@@ -359,9 +358,7 @@
 	{
 		slpmsg->header->ack_id = rand() % 0xFFFFFF00;
 	}
-	else if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
-	         slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
-	         slpmsg->flags == P2P_FILE_DATA)
+	else if (msn_p2p_msg_is_data(slpmsg->flags))
 	{
 		MsnSlpCall *slpcall;
 		slpcall = slpmsg->slpcall;
@@ -462,9 +459,7 @@
 		slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
 		if (slpmsg->slpcall != NULL)
 		{
-			if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
-					slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
-					slpmsg->flags == P2P_FILE_DATA)
+			if (msn_p2p_msg_is_data(slpmsg->flags))
 			{
 				PurpleXfer *xfer = slpmsg->slpcall->xfer;
 				if (xfer != NULL)
@@ -525,9 +520,7 @@
 #endif
 	}
 	else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP ||
-			slpmsg->flags == P2P_MSN_OBJ_DATA ||
-			slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
-			slpmsg->flags == P2P_FILE_DATA)
+			msn_p2p_msg_is_data(slpmsg->flags))
 	{
 		/* Release all the messages and send the ACK */
 
@@ -612,9 +605,8 @@
 
 	slpmsg_add_part(slpmsg, part);
 
-	if ((slpmsg->flags == P2P_MSN_OBJ_DATA ||
-		slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
-		slpmsg->flags == P2P_FILE_DATA) &&
+
+	if (msn_p2p_msg_is_data(slpmsg->flags) &&
 		(slpmsg->slpcall != NULL))
 	{
 		slpmsg->slpcall->progress = TRUE;