cpw.qulogic.msnp16: 91154757: When adding users to an MSN chat, don't ...

qulogic at pidgin.im qulogic at pidgin.im
Tue Dec 15 04:02:05 EST 2009


-----------------------------------------------------------------
Revision: 9115475787375850b563a1ec0b2007eaa463483e
Ancestor: b93b9f007b907df6cc4938bf4c9a065df4a7783a
Author: qulogic at pidgin.im
Date: 2009-12-14T23:44:51
Branch: im.pidgin.cpw.qulogic.msnp16
URL: http://d.pidgin.im/viewmtn/revision/info/9115475787375850b563a1ec0b2007eaa463483e

Modified files:
        libpurple/protocols/msn/switchboard.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/switchboard.c	8a0eccb1cf54daba1c8f102c45c4d3e68c4974c4
+++ libpurple/protocols/msn/switchboard.c	5c21cdf14376ced1f450de522dd8e1209e06191a
@@ -222,13 +222,28 @@ msn_switchboard_add_user(MsnSwitchBoard 
 {
 	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;
 


More information about the Commits mailing list