changeset 30002:30d0d4756fac

* Separate the ClientVersion from the supported ProtocolVersion. * Increment the protocol version we use from v5.9 to v6.0, and update the Login Request packet accordingly. * Protocol v6.0 supports Invite Rejection messages, so if an invite we sent was rejected then display it in the buddy tooltip.
author andrew.victor@mxit.com
date Thu, 20 May 2010 09:29:46 +0000
parents 6e4fa807abd4
children 08cae68b25dc
files libpurple/protocols/mxit/actions.c libpurple/protocols/mxit/mxit.c libpurple/protocols/mxit/protocol.c libpurple/protocols/mxit/protocol.h
diffstat 4 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/actions.c	Thu May 20 09:03:37 2010 +0000
+++ b/libpurple/protocols/mxit/actions.c	Thu May 20 09:29:46 2010 +0000
@@ -304,11 +304,12 @@
 	char	version[256];
 
 	g_snprintf( version, sizeof( version ), "MXit libPurple Plugin v%s\n"
-											"MXit Client Protocol v%s\n\n"
+											"MXit Client Protocol v%i.%i\n\n"
 											"Author:\nPieter Loubser\n\n"
 											"Contributors:\nAndrew Victor\n\n"
 											"Testers:\nBraeme Le Roux\n\n",
-											MXIT_PLUGIN_VERSION, MXIT_CP_RELEASE );
+											MXIT_PLUGIN_VERSION,
+											( MXIT_CP_PROTO_VESION / 10 ), ( MXIT_CP_PROTO_VESION % 10 ) );
 
 	mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "About" ), version );
 }
--- a/libpurple/protocols/mxit/mxit.c	Thu May 20 09:03:37 2010 +0000
+++ b/libpurple/protocols/mxit/mxit.c	Thu May 20 09:29:46 2010 +0000
@@ -352,6 +352,10 @@
 	if ( contact->subtype != 0 )
 		purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) );
 
+	/* rejection message */
+	if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) )
+		purple_notify_user_info_add_pair( info, _( "Rejection Message" ), contact->msg );
+
 	/* hidden number */
 	if ( contact->flags & MXIT_CFLAG_HIDDEN )
 		purple_notify_user_info_add_pair( info, _( "Hidden Number" ), _( "Yes" ) );
@@ -491,6 +495,8 @@
 			g_free( contact->statusMsg );
 		if ( contact->avatarId )
 			g_free( contact->avatarId );
+		if ( contact->msg )
+			g_free( contact->msg );
 		g_free( contact );
 	}
 
--- a/libpurple/protocols/mxit/protocol.c	Thu May 20 09:03:37 2010 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Thu May 20 09:29:46 2010 +0000
@@ -672,10 +672,12 @@
 	/* convert the packet to a byte stream */
 	datalen = sprintf( data,	"ms=%s%c%s%c%i%c"			/* "ms"=password\1version\1getContacts\1 */
 								"%s%c%s%c%i%c"				/* capabilities\1dc\1features\1 */
-								"%s%c%s",					/* dialingcode\1locale */
+								"%s%c%s%c"					/* dialingcode\1locale\1 */
+								"%i%c%i%c%i",				/* maxReplyLen\1protocolVer\1lastRosterUpdate */
 								session->encpwd, CP_FLD_TERM, MXIT_CP_VERSION, CP_FLD_TERM, 1, CP_FLD_TERM,
 								MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, MXIT_CP_FEATURES, CP_FLD_TERM,
-								session->dialcode, CP_FLD_TERM, locale
+								session->dialcode, CP_FLD_TERM, locale, CP_FLD_TERM,
+								CP_MAX_FILESIZE, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0
 	);
 
 	/* include "custom resource" information */
@@ -1513,10 +1515,14 @@
 		contact->mood = atoi( rec->fields[5]->data );
 
 		if ( rec->fcount > 6 ) {
-			/* added in protocol 5.9.0 - flags & subtype */
+			/* added in protocol 5.9 - flags & subtype */
 			contact->flags = atoi( rec->fields[6]->data );
 			contact->subtype = rec->fields[7]->data[0];
 		}
+		if ( rec->fcount > 8 ) {
+			/* added in protocol 6.0 - reject message */
+			contact->msg = g_strdup( rec->fields[8]->data );
+		}
 
 		/* add the contact to the buddy list */
 		if ( contact-> type == MXIT_TYPE_MULTIMX )			/* contact is a MultiMX room */
--- a/libpurple/protocols/mxit/protocol.h	Thu May 20 09:03:37 2010 +0000
+++ b/libpurple/protocols/mxit/protocol.h	Thu May 20 09:29:46 2010 +0000
@@ -85,11 +85,12 @@
 
 /* MXit client version */
 #define		MXIT_CP_DISTCODE		"P"						/* client distribution code (magic, do not touch!) */
-#define		MXIT_CP_RELEASE			"5.9.0"					/* client protocol release version supported */
+#define		MXIT_CP_RELEASE			"5.9.0"					/* client version */
 #define		MXIT_CP_ARCH			"Y"						/* client architecture series (Y not for Yoda but for PC-client) */
 #define		MXIT_CLIENT_ID			"LP"					/* client ID as specified by MXit */
 #define		MXIT_CP_PLATFORM		"PURPLE"				/* client platform */
 #define		MXIT_CP_VERSION			MXIT_CP_DISTCODE"-"MXIT_CP_RELEASE"-"MXIT_CP_ARCH"-"MXIT_CP_PLATFORM
+#define		MXIT_CP_PROTO_VESION	60						/* client protocol version */
 
 /* set operating system name */
 #if defined( __APPLE__ )