changeset 8499:467b01d02f9c

[gaim-migrate @ 9235] Multiple MSN chats should now work. Patch by Robert Mibus. Thanks! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 25 Mar 2004 02:55:42 +0000
parents 0a9b591278bc
children a6748565835a
files ChangeLog src/protocols/msn/msn.c src/protocols/msn/session.c src/protocols/msn/session.h src/protocols/msn/switchboard.c
diffstat 5 files changed, 31 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 25 00:44:26 2004 +0000
+++ b/ChangeLog	Thu Mar 25 02:55:42 2004 +0000
@@ -48,6 +48,7 @@
 	* TCL Plugin API changed
 	* The mobile icon on MSN users is now removed when the person disables
 	  mobile paging (Stu Tomlinson)
+	* Multiple MSN chats should now work (Robert Mibus)
 	* Conversation placement by account now works correctly with both
 	  chats and IMs, and takes the Combine Chats and IMs option into
 	  consideration.
--- a/src/protocols/msn/msn.c	Thu Mar 25 00:44:26 2004 +0000
+++ b/src/protocols/msn/msn.c	Thu Mar 25 02:55:42 2004 +0000
@@ -269,7 +269,9 @@
 
 	swboard->total_users = 1;
 
-	swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id, "MSN Chat");
+	session->last_chat_id++;
+	swboard->chat_id = session->last_chat_id;
+	swboard->chat = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
 
 	gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat),
 							gaim_account_get_username(account), NULL);
@@ -455,7 +457,9 @@
 	if (!gaim_ssl_is_supported())
 	{
 		gaim_connection_error(gc,
-			_("SSL support is needed for MSN. Please install a supported SSL library. See http://gaim.sf.net/faq-ssl.php for more information."));
+			_("SSL support is needed for MSN. Please install a supported "
+			  "SSL library. See http://gaim.sf.net/faq-ssl.php for more "
+			  "information."));
 
 		return;
 	}
--- a/src/protocols/msn/session.c	Thu Mar 25 00:44:26 2004 +0000
+++ b/src/protocols/msn/session.c	Thu Mar 25 02:55:42 2004 +0000
@@ -220,12 +220,14 @@
 	g_return_val_if_fail(session != NULL, NULL);
 	g_return_val_if_fail(passport != NULL, NULL);
 
-	for (l = session->switches; l != NULL; l = l->next) {
+	for (l = session->switches; l != NULL; l = l->next)
+	{
 		swboard = (MsnSwitchBoard *)l->data;
 
-		if (!swboard->hidden &&
+		if (!swboard->hidden && !swboard->chat_id &&
 			!g_ascii_strcasecmp(passport,
-								msn_user_get_passport(swboard->user))) {
+								msn_user_get_passport(swboard->user)))
+		{
 			return swboard;
 		}
 	}
--- a/src/protocols/msn/session.h	Thu Mar 25 00:44:26 2004 +0000
+++ b/src/protocols/msn/session.h	Thu Mar 25 02:55:42 2004 +0000
@@ -101,6 +101,9 @@
 	char *dest_group_name;
 	MsnUser *moving_user;
 	MsnGroup *old_group;
+
+	/* The last chat ID. */
+	int last_chat_id;
 };
 
 /**
--- a/src/protocols/msn/switchboard.c	Thu Mar 25 00:44:26 2004 +0000
+++ b/src/protocols/msn/switchboard.c	Thu Mar 25 02:55:42 2004 +0000
@@ -193,7 +193,9 @@
 			conv = gaim_find_conversation_with_account(
 				msn_user_get_passport(swboard->user), account);
 
-			swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id,
+			servconn->session->last_chat_id++;
+			swboard->chat_id = servconn->session->last_chat_id;
+			swboard->chat = serv_got_joined_chat(gc, swboard->chat_id,
 												 "MSN Chat");
 
 			gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat),
@@ -225,8 +227,9 @@
 		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");
+		servconn->session->last_chat_id++;
+		swboard->chat_id = servconn->session->last_chat_id;
+		swboard->chat = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
 		gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat),
 						   msn_user_get_passport(swboard->user), NULL);
 		gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat),
@@ -295,7 +298,10 @@
 	MsnSwitchBoard *swboard = servconn->data;
 
 	if (swboard->chat != NULL)
-		serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(swboard->chat)));
+	{
+		serv_got_chat_left(gc,
+			gaim_conv_chat_get_id(GAIM_CONV_CHAT(swboard->chat)));
+	}
 
 	msn_switchboard_destroy(swboard);
 
@@ -309,7 +315,8 @@
 	MsnSwitchBoard *swboard = servconn->data;
 
 	if (!msn_switchboard_send_command(swboard, "CAL",
-									  msn_user_get_passport(swboard->user))) {
+									  msn_user_get_passport(swboard->user)))
+	{
 		msn_switchboard_destroy(swboard);
 
 		return FALSE;
@@ -357,8 +364,11 @@
 	}
 
 	if (swboard->chat != NULL)
-		serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(swboard->chat)),
+	{
+		serv_got_chat_in(gc,
+						 gaim_conv_chat_get_id(GAIM_CONV_CHAT(swboard->chat)),
 						 servconn->msg_passport, 0, body, time(NULL));
+	}
 	else
 		serv_got_im(gc, servconn->msg_passport, body, 0, time(NULL));