pidgin: d9664c53: Prevent conference from splitting, when ...

sulabh at soc.pidgin.im sulabh at soc.pidgin.im
Thu Jul 16 10:50:27 EDT 2009


-----------------------------------------------------------------
Revision: d9664c539826147542563d03569001aa35a20e0a
Ancestor: 77f1c684f6f76bf4cb002c162b9c96c673b5d550
Author: sulabh at soc.pidgin.im
Date: 2009-07-16T14:45:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d9664c539826147542563d03569001aa35a20e0a

Modified files:
        libpurple/protocols/yahoo/yahoochat.c

ChangeLog: 

Prevent conference from splitting, when reinvited to one we are a member of. Fixes ticket #9601

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoochat.c	dd735680b2d44c7778840f53504744f5b09fa541
+++ libpurple/protocols/yahoo/yahoochat.c	ff952214f8abfcd311619ea3b0515365ed72a822
@@ -121,12 +121,29 @@ void yahoo_process_conference_invite(Pur
 	char *msg = NULL;
 	GString *members = NULL;
 	GHashTable *components;
+	PurpleConversation *c = NULL;
 
 	if ( (pkt->status == 2) || (pkt->status == 11) )
 		return; /* Status is 11 when we are being notified about invitation being sent to someone else */
 
 	account = purple_connection_get_account(gc);
 
+	for (l = pkt->hash; l; l = l->next) {
+		struct yahoo_pair *pair = l->data;
+		if (pair->key == 57)
+		{
+			room = yahoo_string_decode(gc, pair->value, FALSE);
+			if((c = yahoo_find_conference(gc, room)))
+			{
+				/* Looks like we got invited to an already open conference. */
+				/* Laters: Should we accept this conference rather than ignoring the invitation ? */
+				purple_debug_info("yahoo","Ignoring invitation for an already existing chat, room:%s\n",room);
+				g_free(room);
+				return;
+			}
+		}
+	}
+
 	members = g_string_sized_new(512);
 
 	for (l = pkt->hash; l; l = l->next) {
@@ -254,7 +271,10 @@ void yahoo_process_conference_logon(Purp
 	if (who && room) {
 		c = yahoo_find_conference(gc, room);
 		if (c)
-			yahoo_chat_add_user(PURPLE_CONV_CHAT(c), who, NULL);
+		{	/* Prevent duplicate users in the chat */
+			if( !purple_conv_chat_find_user(PURPLE_CONV_CHAT(c), who) )
+				yahoo_chat_add_user(PURPLE_CONV_CHAT(c), who, NULL);
+		}
 		g_free(room);
 	}
 }


More information about the Commits mailing list