changeset 28801:19be6fe515ca

*** Plucked rev 9115475787375850b563a1ec0b2007eaa463483e (qulogic@pidgin.im): When adding users to an MSN chat, don't add them again if the same passport is in the conversation. That is, ignore people logged in at more than one location. Fixes #7421.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 14 Dec 2009 23:57:26 +0000
parents 139aa186e8cc
children cb28babdf3fe
files ChangeLog libpurple/protocols/msn/switchboard.c
diffstat 2 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 14 06:50:33 2009 +0000
+++ b/ChangeLog	Mon Dec 14 23:57:26 2009 +0000
@@ -9,10 +9,12 @@
 	  Chinese characters (broken in 2.6.4)
 
 	MSN:
-	* File transfer requests will no longer cause a crash if you delete the file
-	  before the other side accepts.
-	* Recieved files will no longer hold an extra lock after completion, meaning
-	  they can be moved or deleted without complaints from your OS.
+	* File transfer requests will no longer cause a crash if you delete the
+	  file before the other side accepts.
+	* Recieved files will no longer hold an extra lock after completion,
+	  meaning they can be moved or deleted without complaints from your OS.
+	* Buddies who sign in from a second location will no longer cause an
+	  unnecessary chat window to open.
 
 	XMPP:
 	* Added support for the SCRAM-SHA-1 SASL mechanism.  This is only
--- a/libpurple/protocols/msn/switchboard.c	Mon Dec 14 06:50:33 2009 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Mon Dec 14 23:57:26 2009 +0000
@@ -222,13 +222,28 @@
 {
 	MsnCmdProc *cmdproc;
 	PurpleAccount *account;
+	char *semicolon;
+	char *passport;
 
 	g_return_if_fail(swboard != NULL);
 
 	cmdproc = swboard->cmdproc;
 	account = cmdproc->session->account;
 
-	swboard->users = g_list_prepend(swboard->users, g_strdup(user));
+	semicolon = strchr(user, ';');
+	/* We don't really care about the machine ID. */
+	if (semicolon)
+		passport = g_strndup(user, semicolon - user);
+	else
+		passport = g_strdup(user);
+
+	/* Don't add multiple endpoints to the conversation. */
+	if (g_list_find_custom(swboard->users, passport, (GCompareFunc)strcmp)) {
+		g_free(passport);
+		return;
+	}
+
+	swboard->users = g_list_prepend(swboard->users, passport);
 	swboard->current_users++;
 	swboard->empty = FALSE;