pidgin.mxit: 9b876cae: Add extra parameter to mxit_send_message...

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


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

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

ChangeLog: 

Add extra parameter to mxit_send_message() function to indicate if the message should be
sent normally or as a MXit command.


-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/multimx.c	973c1273866ca16588734287e191d6f9d563497b
+++ libpurple/protocols/mxit/multimx.c	06c5c309a3c16e4cb2842983e0b61aedf5560037
@@ -304,7 +304,7 @@ void multimx_created(struct MXitSession*
 	serv_got_joined_chat(gc, multimx->chatid, multimx->roomname);
 
 	/* Send ".list" command to GroupChat server to retrieve current member-list */
-	mxit_send_message(session, multimx->roomid, ".list", FALSE);
+	mxit_send_message(session, multimx->roomid, ".list", FALSE, FALSE);
 }
 
 
@@ -579,7 +579,7 @@ int mxit_chat_send(PurpleConnection *gc,
 	}
 
 	/* Send packet to MXit */
-	mxit_send_message(session, multimx->roomid, message, TRUE);
+	mxit_send_message(session, multimx->roomid, message, TRUE, FALSE);
 	
 	/* Determine our nickname to display */
 	if (session->profile && (session->profile->nickname[0] != '\0'))		/* default is profile name (since that's what everybody else sees) */
============================================================
--- libpurple/protocols/mxit/mxit.c	c024c1270ddc7c79dc3c293baba14764028d41fd
+++ libpurple/protocols/mxit/mxit.c	2ad2dcee776b332eaeb52b07a129f181de7424ab
@@ -58,9 +58,10 @@ static void* mxit_link_click( const char
 {
 	PurpleAccount*		account;
 	PurpleConnection*	con;
-	gchar**				parts	= NULL;
-	gchar*				link	= NULL;
+	gchar**				parts		= NULL;
+	gchar*				link		= NULL;
 	gsize				len;
+	gboolean			is_command	= FALSE;
 
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_link_click (%s)\n", link64 );
 
@@ -92,7 +93,7 @@ static void* mxit_link_click( const char
 	con = purple_account_get_connection( account );
 
 	/* send click message back to MXit */
-	mxit_send_message( con->proto_data, parts[3], parts[4], FALSE );
+	mxit_send_message( con->proto_data, parts[3], parts[4], FALSE, is_command );
 
 	g_free( link );
 	link = NULL;
@@ -205,7 +206,7 @@ static void mxit_cb_chat_created( Purple
 				tmp = g_strdup_printf("<font color=\"#999999\">%s</font>\n", _( "Loading menu..." ));
 				serv_got_im( session->con, who, tmp, PURPLE_MESSAGE_NOTIFY, time( NULL ) );
 				g_free(tmp);
-				mxit_send_message( session, who, " ", FALSE );
+				mxit_send_message( session, who, " ", FALSE, FALSE );
 		default :
 				break;
 	}
@@ -394,7 +395,7 @@ static int mxit_send_im( PurpleConnectio
 {
 	purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who );
 
-	mxit_send_message( gc->proto_data, who, message, TRUE );
+	mxit_send_message( gc->proto_data, who, message, TRUE, FALSE );
 
 	return 1;		/* echo to conversation window */
 }
@@ -427,6 +428,7 @@ static void mxit_set_status( PurpleAccou
 
 	statusmsg1 = purple_markup_strip_html( purple_status_get_attr_string( status, "message" ) );
 	statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG );
+
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_status: '%s'\n", statusmsg2 );
 
 	/* update presence state */
============================================================
--- libpurple/protocols/mxit/protocol.c	3b0ef5b4a2ab3c535b4620b218cdeac3676adbca
+++ libpurple/protocols/mxit/protocol.c	7ba39be10c1671df49e3da05090a6c89c8de6598
@@ -695,12 +695,12 @@ void mxit_send_login( struct MXitSession
  *  @param to			The username of the recipient
  *  @param msg			The message text
  */
-void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup )
+void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup, gboolean is_command )
 {
 	char		data[CP_MAX_PACKET];
 	char*		markuped_msg;
 	int			datalen;
-	int			msgtype = CP_MSGTYPE_NORMAL;
+	int			msgtype = ( is_command ? CP_MSGTYPE_COMMAND : CP_MSGTYPE_NORMAL );
 
 	/* first we need to convert the markup from libPurple to MXit format */
 	if ( parse_markup )
============================================================
--- libpurple/protocols/mxit/protocol.h	638e3ec5cfa32daff3b14e926834eb157f0f8ffb
+++ libpurple/protocols/mxit/protocol.h	40e8ef662dd35d8cd127a9b3252d4ba036790d3e
@@ -273,7 +273,7 @@ void mxit_send_mood( struct MXitSession*
 
 void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg );
 void mxit_send_mood( struct MXitSession* session, int mood );
-void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup );
+void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup, gboolean is_command );
 
 void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes );
 void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] );


More information about the Commits mailing list