changeset 30003:08cae68b25dc

Save the user's MXitId received in the login-response packet to the Session. Display the MXitId (read-only) in the profile information.
author andrew.victor@mxit.com
date Thu, 20 May 2010 11:21:30 +0000
parents 30d0d4756fac
children 2213849c45a2
files libpurple/protocols/mxit/actions.c libpurple/protocols/mxit/mxit.h libpurple/protocols/mxit/protocol.c
diffstat 3 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/actions.c	Thu May 20 09:29:46 2010 +0000
+++ b/libpurple/protocols/mxit/actions.c	Thu May 20 11:21:30 2010 +0000
@@ -225,6 +225,13 @@
 	group = purple_request_field_group_new( NULL );
 	purple_request_fields_add_group( fields, group );
 
+	/* mxitId (read-only) */
+	if ( session->mxitId ) {
+		field = purple_request_field_string_new( "mxitid", _( "Your MXitId" ), session->mxitId, FALSE );
+		purple_request_field_string_set_editable( field, FALSE );
+		purple_request_field_group_add_field( group, field );
+	}
+
 	/* pin */
 	field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE );
 	purple_request_field_string_set_masked( field, TRUE );
--- a/libpurple/protocols/mxit/mxit.h	Thu May 20 09:29:46 2010 +0000
+++ b/libpurple/protocols/mxit/mxit.h	Thu May 20 11:21:30 2010 +0000
@@ -151,6 +151,7 @@
 
 	/* personal (profile) */
 	struct MXitProfile*	profile;					/* user's profile information */
+	char*				mxitId;						/* the user's MXitId */
 
 	/* libpurple */
 	PurpleAccount*		acc;						/* pointer to the libpurple internal account struct */
--- a/libpurple/protocols/mxit/protocol.c	Thu May 20 09:29:46 2010 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Thu May 20 11:21:30 2010 +0000
@@ -1302,6 +1302,10 @@
 		session->http_sesid = atoi( records[0]->fields[0]->data );
 	}
 
+	/* extract MXitId (from protocol 5.9) */
+	if ( records[1]->fcount >= 9 )
+		session->mxitId = g_strdup( records[1]->fields[8]->data );
+
 	/* display the current splash-screen */
 	if ( splash_popup_enabled( session ) )
 		splash_display( session );
@@ -2483,6 +2487,8 @@
 	mxit_free_emoticon_cache( session );
 
 	/* free allocated memory */
+	if ( session->mxitId )
+		g_free( session->mxitId );
 	g_free( session->encpwd );
 	session->encpwd = NULL;