changeset 6831:a372cf34387e

[gaim-migrate @ 7376] Fixed MSNSLP crashing! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 14 Sep 2003 03:22:52 +0000
parents 7ed61a258cb2
children f03c0085c424
files src/protocols/msn/msg.c src/protocols/msn/msnslp.c src/protocols/msn/switchboard.c
diffstat 3 files changed, 24 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msg.c	Sun Sep 14 03:11:02 2003 +0000
+++ b/src/protocols/msn/msg.c	Sun Sep 14 03:22:52 2003 +0000
@@ -356,10 +356,8 @@
 	str = g_new0(char, len + 1);
 
 	g_strlcpy(str, buf, len);
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
 
 	msg_start = str + strlen(str);
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
 
 	/* Standard header. */
 	if (msg->charset == NULL) {
@@ -374,10 +372,8 @@
 				   "Content-Type: %s; charset=%s\r\n",
 				   msg->content_type, msg->charset);
 	}
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
 
 	g_strlcat(str, buf, len);
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
 
 	for (l = msg->attr_list; l != NULL; l = l->next) {
 		const char *key = (char *)l->data;
@@ -400,9 +396,6 @@
 
 		c = str + strlen(str);
 
-		gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
-
 		session_id      = htonl(msg->msnslp_header.session_id);
 		id              = htonl(msg->msnslp_header.id);
 		offset          = htonl(msg->msnslp_header.offset);
@@ -413,49 +406,31 @@
 		ack_unique_id   = htonl(msg->msnslp_header.ack_unique_id);
 		ack_length      = htonl(msg->msnslp_header.ack_length);
 
-		gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
-
-		c += msn_put32(c, session_id);     gaim_debug_misc("msn", "1\n");
-		c += msn_put32(c, id);             gaim_debug_misc("msn", "2\n");
-		c += msn_put32(c, offset);         gaim_debug_misc("msn", "3\n");
-		c += msn_put32(c, 0);              gaim_debug_misc("msn", "4\n");
-		c += msn_put32(c, total_size);     gaim_debug_misc("msn", "5\n");
-		c += msn_put32(c, 0);              gaim_debug_misc("msn", "6\n");
-		c += msn_put32(c, length);         gaim_debug_misc("msn", "7\n");
-		c += msn_put32(c, flags);          gaim_debug_misc("msn", "8\n");
-		c += msn_put32(c, ack_session_id); gaim_debug_misc("msn", "9\n");
-		c += msn_put32(c, ack_unique_id);  gaim_debug_misc("msn", "10\n");
-		c += msn_put32(c, ack_length);     gaim_debug_misc("msn", "11\n");
-		c += msn_put32(c, 0);              gaim_debug_misc("msn", "12\n");
-
-		gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
+		c += msn_put32(c, session_id);
+		c += msn_put32(c, id);
+		c += msn_put32(c, offset);
+		c += msn_put32(c, 0);
+		c += msn_put32(c, total_size);
+		c += msn_put32(c, 0);
+		c += msn_put32(c, length);
+		c += msn_put32(c, flags);
+		c += msn_put32(c, ack_session_id);
+		c += msn_put32(c, ack_unique_id);
+		c += msn_put32(c, ack_length);
+		c += msn_put32(c, 0);
 
 		if (body != NULL)
 		{
-			strncpy(c, body, len);
-
-			gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-			gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
+			g_strlcpy(c, body, c - msg_start);
 
 			c += strlen(body);
 
-			gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-			gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
-
 			if (strlen(body) > 0)
 				*c++ = '\0';
-
-			gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-			gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
 		}
 
 		c += msn_put32(c, msg->msnslp_footer.app_id);
 
-		gaim_debug_misc("msn", "cur size = %d\n", (c - msg_start));
-		gaim_debug_misc("msn", "msg->size = %d\n", msg->size);
-
 		if (msg->size != (c - msg_start))
 		{
 			gaim_debug(GAIM_DEBUG_ERROR, "msn",
--- a/src/protocols/msn/msnslp.c	Sun Sep 14 03:11:02 2003 +0000
+++ b/src/protocols/msn/msnslp.c	Sun Sep 14 03:22:52 2003 +0000
@@ -211,8 +211,7 @@
 
 	gaim_debug_misc("msn", "Message = {%s}\n", body);
 
-	//invite_msg = msn_message_new_msnslp();
-	invite_msg = msn_message_new();
+	invite_msg = msn_message_new_msnslp();
 
 	msn_message_set_sender(invite_msg, local_user);
 	msn_message_set_receiver(invite_msg, remote_user);
--- a/src/protocols/msn/switchboard.c	Sun Sep 14 03:11:02 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Sun Sep 14 03:22:52 2003 +0000
@@ -94,7 +94,7 @@
 
 	send_clientcaps(swboard);
 
-	if (0 && session->protocol_ver >= 9)
+	if (session->protocol_ver >= 9)
 	{
 		MsnUser *local_user, *remote_user;
 
@@ -105,11 +105,14 @@
 								  gaim_account_get_username(session->account),
 								  NULL);
 
-		swboard->slp_session = msn_slp_session_new(swboard, TRUE);
+		if (msn_user_get_object(remote_user) != NULL)
+		{
+			swboard->slp_session = msn_slp_session_new(swboard, TRUE);
 
-		msn_slp_session_request_user_display(swboard->slp_session,
-											 local_user, remote_user,
-											 msn_user_get_object(remote_user));
+			msn_slp_session_request_user_display(swboard->slp_session,
+					local_user, remote_user,
+					msn_user_get_object(remote_user));
+		}
 	}
 
 	return TRUE;
@@ -214,7 +217,8 @@
 	if (swboard->total_users == 2 && swboard->chat == NULL) {
 		GaimConversation *conv;
 
-		conv = gaim_find_conversation_with_account(msn_user_get_passport(swboard->user), account);
+		conv = gaim_find_conversation_with_account(
+			msn_user_get_passport(swboard->user), account);
 
 		swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id,
 											 "MSN Chat");