comparison libpurple/protocols/mxit/actions.c @ 31945:dde6f5770cd0

Searching.
author andrew.victor@mxit.com
date Mon, 28 Mar 2011 22:18:22 +0000
parents ff2a8a839dbd
children 17875962a0a0
comparison
equal deleted inserted replaced
31944:7c3b4002f46e 31945:dde6f5770cd0
387 mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "About" ), version ); 387 mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "About" ), version );
388 } 388 }
389 389
390 390
391 /*------------------------------------------------------------------------ 391 /*------------------------------------------------------------------------
392 * Request list of suggested friends.
393 *
394 * @param action The action object
395 */
396 static void mxit_cb_suggested_friends( PurplePluginAction* action )
397 {
398 PurpleConnection* gc = (PurpleConnection*) action->context;
399 struct MXitSession* session = (struct MXitSession*) gc->proto_data;
400 const char* profilelist[] = {
401 CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME,
402 CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR };
403
404 mxit_send_suggest_friends( session, 20, ARRAY_SIZE( profilelist ), profilelist );
405 }
406
407
408 /*------------------------------------------------------------------------
409 * Perform contact search.
410 *
411 * @param action The action object
412 */
413 static void mxit_user_search_cb( PurpleConnection *gc, const char *input )
414 {
415 struct MXitSession* session = (struct MXitSession*) gc->proto_data;
416 const char* profilelist[] = {
417 CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME,
418 CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR };
419
420 mxit_send_suggest_search( session, 20, input, ARRAY_SIZE( profilelist ), profilelist );
421 }
422
423
424 /*------------------------------------------------------------------------
425 * Display the search input form.
426 *
427 * @param action The action object
428 */
429 static void mxit_cb_search_begin( PurplePluginAction* action )
430 {
431 PurpleConnection* gc = (PurpleConnection*) action->context;
432
433 purple_request_input( gc, _( "Search for user" ),
434 _( "Search for a MXit contact" ),
435 _( "Type search information" ),
436 NULL, FALSE, FALSE, NULL,
437 _("_Search"), G_CALLBACK( mxit_user_search_cb ),
438 _("_Cancel"), NULL,
439 purple_connection_get_account( gc ), NULL, NULL,
440 gc);
441 }
442
443
444 /*------------------------------------------------------------------------
392 * Associate actions with the MXit plugin. 445 * Associate actions with the MXit plugin.
393 * 446 *
394 * @param plugin The MXit protocol plugin 447 * @param plugin The MXit protocol plugin
395 * @param context The connection context (if available) 448 * @param context The connection context (if available)
396 * @return The list of plugin actions 449 * @return The list of plugin actions
410 463
411 /* display plugin version */ 464 /* display plugin version */
412 action = purple_plugin_action_new( _( "About..." ), mxit_cb_action_about ); 465 action = purple_plugin_action_new( _( "About..." ), mxit_cb_action_about );
413 m = g_list_append( m, action ); 466 m = g_list_append( m, action );
414 467
468 /* suggested friends */
469 action = purple_plugin_action_new( _( "Suggested friends..." ), mxit_cb_suggested_friends );
470 m = g_list_append( m, action );
471
472 /* search for users */
473 action = purple_plugin_action_new( _( "Search for Users..." ), mxit_cb_search_begin );
474 m = g_list_append( m, action );
475
415 return m; 476 return m;
416 } 477 }
417 478