changeset 31308:d9ca3798faa5

Get rid of the Flags field in the SlpMessage in favor of the one in the Header.
author masca@cpw.pidgin.im
date Fri, 06 Aug 2010 00:07:39 +0000
parents 320c6eb04e11
children 393e127b3d83
files libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg.h libpurple/protocols/msn/slpmsg_part.c
diffstat 5 files changed, 20 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpcall.c	Thu Aug 05 23:58:21 2010 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri Aug 06 00:07:39 2010 +0000
@@ -1062,7 +1062,7 @@
 	body = slpmsg->buffer;
 	body_len = slpmsg->header->offset;
 
-	if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP)
+	if (slpmsg->header->flags == P2P_NO_FLAG || slpmsg->header->flags == P2P_WML2009_COMP)
 	{
 		char *body_str;
 
@@ -1123,7 +1123,7 @@
 		}
 		g_free(body_str);
 	}
-	 else if (msn_p2p_msg_is_data(slpmsg->flags))
+	 else if (msn_p2p_msg_is_data(slpmsg->header->flags))
 	{
 		slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
 
@@ -1141,7 +1141,7 @@
 		}
 	}
 #if 0
-	else if (slpmsg->flags == 0x100)
+	else if (slpmsg->header->flags == 0x100)
 	{
 		slpcall = slplink->directconn->initial_call;
 
@@ -1149,13 +1149,13 @@
 			msn_slpcall_session_init(slpcall);
 	}
 #endif
-	else if (slpmsg->flags == P2P_ACK)
+	else if (slpmsg->header->flags == P2P_ACK)
 	{
 		/* Acknowledgement of previous message. Don't do anything currently. */
 	}
 	else
 		purple_debug_warning("msn", "Unprocessed SLP message with flags 0x%08lx\n",
-		                     slpmsg->flags);
+		                     slpmsg->header->flags);
 
 	return slpcall;
 }
--- a/libpurple/protocols/msn/slplink.c	Thu Aug 05 23:58:21 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Fri Aug 06 00:07:39 2010 +0000
@@ -296,7 +296,7 @@
 	part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer);
 	part->ack_data = slpmsg;
 
-	real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size;
+	real_size = (slpmsg->header->flags == P2P_ACK) ? 0 : slpmsg->size;
 
 	if (slpmsg->header->offset < real_size)
 	{
@@ -333,7 +333,7 @@
 	msn_slplink_send_part(slplink, part);
 
 
-	if (msn_p2p_msg_is_data(slpmsg->flags) &&
+	if (msn_p2p_msg_is_data(slpmsg->header->flags) &&
 		(slpmsg->slpcall != NULL))
 	{
 		slpmsg->slpcall->progress = TRUE;
@@ -354,11 +354,11 @@
 	slpmsg = slpmsg;
 	slpmsg->footer = g_new0(MsnP2PFooter, 1);
 
-	if (slpmsg->flags == P2P_NO_FLAG)
+	if (slpmsg->header->flags == P2P_NO_FLAG)
 	{
 		slpmsg->header->ack_id = rand() % 0xFFFFFF00;
 	}
-	else if (msn_p2p_msg_is_data(slpmsg->flags))
+	else if (msn_p2p_msg_is_data(slpmsg->header->flags))
 	{
 		MsnSlpCall *slpcall;
 		slpcall = slpmsg->slpcall;
@@ -370,7 +370,6 @@
 	}
 
 	slpmsg->header->id = slpmsg->id;
-	slpmsg->header->flags = (guint32)slpmsg->flags;
 
 	slpmsg->header->total_size = slpmsg->size;
 
@@ -452,14 +451,14 @@
 	slpmsg->id = header->id;
 	slpmsg->header->session_id = header->session_id;
 	slpmsg->size = header->total_size;
-	slpmsg->flags = header->flags;
+	slpmsg->header->flags = header->flags;
 
 	if (slpmsg->header->session_id)
 	{
 		slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
 		if (slpmsg->slpcall != NULL)
 		{
-			if (msn_p2p_msg_is_data(slpmsg->flags))
+			if (msn_p2p_msg_is_data(header->flags))
 			{
 				PurpleXfer *xfer = slpmsg->slpcall->xfer;
 				if (xfer != NULL)
@@ -509,7 +508,7 @@
 
 	purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n");
 
-	if (/* !slpcall->wasted && */ slpmsg->flags == 0x100)
+	if (/* !slpcall->wasted && */ slpmsg->header->flags == 0x100)
 	{
 #if 0
 		MsnDirectConn *directconn;
@@ -519,8 +518,8 @@
 			msn_directconn_send_handshake(directconn);
 #endif
 	}
-	else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP ||
-			msn_p2p_msg_is_data(slpmsg->flags))
+	else if (slpmsg->header->flags == P2P_NO_FLAG || slpmsg->header->flags == P2P_WML2009_COMP ||
+			msn_p2p_msg_is_data(slpmsg->header->flags))
 	{
 		/* Release all the messages and send the ACK */
 
@@ -606,7 +605,7 @@
 	slpmsg_add_part(slpmsg, part);
 
 
-	if (msn_p2p_msg_is_data(slpmsg->flags) &&
+	if (msn_p2p_msg_is_data(slpmsg->header->flags) &&
 		(slpmsg->slpcall != NULL))
 	{
 		slpmsg->slpcall->progress = TRUE;
--- a/libpurple/protocols/msn/slpmsg.c	Thu Aug 05 23:58:21 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Fri Aug 06 00:07:39 2010 +0000
@@ -244,7 +244,7 @@
 
 	slpmsg->header->session_id = header->session_id;
 	slpmsg->size       = header->total_size;
-	slpmsg->flags      = P2P_ACK;
+	slpmsg->header->flags      = P2P_ACK;
 	slpmsg->header->ack_id     = header->id;
 	slpmsg->header->ack_sub_id = header->ack_id;
 	slpmsg->header->ack_size   = header->total_size;
@@ -259,7 +259,7 @@
 
 	slpmsg = msn_slpmsg_new(NULL);
 	slpmsg->slpcall = slpcall;
-	slpmsg->flags = P2P_MSN_OBJ_DATA;
+	slpmsg->header->flags = P2P_MSN_OBJ_DATA;
 	slpmsg->info = "SLP DATA";
 
 	msn_slpmsg_set_image(slpmsg, img);
@@ -289,7 +289,7 @@
 	slpmsg = msn_slpmsg_new(NULL);
 
 	slpmsg->slpcall = slpcall;
-	slpmsg->flags = P2P_FILE_DATA;
+	slpmsg->header->flags = P2P_FILE_DATA;
 	slpmsg->info = "SLP FILE";
 	slpmsg->size = size;
 
--- a/libpurple/protocols/msn/slpmsg.h	Thu Aug 05 23:58:21 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Fri Aug 06 00:07:39 2010 +0000
@@ -51,7 +51,6 @@
 	long id;
 
 	gboolean sip; /**< A flag that states if this is a SIP slp message. */
-	long flags;
 
 	gboolean ft;
 	PurpleStoredImage *img;
--- a/libpurple/protocols/msn/slpmsg_part.c	Thu Aug 05 23:58:21 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.c	Fri Aug 06 00:07:39 2010 +0000
@@ -165,7 +165,7 @@
 
 	slpmsg = data;
 
-	real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size;
+	real_size = (slpmsg->header->flags == P2P_ACK) ? 0 : slpmsg->size;
 
 	slpmsg->header->offset += part->header->length;
 
@@ -184,7 +184,7 @@
 	else
 	{
 		/* The whole message has been sent */
-		if (msn_p2p_msg_is_data(slpmsg->flags))
+		if (msn_p2p_msg_is_data(slpmsg->header->flags))
 		{
 			if (slpmsg->slpcall != NULL)
 			{