libpurple/protocols/msn/msg.c

branch
cpw.khc.msnp14
changeset 20508
a8855578906a
parent 20484
4a410a579a80
child 20597
69b6246d3f94
--- a/libpurple/protocols/msn/msg.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/msg.c	Sat May 26 13:59:07 2007 +0000
@@ -23,7 +23,6 @@
  */
 #include "msn.h"
 #include "msg.h"
-#define MSN_DEBUG_MSG
 
 MsnMessage *
 msn_message_new(MsnMsgType type)
@@ -105,7 +104,8 @@
 	purple_debug_info("msn", "message unref (%p)[%d]\n", msg, msg->ref_count);
 #endif
 
-	if (msg->ref_count == 0){
+	if (msg->ref_count == 0)
+	{
 		msn_message_destroy(msg);
 
 		return NULL;
@@ -215,7 +215,6 @@
 	char **elems, **cur, **tokens;
 
 	g_return_if_fail(payload != NULL);
-//	purple_debug_info("MaYuan","payload:{%s}\n",payload);
 	tmp_base = tmp = g_malloc0(payload_len + 1);
 	memcpy(tmp_base, payload, payload_len);
 
@@ -232,7 +231,8 @@
 
 	elems = g_strsplit(tmp, line_dem, 0);
 
-	for (cur = elems; *cur != NULL; cur++){
+	for (cur = elems; *cur != NULL; cur++)
+	{
 		const char *key, *value;
 
 		tokens = g_strsplit(*cur, ": ", 2);
@@ -241,16 +241,20 @@
 		value = tokens[1];
 
 		/*if not MIME content ,then return*/
-		if (!strcmp(key, "MIME-Version")){
+		if (!strcmp(key, "MIME-Version"))
+		{
 			g_strfreev(tokens);
 			continue;
 		}
 
-		if (!strcmp(key, "Content-Type")){
+		if (!strcmp(key, "Content-Type"))
+		{
 			char *charset, *c;
 
-			if ((c = strchr(value, ';')) != NULL){
-				if ((charset = strchr(c, '=')) != NULL)	{
+			if ((c = strchr(value, ';')) != NULL)
+			{
+				if ((charset = strchr(c, '=')) != NULL)
+				{
 					charset++;
 					msn_message_set_charset(msg, charset);
 				}
@@ -259,7 +263,9 @@
 			}
 
 			msn_message_set_content_type(msg, value);
-		}else{
+		}
+		else
+		{
 			msn_message_set_attr(msg, key, value);
 		}
 
@@ -275,7 +281,8 @@
 	content_type = msn_message_get_content_type(msg);
 
 	if (content_type != NULL &&
-		!strcmp(content_type, "application/x-msnmsgrp2p")){
+		!strcmp(content_type, "application/x-msnmsgrp2p"))
+	{
 		MsnSlpHeader header;
 		MsnSlpFooter footer;
 		int body_len;
@@ -317,7 +324,9 @@
 			tmp += sizeof(footer);
 			msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value);
 		}
-	}else{
+	}
+	else
+	{
 		if (payload_len - (tmp - tmp_base) > 0) {
 			msg->body_len = payload_len - (tmp - tmp_base);
 			msg->body = g_malloc0(msg->body_len + 1);
@@ -468,14 +477,16 @@
 	}
 	else
 	{
-		if (body != NULL){
+		if (body != NULL)
+		{
 			memcpy(n, body, body_len);
 			n += body_len;
 			*n = '\0';
 		}
 	}
 
-	if (ret_size != NULL){
+	if (ret_size != NULL)
+	{
 		*ret_size = n - base;
 
 		if (*ret_size > 1664)
@@ -514,11 +525,14 @@
 	if (msg->body != NULL)
 		g_free(msg->body);
 
-	if (data != NULL && len > 0){
+	if (data != NULL && len > 0)
+	{
 		msg->body = g_malloc0(len + 1);
 		memcpy(msg->body, data, len);
 		msg->body_len = len;
-	}else{
+	}
+	else
+	{
 		msg->body = NULL;
 		msg->body_len = 0;
 	}
@@ -773,4 +787,3 @@
 
 	g_string_free(str, TRUE);
 }
-

mercurial