# HG changeset patch # User andrew.victor@mxit.com # Date 1304454599 0 # Node ID 08dccf5274573754959344ccd3dfed747c47b508 # Parent 64da223573461ef7fbe95f7371ecd5eb88bde751 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. diff -r 64da22357346 -r 08dccf527457 libpurple/protocols/mxit/profile.c --- a/libpurple/protocols/mxit/profile.c Mon May 02 11:00:39 2011 +0000 +++ b/libpurple/protocols/mxit/profile.c Tue May 03 20:29:59 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 */ diff -r 64da22357346 -r 08dccf527457 libpurple/protocols/mxit/roster.c --- a/libpurple/protocols/mxit/roster.c Mon May 02 11:00:39 2011 +0000 +++ b/libpurple/protocols/mxit/roster.c Tue May 03 20:29:59 2011 +0000 @@ -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 ) );