changeset 31632:144c59ae122f

propagate from branch 'im.pidgin.pidgin' (head 27008103f84aa123bae2138b6e8c3a20303bde16) to branch 'im.pidgin.pidgin.mxit' (head 128e0ea032986b3c74c6a3a1abf0e812747960cd)
author andrew.victor@mxit.com
date Fri, 06 May 2011 08:05:04 +0000
parents 807860d518a6 (diff) 4c1e9b7b56d0 (current diff)
children a8cf2003ee7c
files ChangeLog
diffstat 3 files changed, 32 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/profile.c	Fri May 06 06:33:29 2011 +0000
+++ b/libpurple/protocols/mxit/profile.c	Fri May 06 08:05:04 2011 +0000
@@ -292,9 +292,10 @@
 	while (entries != NULL) {
 		struct MXitProfile* profile	= ( struct MXitProfile *) entries->data;
 		GList*	row;
+		gchar* tmp = purple_base64_encode( (unsigned char *) profile->userid, strlen( profile->userid ) );
 
 		/* column values */
-		row = g_list_append( NULL, g_strdup( profile->userid ) );
+		row = g_list_append( NULL, g_strdup_printf( "#%s", tmp ) );
 		row = g_list_append( row, g_strdup( profile->nickname ) );
 		row = g_list_append( row, g_strdup( profile->male ? "Male" : "Female" ) );
 		row = g_list_append( row, g_strdup_printf( "%i", calculateAge( profile->birthday ) ) );
@@ -302,6 +303,8 @@
 
 		purple_notify_searchresults_row_add( results, row );
 		entries = g_list_next( entries );
+
+		g_free( tmp );
 	}
 
 	/* button */
--- a/libpurple/protocols/mxit/protocol.c	Fri May 06 06:33:29 2011 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Fri May 06 08:05:04 2011 +0000
@@ -1907,6 +1907,23 @@
 			/* this is a contact */
 			if ( avatarId )
 				mxit_update_buddy_avatar( session, mxitId, avatarId );
+
+			if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) {
+				/* update the status message */
+				PurpleBuddy*		buddy	= NULL;
+
+				buddy = purple_find_buddy( session->acc, mxitId );
+				if ( buddy ) {
+					contact = purple_buddy_get_protocol_data( buddy );
+					if ( contact ) {
+						if ( contact->statusMsg )
+							g_free( contact->statusMsg );
+						contact->statusMsg = strdup( statusMsg );
+					}
+				}
+			}
+
+			/* show the profile */
 			mxit_show_profile( session, mxitId, profile );
 			g_free( profile );
 		}
@@ -2099,6 +2116,7 @@
 					if ( contact ) {
 						/* this is an invite (add image to the internal image store) */
 						contact->imgid = purple_imgstore_add_with_id( chunk.data, chunk.length, NULL );
+						/* show the profile */
 						mxit_show_profile( session, chunk.mxitid, contact->profile );
 					}
 					else {
--- a/libpurple/protocols/mxit/roster.c	Fri May 06 06:33:29 2011 +0000
+++ b/libpurple/protocols/mxit/roster.c	Fri May 06 08:05:04 2011 +0000
@@ -474,7 +474,7 @@
 	contact->capabilities = flags;
 
 	/* validate mood */
-	if (( contact->mood < MXIT_MOOD_NONE ) || ( contact->mood > MXIT_MOOD_STRESSED ))
+	if ( ( contact->mood < MXIT_MOOD_NONE ) || ( contact->mood > MXIT_MOOD_STRESSED ) )
 		contact->mood = MXIT_MOOD_NONE;
 
 	g_strlcpy( contact->customMood, customMood, sizeof( contact->customMood ) );
@@ -485,7 +485,7 @@
 		g_free( contact->statusMsg );
 		contact->statusMsg = NULL;
 	}
-	if ( statusMsg[0] != '\0' )
+	if ( ( statusMsg ) && ( statusMsg[0] != '\0' ) )
 		contact->statusMsg = g_markup_escape_text( statusMsg, -1 );
 
 	/* update the buddy's status (reference: "libpurple/prpl.h") */
@@ -747,7 +747,14 @@
 		 * 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, TRUE, buddy_alias, group_name, message );
+
+		if ( buddy_name[0] == '#' ) {
+			gchar *tmp = (gchar*) purple_base64_decode( buddy_name + 1, NULL );
+			mxit_send_invite( session, tmp, FALSE, buddy_alias, group_name, message );
+			g_free( tmp );
+		}
+		else
+			mxit_send_invite( session, buddy_name, TRUE, buddy_alias, group_name, message );
 	}
 	else {
 		purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy (scenario 2) (list:%i)\n", g_slist_length( list ) );