pidgin.mxit: 34229344: Only MXit users have profiles, so displa...

andrew.victor at mxit.com andrew.victor at mxit.com
Fri Feb 4 04:55:51 EST 2011


----------------------------------------------------------------------
Revision: 342293440b7089597815dac27b11677a4cef7254
Parent:   f5e415439fcd668fa55f202c719f7d3feecd65bb
Author:   andrew.victor at mxit.com
Date:     02/04/11 04:51:05
Branch:   im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/342293440b7089597815dac27b11677a4cef7254

Changelog: 

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.


Changes against parent f5e415439fcd668fa55f202c719f7d3feecd65bb

  patched  libpurple/protocols/mxit/mxit.c

-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/mxit.c	d03869e405a6c42843598342ebd6f4e09da07add
+++ libpurple/protocols/mxit/mxit.c	0495cd1fab18e79c1a1672224fe3bb635b1e3061
@@ -560,6 +560,8 @@ static void mxit_get_info( PurpleConnect
  */
 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,7 +569,23 @@ static void mxit_get_info( PurpleConnect
 
 	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 );
 }


More information about the Commits mailing list