diff libpurple/protocols/mxit/protocol.c @ 31960:c5bdf87770df

* Handle response to SendFile chunk packet, and display the error message if the file transfer failed. * Enable protocol version 6.3.
author andrew.victor@mxit.com
date Tue, 12 Apr 2011 21:25:51 +0000
parents 2e4ac25df4ba
children 98945afd4c44 36a569ed9cdb
line wrap: on
line diff
--- a/libpurple/protocols/mxit/protocol.c	Tue Apr 12 19:59:54 2011 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Tue Apr 12 21:25:51 2011 +0000
@@ -2088,7 +2088,7 @@
 				struct contact* contact = NULL;
 
 				/* decode the chunked data */
-				memset( &chunk, 0, sizeof ( struct getavatar_chunk ) );
+				memset( &chunk, 0, sizeof( struct getavatar_chunk ) );
 				mxit_chunk_parse_get_avatar( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk );
 
 				/* update avatar image */
@@ -2114,7 +2114,18 @@
 			break;
 
 		case CP_CHUNK_DIRECT_SND :
-			/* this is a ack for a file send. no action is required */
+			/* this is a ack for a file send. */
+			{
+				struct sendfile_chunk chunk;
+
+				memset( &chunk, 0, sizeof( struct sendfile_chunk ) );
+				mxit_chunk_parse_sendfile( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk );
+
+				purple_debug_info( MXIT_PLUGIN_ID, "file-send send to '%s' [status=%i message='%s']\n", chunk.username, chunk.status, chunk.statusmsg );
+
+				if ( chunk.status != 0 )	/* not success */
+					mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "File Send Failed" ), chunk.statusmsg );
+			}
 			break;
 
 		case CP_CHUNK_RECEIVED :
@@ -2285,6 +2296,7 @@
 				/* HTTP poll reply */
 		case CP_CMD_EXTPROFILE_SET :
 				/* profile update */
+				// TODO: Protocol 6.2 indicates status for each attribute, and current value.
 		case CP_CMD_SPLASHCLICK :
 				/* splash-screen clickthrough */
 		case CP_CMD_MSGEVENT :