Wed, 16 Jan 2013 10:32:33 +0200
MXit: Ignore new invites to join a GroupChat if you're already joined or still have a pending invite.
| ChangeLog | file | annotate | diff | comparison | revisions | |
| libpurple/protocols/mxit/multimx.c | file | annotate | diff | comparison | revisions |
--- a/ChangeLog Wed Jan 16 10:23:27 2013 +0200 +++ b/ChangeLog Wed Jan 16 10:32:33 2013 +0200 @@ -41,6 +41,8 @@ * 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)
--- a/libpurple/protocols/mxit/multimx.c Wed Jan 16 10:23:27 2013 +0200 +++ b/libpurple/protocols/mxit/multimx.c Wed Jan 16 10:32:33 2013 +0200 @@ -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); @@ -454,7 +458,7 @@ */ 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_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 @@ */ 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_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 @@ */ 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;