changeset 24744:939d173b68b3

merge of '44bc6927617b36912dc84306fe8d80a6a9b942a3' and 'f15af3ccd3ef73a41e49e9ed402e23b47801cc67'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 15 Dec 2008 03:01:38 +0000
parents fbd1a82247ba (diff) 84aabca8413a (current diff)
children 0e8d91cdd63a 08414e3d8b4f ace4ff827908
files
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/oim.c	Mon Dec 15 02:46:20 2008 +0000
+++ b/libpurple/protocols/msn/oim.c	Mon Dec 15 03:01:38 2008 +0000
@@ -616,7 +616,7 @@
 
 		/* Match number to user's mobile number, FROM is a phone number
 		   if the other side pages you using your phone number */
-		if (!strncmp(passport, "tel:+", 5)) {
+		if (!strncmp(from, "tel:+", 5)) {
 			MsnUser *user =	msn_userlist_find_user_with_mobile_phone(
 					rdata->oim->session->userlist, from + 4);
 
@@ -630,13 +630,16 @@
 		                           msn_message_get_attr(message, "boundary"));
 		tokens = g_strsplit(message->body, boundary, 0);
 
-		for (part = tokens; *part != NULL; part++) {
+		/* tokens+1 to skip the "This is a multipart message..." text */
+		for (part = tokens+1; *part != NULL; part++) {
 			MsnMessage *multipart;
+			const char *type;
 			multipart = msn_message_new(MSN_MSG_UNKNOWN);
 			msn_message_parse_payload(multipart, *part, strlen(*part),
 			                          MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM);
 
-			if (!strcmp(msn_message_get_content_type(multipart), "text/plain")) {
+			type = msn_message_get_content_type(multipart);
+			if (type && !strcmp(type, "text/plain")) {
 				decode_msg = (char *)purple_base64_decode(multipart->body, &body_len);
 				msn_message_destroy(multipart);
 				break;