changeset 30420:5622de6b7b8d

When our avatar image is changed, the MXit server will push an ExtendedProfile-Response packet containing just the AvatarId field to the client. This causes the existing cached profile info to be discarded, and only the new AvatarId is cached. (ie, all fields in Accounts->Change Profile become empty). Now when receiving an ExtendedProfile-Response packet for our profile, we only update the existing cached profile with the provided fields.
author andrew.victor@mxit.com
date Wed, 19 May 2010 21:17:01 +0000
parents 207662bad69c
children 6e4fa807abd4
files libpurple/protocols/mxit/protocol.c
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/protocol.c	Wed May 19 20:29:31 2010 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Wed May 19 21:17:01 2010 +0000
@@ -1582,7 +1582,16 @@
 
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_extprofile: profile for '%s'\n", mxitId );
 
-	profile = g_new0( struct MXitProfile, 1 );
+	if ( records[0]->fields[0]->len == 0 ) {
+		/* no MXitId provided, so this must be our own profile information */
+		if ( session->profile == NULL )
+			session->profile = g_new0( struct MXitProfile, 1 );
+		profile = session->profile;
+	}
+	else {
+		/* is a buddy's profile */
+		profile = g_new0( struct MXitProfile, 1 );
+	}
 
 	/* set the count for attributes */
 	count = atoi( records[0]->fields[1]->data );
@@ -1657,17 +1666,9 @@
 		}
 	}
 
-	if ( records[0]->fields[0]->len == 0 ) {
-		/* no MXit id provided, so this must be our own profile information */
-		if ( session->profile )
-			g_free( session->profile );
-		session->profile = profile;
-	}
-	else {
-		/* display other user's profile */
+	/* if this is not our profile, just display it */
+	if ( profile != session->profile ) {
 		mxit_show_profile( session, mxitId, profile );
-
-		/* cleanup */
 		g_free( profile );
 	}
 }