soc.2010.msn-tlc: 80dd5d79: Get rid of the Flags field in the SlpMes...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Thu Aug 5 22:01:10 EDT 2010


----------------------------------------------------------------------
Revision: 80dd5d79baf1228e70341099f49e45532a1a1a25
Parent:   d24824797d369af03ad98a53d11449803c57ccab
Author:   masca at cpw.pidgin.im
Date:     08/05/10 20:07:39
Branch:   im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/80dd5d79baf1228e70341099f49e45532a1a1a25

Changelog: 

Get rid of the Flags field in the SlpMessage in favor of the one in the Header.

Changes against parent d24824797d369af03ad98a53d11449803c57ccab

  patched  libpurple/protocols/msn/slpcall.c
  patched  libpurple/protocols/msn/slplink.c
  patched  libpurple/protocols/msn/slpmsg.c
  patched  libpurple/protocols/msn/slpmsg.h
  patched  libpurple/protocols/msn/slpmsg_part.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpcall.c	68639cfd8c34b6c2a744728b7d97bd078a944d05
+++ libpurple/protocols/msn/slpcall.c	6b4cd2348f15290a29b14af09f678560722deab4
@@ -1062,7 +1062,7 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 	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 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 		}
 		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 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 		}
 	}
 #if 0
-	else if (slpmsg->flags == 0x100)
+	else if (slpmsg->header->flags == 0x100)
 	{
 		slpcall = slplink->directconn->initial_call;
 
@@ -1149,13 +1149,13 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 			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;
 }
============================================================
--- libpurple/protocols/msn/slplink.c	d3e59485e8ab646cd06b660950d5c5ff6f610e88
+++ libpurple/protocols/msn/slplink.c	ed15af8add052ba63210eb5260ad8626e93044db
@@ -296,7 +296,7 @@ msn_slplink_send_msgpart(MsnSlpLink *slp
 	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_msgpart(MsnSlpLink *slp
 	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 @@ msn_slplink_release_slpmsg(MsnSlpLink *s
 	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 @@ msn_slplink_release_slpmsg(MsnSlpLink *s
 	}
 
 	slpmsg->header->id = slpmsg->id;
-	slpmsg->header->flags = (guint32)slpmsg->flags;
 
 	slpmsg->header->total_size = slpmsg->size;
 
@@ -452,14 +451,14 @@ init_first_msg(MsnSlpLink *slplink, MsnP
 	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 @@ process_complete_msg(MsnSlpLink *slplink
 
 	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 @@ process_complete_msg(MsnSlpLink *slplink
 			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 @@ msn_slplink_process_msg(MsnSlpLink *slpl
 	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;
============================================================
--- libpurple/protocols/msn/slpmsg.c	5a85d31dc49cddc484f9880a64bdb825a19e7eaf
+++ libpurple/protocols/msn/slpmsg.c	1ef2415a3402de92e83446adea31677ab917d2e6
@@ -244,7 +244,7 @@ MsnSlpMessage *msn_slpmsg_ack_new(MsnP2P
 
 	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 @@ MsnSlpMessage *msn_slpmsg_obj_new(MsnSlp
 
 	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 @@ MsnSlpMessage *msn_slpmsg_file_new(MsnSl
 	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;
 
============================================================
--- libpurple/protocols/msn/slpmsg.h	90d1d11d7594744bbeafff8d4256496518428066
+++ libpurple/protocols/msn/slpmsg.h	f640070fe3ecffc4644b481cc738668bc4e19b60
@@ -51,7 +51,6 @@ struct _MsnSlpMessage
 	long id;
 
 	gboolean sip; /**< A flag that states if this is a SIP slp message. */
-	long flags;
 
 	gboolean ft;
 	PurpleStoredImage *img;
============================================================
--- libpurple/protocols/msn/slpmsg_part.c	f5331a1bd30412cb5c58b5fbe4210314dd4d454a
+++ libpurple/protocols/msn/slpmsg_part.c	6deb9dac4f65f970da0867cffe121b4632adc5fb
@@ -165,7 +165,7 @@ msn_slpmsgpart_ack(MsnSlpMessagePart *pa
 
 	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 @@ msn_slpmsgpart_ack(MsnSlpMessagePart *pa
 	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)
 			{


More information about the Commits mailing list