/pidgin/main: 720af20cbad3: MXit: Ignore new invites to join a G...

Andrew Victor andrew.victor at mxit.com
Wed Jan 16 04:39:52 EST 2013


Changeset: 720af20cbad3a2b9dc94eaf6846cad9f1f8fe61b
Author:	 Andrew Victor <andrew.victor at mxit.com>
Date:	 2013-01-16 10:32 +0200
Branch:	 release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/720af20cbad3

Description:

MXit: Ignore new invites to join a GroupChat if you're already joined or still have a pending invite.

diffstat:

 ChangeLog                          |   2 ++
 libpurple/protocols/mxit/multimx.c |  16 ++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (73 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,8 @@ version 2.10.7:
 	* Add support for typing notification.
 	* Add support for the Relationship Status profile attribute.
 	* Remove all reference to Hidden Number.
+	* Ignore new invites to join a GroupChat if you're already joined, or
+	  still have a pending invite.
 
 	Yahoo!:
 	* Fix a double-free in profile/picture loading code. (Mihai Serban)
diff --git a/libpurple/protocols/mxit/multimx.c b/libpurple/protocols/mxit/multimx.c
--- a/libpurple/protocols/mxit/multimx.c
+++ b/libpurple/protocols/mxit/multimx.c
@@ -277,7 +277,11 @@ void multimx_invite(struct MXitSession* 
 	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);
@@ -454,7 +458,7 @@ GList* mxit_chat_info(PurpleConnection *
  */
 void mxit_chat_join(PurpleConnection *gc, GHashTable *components)
 {
-	struct MXitSession* session = (struct MXitSession*) gc->proto_data;
+	struct MXitSession* session = purple_connection_get_protocol_data(gc);
 	const char* roomname = NULL;
 	struct multimx* multimx = NULL;
 
@@ -496,7 +500,7 @@ void mxit_chat_join(PurpleConnection *gc
  */
 void mxit_chat_reject(PurpleConnection *gc, GHashTable* components)
 {
-	struct MXitSession* session = (struct MXitSession*) gc->proto_data;
+	struct MXitSession* session = purple_connection_get_protocol_data(gc);
 	const char* roomname = NULL;
 	struct multimx* multimx = NULL;
 
@@ -539,7 +543,7 @@ char* mxit_chat_name(GHashTable *compone
  */
 void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *username)
 {
-	struct MXitSession* session = (struct MXitSession*) gc->proto_data;
+	struct MXitSession* session = purple_connection_get_protocol_data(gc);
 	struct multimx* multimx = NULL;
 	PurpleBuddy* buddy;
 	PurpleConversation *convo;
@@ -585,7 +589,7 @@ void mxit_chat_invite(PurpleConnection *
  */
 void mxit_chat_leave(PurpleConnection *gc, int id)
 {
-	struct MXitSession* session = (struct MXitSession*) gc->proto_data;
+	struct MXitSession* session = purple_connection_get_protocol_data(gc);
 	struct multimx* multimx = NULL;
 
 	purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i leave\n", id);
@@ -616,7 +620,7 @@ void mxit_chat_leave(PurpleConnection *g
  */
 int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
 {
-	struct MXitSession* session = (struct MXitSession*) gc->proto_data;
+	struct MXitSession* session = purple_connection_get_protocol_data(gc);
 	struct multimx* multimx = NULL;
 	const char* nickname;
 



More information about the Commits mailing list