pidgin.mxit: aa744956: The default state on the MXit server whe...

andrew.victor at mxit.com andrew.victor at mxit.com
Thu Feb 11 01:56:23 EST 2010


-----------------------------------------------------------------
Revision: aa744956c26a0b9017c0113aa4d431f6381ebeec
Ancestor: e97249f055babca2f0303bed22ec6eccaa671b94
Author: andrew.victor at mxit.com
Date: 2010-01-26T14:16:18
Branch: im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/aa744956c26a0b9017c0113aa4d431f6381ebeec

Modified files:
        libpurple/protocols/mxit/protocol.c

ChangeLog: 

The default state on the MXit server when connecting is Available (with no status message),
but Pidgin might be configured to remember the last presence state.
So after login, if the presence is not Available or if a Status message has been set
then we need to send a Status update packet to the MXit servers.

Pidgin also use a HTML-style encoding for the status message.  In the situation above they also
need to be de-HTML'ified first.


-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/protocol.c	3c52bd53fae254ff177fa58e9d3edd6d63e2ab72
+++ libpurple/protocols/mxit/protocol.c	3b0ef5b4a2ab3c535b4620b218cdeac3676adbca
@@ -1254,6 +1254,7 @@ static void mxit_parse_cmd_login( struct
 {
 	PurpleStatus*	status;
 	int				presence;
+	const char*		statusmsg;
 	const char*		profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME,
 									CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL,
 									CP_PROFILE_MOBILENR };
@@ -1272,13 +1273,21 @@ static void mxit_parse_cmd_login( struct
 	/* update presence status */
 	status = purple_account_get_active_status( session->acc );
 	presence = mxit_convert_presence( purple_status_get_id( status ) );
-	if ( presence != MXIT_PRESENCE_ONLINE ) {
+	statusmsg = purple_status_get_attr_string( status, "message" );
+
+	if ( ( presence != MXIT_PRESENCE_ONLINE ) || ( statusmsg ) ) {
 		/* when logging into MXit, your default presence is online. but with the UI, one can change
 		 * the presence to whatever. in the case where its changed to a different presence setting
 		 * we need to send an update to the server, otherwise the user's presence will be out of
 		 * sync between the UI and MXit.
 		 */
-		mxit_send_presence( session, presence, purple_status_get_attr_string( status, "message" ) );
+		char* statusmsg1 = purple_markup_strip_html( statusmsg );
+		char* statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG );
+
+		mxit_send_presence( session, presence, statusmsg2 );
+
+		g_free( statusmsg1 );
+		g_free( statusmsg2 );
 	}
 
 	/* save extra info if this is a HTTP connection */


More information about the Commits mailing list