pidgin.mxit: 8b579559: Adding contacts normally and via search-...

andrew.victor at mxit.com andrew.victor at mxit.com
Tue May 3 16:36:13 EDT 2011


----------------------------------------------------------------------
Revision: 8b579559174d8853ab2218dac2e81e3ba5baead2
Parent:   3a2c48c2185afde6696ff1c2bf9d61f373e40fe1
Author:   andrew.victor at mxit.com
Date:     05/03/11 16:29:59
Branch:   im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/8b579559174d8853ab2218dac2e81e3ba5baead2

Changelog: 

Adding contacts normally and via search-results works slightly differently
in MXit.  The 'Invite' button on the search-results window pops-up the standard
"Add Buddy" window, and so the prpl doesn't know what type of invite to
perform.
To get around this problem for now, we'll encode this in the search-results
userId and the prpl can detect this and perform the right type of invite.
 

Changes against parent 3a2c48c2185afde6696ff1c2bf9d61f373e40fe1

  patched  libpurple/protocols/mxit/profile.c
  patched  libpurple/protocols/mxit/roster.c

-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/profile.c	7ad49d47b8d747b627ec1e94003627233fd7e8bc
+++ libpurple/protocols/mxit/profile.c	1f614e6579d560cdd92719771de7058b38065bc5
@@ -292,9 +292,10 @@ void mxit_show_search_results( struct MX
 	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 @@ void mxit_show_search_results( struct MX
 
 		purple_notify_searchresults_row_add( results, row );
 		entries = g_list_next( entries );
+
+		g_free( tmp );
 	}
 
 	/* button */
============================================================
--- libpurple/protocols/mxit/roster.c	d9aff1113dab9ba4dfa976f0da0814d0fb97b1b2
+++ libpurple/protocols/mxit/roster.c	b712ffe3f7907a08f0c85b1d1009d283b4fdaee8
@@ -747,7 +747,14 @@ void mxit_add_buddy( PurpleConnection* g
 		 * 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 ) );


More information about the Commits mailing list