changeset 32344:4bf9b7cf7810

When receiving an invite to join a GroupChat, first check if a matching room entry already exists (ie, already joined, or invite popup still pending). If so, just ignore the invite.
author andrew.victor@mxit.com
date Sat, 13 Aug 2011 22:01:39 +0000
parents ff8ab76da6bb
children 1d47a7ee0b61
files libpurple/protocols/mxit/multimx.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/multimx.c	Sat Aug 13 17:11:59 2011 +0000
+++ b/libpurple/protocols/mxit/multimx.c	Sat Aug 13 22:01:39 2011 +0000
@@ -277,7 +277,11 @@
 	GHashTable *components;
 	struct multimx* multimx = NULL;
 
-	purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' by '%s'\n", contact->alias, creator);
+	purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' (roomid='%s') by '%s'\n", contact->alias, contact->username, creator);
+
+	/* Check if the room already exists (ie, already joined or invite pending) */
+	if (find_room_by_username(session, contact->username) != NULL)
+		return;
 
 	/* Create a new room */
 	multimx = room_create(session, contact->username, contact->alias, STATE_INVITED);
@@ -307,7 +311,7 @@
 	multimx = find_room_by_username(session, contact->username);
 	if (multimx == NULL) {
 		multimx = room_create(session, contact->username, contact->alias, TRUE);
-		}
+	}
 	else if (multimx->state == STATE_INVITED) {
 		/* After successfully accepting an invitation */
 		multimx->state = STATE_JOINED;