Mercurial > pidgin
diff libpurple/protocols/mxit/profile.c @ 31493:dde6f5770cd0
Searching.
author | andrew.victor@mxit.com |
---|---|
date | Mon, 28 Mar 2011 22:18:22 +0000 |
parents | ff2a8a839dbd |
children | acd92b7d8511 |
line wrap: on
line diff
--- a/libpurple/protocols/mxit/profile.c Fri Mar 25 08:33:12 2011 +0000 +++ b/libpurple/protocols/mxit/profile.c Mon Mar 28 22:18:22 2011 +0000 @@ -181,3 +181,43 @@ purple_notify_userinfo( session->con, username, info, NULL, NULL ); purple_notify_user_info_destroy( info ); } + +/*------------------------------------------------------------------------ + * Display the profiles of search results. + * + * @param session The MXit session object + * @param entries The list of profile entries + */ +void mxit_show_search_results( struct MXitSession* session, GList* entries ) +{ + PurpleNotifySearchResults* results; + PurpleNotifySearchColumn* column; + + if ( !entries ) { + mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "No results" ), _( "No users found." ) ); + return; + } + + results = purple_notify_searchresults_new(); + if ( !results ) + return; + + /* define columns */ + column = purple_notify_searchresults_column_new( _( "UserId" ) ); + purple_notify_searchresults_column_add( results, column ); + + while (entries != NULL) { + struct MXitProfile* profile = ( struct MXitProfile *) entries->data; + GList* row; + + /* column values */ + row = g_list_append( NULL, g_strdup( profile->userid ) ); + + purple_notify_searchresults_row_add( results, row ); + entries = g_list_next( entries ); + } + + // TODO: add buttons + + purple_notify_searchresults( session->con, NULL, NULL, NULL, results, NULL, NULL ); +}