comparison libpurple/protocols/mxit/mxit.c @ 31299:8cddae054791

Only MXit users have profiles, so display a better message when "Get Info" is selected for non-users. Pidgin unfortunately still pops up the "Buddy Information" notification window.
author andrew.victor@mxit.com
date Fri, 04 Feb 2011 09:51:05 +0000
parents 02b510d2d014
children 7c33eaed54e5
comparison
equal deleted inserted replaced
31298:02b510d2d014 31299:8cddae054791
558 * @param gc The connection object 558 * @param gc The connection object
559 * @param who The username of the contact. 559 * @param who The username of the contact.
560 */ 560 */
561 static void mxit_get_info( PurpleConnection *gc, const char *who ) 561 static void mxit_get_info( PurpleConnection *gc, const char *who )
562 { 562 {
563 PurpleBuddy* buddy;
564 struct contact* contact;
563 struct MXitSession* session = (struct MXitSession*) gc->proto_data; 565 struct MXitSession* session = (struct MXitSession*) gc->proto_data;
564 const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, 566 const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME,
565 CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN, 567 CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN,
566 CP_PROFILE_STATUS, CP_PROFILE_AVATAR }; 568 CP_PROFILE_STATUS, CP_PROFILE_AVATAR };
567 569
568 purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_info: '%s'\n", who ); 570 purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_info: '%s'\n", who );
569 571
572 /* find the buddy information for this contact (reference: "libpurple/blist.h") */
573 buddy = purple_find_buddy( session->acc, who );
574 if ( !buddy ) {
575 purple_debug_warning( MXIT_PLUGIN_ID, "mxit_get_info: unable to find the buddy '%s'\n", who );
576 return;
577 }
578
579 contact = purple_buddy_get_protocol_data( buddy );
580 if ( !contact )
581 return;
582
583 /* only MXit users have profiles */
584 if ( contact->type != MXIT_TYPE_MXIT ) {
585 mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "No profile available" ), _( "This contact does not have a profile." ) );
586 return;
587 }
570 588
571 /* send profile request */ 589 /* send profile request */
572 mxit_send_extprofile_request( session, who, ARRAY_SIZE( profilelist ), profilelist ); 590 mxit_send_extprofile_request( session, who, ARRAY_SIZE( profilelist ), profilelist );
573 } 591 }
574 592