pidgin.mxit: 097880e0: Remove the MXit-specific Mood management...

andrew.victor at mxit.com andrew.victor at mxit.com
Tue May 11 07:46:19 EDT 2010


-----------------------------------------------------------------
Revision: 097880e091f755dd2289d39384e44f8ae4e33589
Ancestor: 9fd6727a9e8f5388546f6fe29fba676b6c796848
Author: andrew.victor at mxit.com
Date: 2010-05-11T11:40:59
Branch: im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/097880e091f755dd2289d39384e44f8ae4e33589

Modified files:
        libpurple/protocols/mxit/actions.c
        libpurple/protocols/mxit/mxit.c
        libpurple/protocols/mxit/mxit.h

ChangeLog: 

Remove the MXit-specific Mood management code.  We now use the libpurple Mood (Status) API.


-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/actions.c	adea1cc7bf4b821e7ef4742c9b9d86c3a6f333be
+++ libpurple/protocols/mxit/actions.c	0e6f3a32ce231e9b5cef1e7b5b7b42c881b205a8
@@ -35,90 +35,7 @@
 #include	"profile.h"
 
 
-/* MXit Moods */
-static const char*	moods[] = {
-	/* 0 */		N_("None"),
-	/* 1 */		N_("Angry"),
-	/* 2 */		N_("Excited"),
-	/* 3 */		N_("Grumpy"),
-	/* 4 */		N_("Happy"),
-	/* 5 */		N_("In Love"),
-	/* 6 */		N_("Invincible"),
-	/* 7 */		N_("Sad"),
-	/* 8 */		N_("Hot"),
-	/* 9 */		N_("Sick"),
-	/* 10 */	N_("Sleepy")
-};
-
-
 /*------------------------------------------------------------------------
- * The user has selected to change their current mood.
- *
- *  @param gc		The connection object
- *  @param fields	The fields from the request pop-up
- */
-static void mxit_cb_set_mood( PurpleConnection* gc, PurpleRequestFields* fields )
-{
-	struct MXitSession*		session	= (struct MXitSession*) gc->proto_data;
-	int						mood	= purple_request_fields_get_choice( fields, "mood" );
-
-	purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_set_mood (%i)\n", mood );
-
-	if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) {
-		purple_debug_error( MXIT_PLUGIN_ID, "Unable to set mood; account offline.\n" );
-		return;
-	}
-
-	/* Save the new mood in session */
-	session->mood = mood;
-
-	/* now send the update to MXit */
-	mxit_send_mood( session, mood );
-}
-
-
-/*------------------------------------------------------------------------
- * Create and display the mood selection window to the user.
- *
- *  @param action	The action object
- */
-static void mxit_cb_action_mood( PurplePluginAction* action )
-{
-	PurpleConnection*			gc		= (PurpleConnection*) action->context;
-	struct MXitSession*			session	= (struct MXitSession*) gc->proto_data;
-
-	PurpleRequestFields*		fields	= NULL;
-	PurpleRequestFieldGroup*	group	= NULL;
-	PurpleRequestField*			field	= NULL;
-	unsigned int				i		= 0;
-
-	purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_action_mood\n" );
-
-	fields = purple_request_fields_new();
-	group = purple_request_field_group_new( NULL );
-	purple_request_fields_add_group( fields, group );
-
-	/* show current mood */
-	field = purple_request_field_string_new( "current", _( "Current Mood" ), _( moods[session->mood] ), FALSE );
-	purple_request_field_string_set_editable( field, FALSE );	/* current mood field is not editable */
-	purple_request_field_group_add_field( group, field );
-
-	/* add all moods to list */
-	field = purple_request_field_choice_new( "mood", _( "New Mood" ), 0 );
-	for ( i = 0; i < ARRAY_SIZE( moods ); i++ ) {
-		purple_request_field_choice_add( field, _( moods[i] ) );
-	}
-	purple_request_field_set_required( field, TRUE );
-	purple_request_field_choice_set_default_value( field, session->mood );
-	purple_request_field_group_add_field( group, field );
-
-	/* (reference: "libpurple/request.h") */
-	purple_request_fields( gc, _( "Mood" ), _( "Change your Mood" ), _( "How do you feel right now?" ), fields, _( "Set" ),
-			G_CALLBACK( mxit_cb_set_mood ), _( "Cancel" ), NULL, purple_connection_get_account( gc ), NULL, NULL, gc );
-}
-
-
-/*------------------------------------------------------------------------
  * The user has selected to change their profile.
  *
  *  @param gc		The connection object
@@ -409,10 +326,6 @@ GList* mxit_actions( PurplePlugin* plugi
 	PurplePluginAction*		action	= NULL;
 	GList*					m		= NULL;
 
-	/* display / change mood */
-	action = purple_plugin_action_new( _( "Change Mood..." ), mxit_cb_action_mood );
-	m = g_list_append( m, action );
-
 	/* display / change profile */
 	action = purple_plugin_action_new( _( "Change Profile..." ), mxit_cb_action_profile );
 	m = g_list_append( m, action );
============================================================
--- libpurple/protocols/mxit/mxit.c	142ec3f63138fd3f6d88077230b4ec1d38594d16
+++ libpurple/protocols/mxit/mxit.c	c91a0908ac177c19330e4a5b746397e50158f5d1
@@ -434,9 +434,7 @@ static void mxit_set_status( PurpleAccou
 			return;
 		}
 
-		/* Save the new mood in session */
-		session->mood = mood;
-
+		/* update mood state */
 		mxit_send_mood( session, mood );
 		return;
 	}
============================================================
--- libpurple/protocols/mxit/mxit.h	71a6194340d2f05b7dbda50d770fcae1acb8259b
+++ libpurple/protocols/mxit/mxit.h	71ae90364998a34482927ea0de93885242d697c8
@@ -151,7 +151,6 @@ struct MXitSession {
 
 	/* personal (profile) */
 	struct MXitProfile*	profile;					/* user's profile information */
-	int					mood;						/* user's current mood */
 
 	/* libpurple */
 	PurpleAccount*		acc;						/* pointer to the libpurple internal account struct */


More information about the Commits mailing list