changeset 29782:81ea740f92a4

Add extra parameter to mxit_send_message() function to indicate if the message should be sent normally or as a MXit command.
author andrew.victor@mxit.com
date Tue, 26 Jan 2010 14:26:22 +0000
parents 232fcf1755d6
children 339c3e5d8ac7
files libpurple/protocols/mxit/multimx.c libpurple/protocols/mxit/mxit.c libpurple/protocols/mxit/protocol.c libpurple/protocols/mxit/protocol.h
diffstat 4 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/multimx.c	Tue Jan 26 14:16:18 2010 +0000
+++ b/libpurple/protocols/mxit/multimx.c	Tue Jan 26 14:26:22 2010 +0000
@@ -304,7 +304,7 @@
 	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 @@
 	}
 
 	/* 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) */
--- a/libpurple/protocols/mxit/mxit.c	Tue Jan 26 14:16:18 2010 +0000
+++ b/libpurple/protocols/mxit/mxit.c	Tue Jan 26 14:26:22 2010 +0000
@@ -58,9 +58,10 @@
 {
 	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 @@
 	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 @@
 				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 @@
 {
 	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 @@
 
 	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 */
--- a/libpurple/protocols/mxit/protocol.c	Tue Jan 26 14:16:18 2010 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Tue Jan 26 14:26:22 2010 +0000
@@ -695,12 +695,12 @@
  *  @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 )
--- a/libpurple/protocols/mxit/protocol.h	Tue Jan 26 14:16:18 2010 +0000
+++ b/libpurple/protocols/mxit/protocol.h	Tue Jan 26 14:26:22 2010 +0000
@@ -273,7 +273,7 @@
 
 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[] );