diff libpurple/protocols/msn/slpcall.c @ 31558:ce968e115c95

propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64) to branch 'im.pidgin.pidgin' (head 92f47f4e8b0cbb107fd97e1ab814d1cedbf109ad)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 06 May 2011 06:25:14 +0000
parents 34da321b60f1
children eb1bbaae3427
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpcall.c	Tue Jan 04 05:05:06 2011 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri May 06 06:25:14 2011 +0000
@@ -511,7 +511,7 @@
 		/* File Transfer */
 		PurpleAccount *account;
 		PurpleXfer *xfer;
-		MsnFileContext *header;
+		MsnFileContext *file_context;
 		char *buf;
 		gsize bin_len;
 		guint32 file_size;
@@ -528,12 +528,12 @@
 							 slpcall->slplink->remote_user);
 
 		buf = (char *)purple_base64_decode(context, &bin_len);
-		header = msn_file_context_from_wire(buf, bin_len);
+		file_context = msn_file_context_from_wire(buf, bin_len);
 
-		if (header != NULL) {
-			file_size = header->file_size;
+		if (file_context != NULL) {
+			file_size = file_context->file_size;
 
-			file_name = g_convert((const gchar *)&header->file_name,
+			file_name = g_convert((const gchar *)&file_context->file_name,
 			                      MAX_FILE_NAME_LEN * 2,
 			                      "UTF-8", "UTF-16LE",
 			                      NULL, NULL, NULL);
@@ -554,16 +554,16 @@
 
 			xfer->data = slpcall;
 
-			if (header->preview) {
-				purple_xfer_set_thumbnail(xfer, header->preview,
-				                          header->preview_len,
+			if (file_context->preview) {
+				purple_xfer_set_thumbnail(xfer, file_context->preview,
+				                          file_context->preview_len,
 				    					  "image/png");
-				g_free(header->preview);
+				g_free(file_context->preview);
 			}
 
 			purple_xfer_request(xfer);
 		}
-		g_free(header);
+		g_free(file_context);
 		g_free(buf);
 
 		accepted = TRUE;
@@ -1059,16 +1059,21 @@
 	MsnSlpCall *slpcall;
 	const guchar *body;
 	gsize body_len;
+	guint32 session_id;
+	guint32 flags;
 
 	slpcall = NULL;
 	body = slpmsg->buffer;
-	body_len = slpmsg->header->offset;
+	body_len = msn_p2p_info_get_offset(slpmsg->p2p_info);
 
-	if (slpmsg->header->flags == P2P_NO_FLAG || slpmsg->header->flags == P2P_WLM2009_COMP)
+	session_id = msn_p2p_info_get_session_id(slpmsg->p2p_info);
+	flags = msn_p2p_info_get_flags(slpmsg->p2p_info);
+
+	if (flags == P2P_NO_FLAG || flags == P2P_WLM2009_COMP)
 	{
 		char *body_str;
 
-		if (slpmsg->header->session_id == 64)
+		if (session_id == 64)
 		{
 			/* This is for handwritten messages (Ink) */
 			GError *error = NULL;
@@ -1125,9 +1130,9 @@
 		}
 		g_free(body_str);
 	}
-	 else if (msn_p2p_msg_is_data(slpmsg->header->flags))
+	 else if (msn_p2p_msg_is_data(flags))
 	{
-		slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
+		slpcall = msn_slplink_find_slp_call_with_session_id(slplink, session_id);
 
 		if (slpcall != NULL)
 		{
@@ -1142,22 +1147,13 @@
 			slpcall->wasted = TRUE;
 		}
 	}
-#if 0
-	else if (slpmsg->header->flags == 0x100)
-	{
-		slpcall = slplink->directconn->initial_call;
-
-		if (slpcall != NULL)
-			msn_slpcall_session_init(slpcall);
-	}
-#endif
-	else if (slpmsg->header->flags == P2P_ACK)
+	else if (flags == P2P_ACK)
 	{
 		/* Acknowledgement of previous message. Don't do anything currently. */
 	}
 	else
 		purple_debug_warning("msn", "Unprocessed SLP message with flags 0x%04x\n",
-		                     slpmsg->header->flags);
+		                     flags);
 
 	return slpcall;
 }