# HG changeset patch # User andrew.victor@mxit.com # Date 1296813065 0 # Node ID 8cddae0547913eeb6d70b0530763705fa3ce42dd # Parent 02b510d2d01423d55f8dce4820ddeef04d19e9e2 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. diff -r 02b510d2d014 -r 8cddae054791 libpurple/protocols/mxit/mxit.c --- a/libpurple/protocols/mxit/mxit.c Fri Feb 04 09:13:46 2011 +0000 +++ b/libpurple/protocols/mxit/mxit.c Fri Feb 04 09:51:05 2011 +0000 @@ -560,6 +560,8 @@ */ static void mxit_get_info( PurpleConnection *gc, const char *who ) { + PurpleBuddy* buddy; + struct contact* contact; struct MXitSession* session = (struct MXitSession*) gc->proto_data; const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN, @@ -567,6 +569,22 @@ purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_info: '%s'\n", who ); + /* find the buddy information for this contact (reference: "libpurple/blist.h") */ + buddy = purple_find_buddy( session->acc, who ); + if ( !buddy ) { + purple_debug_warning( MXIT_PLUGIN_ID, "mxit_get_info: unable to find the buddy '%s'\n", who ); + return; + } + + contact = purple_buddy_get_protocol_data( buddy ); + if ( !contact ) + return; + + /* only MXit users have profiles */ + if ( contact->type != MXIT_TYPE_MXIT ) { + mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "No profile available" ), _( "This contact does not have a profile." ) ); + return; + } /* send profile request */ mxit_send_extprofile_request( session, who, ARRAY_SIZE( profilelist ), profilelist );