changeset 31485:aa74632c869d

Add the invite message support to MXit prpl.
author andrew.victor@mxit.com
date Mon, 21 Mar 2011 16:30:01 +0000
parents 826b595c4259
children 249ffc44061e
files ChangeLog libpurple/protocols/mxit/mxit.c libpurple/protocols/mxit/protocol.c libpurple/protocols/mxit/protocol.h libpurple/protocols/mxit/roster.c libpurple/protocols/mxit/roster.h
diffstat 6 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 21 13:52:02 2011 +0000
+++ b/ChangeLog	Mon Mar 21 16:30:01 2011 +0000
@@ -22,6 +22,9 @@
 	ICQ:
 	* Fix unsetting your mood when "None" is selected. (#7431)
 
+	MXit:
+	* Support for an Invite Message when adding a buddy.
+
 	Windows-Specific Changes:
 	* Fix building libpurple with Visual C++ .NET 2005. This was accidentally
 	  broken in 2.7.11. (Florian Quèze)
--- a/libpurple/protocols/mxit/mxit.c	Mon Mar 21 13:52:02 2011 +0000
+++ b/libpurple/protocols/mxit/mxit.c	Mon Mar 21 16:30:01 2011 +0000
@@ -628,7 +628,7 @@
 		return;
 
 	/* send a new invite */
-	mxit_send_invite( session, contact->username, contact->alias, contact->groupname );
+	mxit_send_invite( session, contact->username, contact->alias, contact->groupname, NULL );
 }
 
 
@@ -664,7 +664,7 @@
 /*========================================================================================================================*/
 
 static PurplePluginProtocolInfo proto_info = {
-	OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE,			/* options */
+	OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE,			/* options */
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
 	{						/* icon_spec */
@@ -692,7 +692,7 @@
 	mxit_set_status,		/* set_status */
 	NULL,					/* set_idle */
 	NULL,					/* change_passwd */
-	mxit_add_buddy,			/* add_buddy				[roster.c] */
+	NULL,					/* add_buddy				[roster.c] */
 	NULL,					/* add_buddies */
 	mxit_remove_buddy,		/* remove_buddy				[roster.c] */
 	NULL,					/* remove_buddies */
@@ -743,7 +743,7 @@
 	mxit_get_moods,			/* get_moods */
 	NULL,					/* set_public_alias */
 	NULL,					/* get_public_alias */
-	NULL,					/* add_buddy_with_invite */
+	mxit_add_buddy,			/* add_buddy_with_invite */
 	NULL					/* add_buddies_with_invite */
 };
 
--- a/libpurple/protocols/mxit/protocol.c	Mon Mar 21 13:52:02 2011 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Mon Mar 21 16:30:01 2011 +0000
@@ -987,8 +987,9 @@
  *  @param username		The username of the contact being invited
  *  @param alias		Our alias for the contact
  *  @param groupname	Group in which contact should be stored.
+ *  @param message		Invite message
  */
-void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname )
+void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname, const char* message )
 {
 	char		data[CP_MAX_PACKET];
 	int			datalen;
@@ -997,7 +998,7 @@
 	datalen = snprintf( data, sizeof( data ),
 								"ms=%s%c%s%c%s%c%i%c%s",	/* "ms"=group\1username\1alias\1type\1msg */
 								groupname, CP_FLD_TERM, username, CP_FLD_TERM, alias,
-								CP_FLD_TERM, MXIT_TYPE_MXIT, CP_FLD_TERM, ""
+								CP_FLD_TERM, MXIT_TYPE_MXIT, CP_FLD_TERM, ( message ? message : "" )
 	);
 
 	/* queue packet for transmission */
--- a/libpurple/protocols/mxit/protocol.h	Mon Mar 21 13:52:02 2011 +0000
+++ b/libpurple/protocols/mxit/protocol.h	Mon Mar 21 16:30:01 2011 +0000
@@ -305,7 +305,7 @@
 void mxit_send_suggest_friends( struct MXitSession* session, int max, unsigned int nr_attrib, const char* attribute[] );
 void mxit_send_suggest_search( struct MXitSession* session, int max, const char* text, unsigned int nr_attrib, const char* attribute[] );
 
-void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname );
+void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname, const char* message );
 void mxit_send_remove( struct MXitSession* session, const char* username );
 void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias );
 void mxit_send_deny_sub( struct MXitSession* session, const char* username );
--- a/libpurple/protocols/mxit/roster.c	Mon Mar 21 13:52:02 2011 +0000
+++ b/libpurple/protocols/mxit/roster.c	Mon Mar 21 16:30:01 2011 +0000
@@ -680,8 +680,9 @@
  *  @param gc		The connection object
  *  @param buddy	The new buddy
  *  @param group	The group of the new buddy
+ *  @param message	The invite message
  */
-void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group )
+void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group, const char* message )
 {
 	struct MXitSession*	session	= (struct MXitSession*) gc->proto_data;
 	GSList*				list	= NULL;
@@ -702,7 +703,7 @@
 		 * you accept an invite.  so in that case the user is already
 		 * in our blist and ready to be chatted to.
 		 */
-		mxit_send_invite( session, buddy_name, buddy_alias, group_name );
+		mxit_send_invite( session, buddy_name, buddy_alias, group_name, message );
 	}
 	else {
 		purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy (scenario 2) (list:%i)\n", g_slist_length( list ) );
--- a/libpurple/protocols/mxit/roster.h	Mon Mar 21 13:52:02 2011 +0000
+++ b/libpurple/protocols/mxit/roster.h	Mon Mar 21 16:30:01 2011 +0000
@@ -142,7 +142,7 @@
 gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* username );
 
 /* libPurple callbacks */
-void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group );
+void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group, const char* message );
 void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group );
 void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias );
 void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group );