pidgin.mxit: 5864c6fa: When our avatar image is changed, the MX...

andrew.victor at mxit.com andrew.victor at mxit.com
Wed May 19 17:20:47 EDT 2010


-----------------------------------------------------------------
Revision: 5864c6fa05930e760b82ecf2bfae0bda16405d3f
Ancestor: dbc1f520fc5afc4388b93300cc18e56a9330f51c
Author: andrew.victor at mxit.com
Date: 2010-05-19T21:17:01
Branch: im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/5864c6fa05930e760b82ecf2bfae0bda16405d3f

Modified files:
        libpurple/protocols/mxit/protocol.c

ChangeLog: 

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.


-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/protocol.c	c43097c3a27796d611861c27196ef0cb2764b9c2
+++ libpurple/protocols/mxit/protocol.c	1808bdc85c06090b1b83f43c8f51383c4b367d2b
@@ -1582,7 +1582,16 @@ static void mxit_parse_cmd_extprofile( s
 
 	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 @@ static void mxit_parse_cmd_extprofile( s
 		}
 	}
 
-	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 );
 	}
 }


More information about the Commits mailing list