changeset 31723:5deb38200f62

Add support for re-inviting contacts in the Deleted or Rejected state. (right-click on Buddy list, and select Re-Invite)
author andrew.victor@mxit.com
date Fri, 30 Jul 2010 10:57:17 +0000
parents af53c65c6c5a
children 6260abdb218c
files libpurple/protocols/mxit/mxit.c
diffstat 1 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/mxit.c	Thu Jul 29 09:27:24 2010 +0000
+++ b/libpurple/protocols/mxit/mxit.c	Fri Jul 30 10:57:17 2010 +0000
@@ -588,7 +588,33 @@
 
 
 /*------------------------------------------------------------------------
- * Buddy list menu.
+ * Re-Invite was selected from the buddy-list menu.
+ *
+ *  @param node		The entry in the buddy list.
+ *  @param ignored	(not used)
+ */
+static void mxit_reinvite( PurpleBlistNode *node, gpointer ignored )
+{
+	PurpleBuddy*		buddy;
+	struct contact*		contact;
+	PurpleConnection*	gc;
+	struct MXitSession*	session;
+
+	buddy = (PurpleBuddy *)node;
+	gc = purple_account_get_connection( purple_buddy_get_account( buddy ) );
+	session = gc->proto_data;
+
+	contact = purple_buddy_get_protocol_data( (PurpleBuddy*) node );
+	if ( !contact )
+		return;
+
+	/* send a new invite */
+	mxit_send_invite( session, contact->username, contact->alias, contact->groupname );
+}
+
+
+/*------------------------------------------------------------------------
+ * Buddy-list menu.
  *
  *  @param node		The entry in the buddy list.
  */
@@ -597,6 +623,7 @@
 	PurpleBuddy*		buddy;
 	struct contact*		contact;
 	GList*				m = NULL;
+	PurpleMenuAction*	act;
 
 	if ( !PURPLE_BLIST_NODE_IS_BUDDY( node ) )
 		return NULL;
@@ -606,6 +633,12 @@
 	if ( !contact )
 		return NULL;
 
+	if ( ( contact->subtype == MXIT_SUBTYPE_DELETED ) || ( contact->subtype == MXIT_SUBTYPE_REJECTED ) || ( contact->subtype == MXIT_SUBTYPE_NONE ) ) {
+		/* contact is in Deleted, Rejected or None state */
+		act = purple_menu_action_new( _( "Re-Invite" ), PURPLE_CALLBACK( mxit_reinvite ), NULL, NULL );
+		m = g_list_append(m, act);
+	}
+
 	return m;
 }