/pidgin/main: 07ffa66fd57b: Merge with release-2.x.y

Andrew Victor andrew.victor at mxit.com
Wed Apr 3 05:23:37 EDT 2013


Changeset: 07ffa66fd57bea965861eada6129e8224dfea329
Author:	 Andrew Victor <andrew.victor at mxit.com>
Date:	 2013-04-03 11:21 +0200
Branch:	 mxit-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/07ffa66fd57b

Description:

Merge with release-2.x.y

diffstat:

 libpurple/plugins/ssl/ssl-nss.c         |    4 +-
 libpurple/protocols/mxit/actions.c      |    7 +-
 libpurple/protocols/mxit/chunk.c        |    5 +-
 libpurple/protocols/mxit/cipher.c       |   36 ++++----
 libpurple/protocols/mxit/filexfer.c     |   44 +++++++----
 libpurple/protocols/mxit/formcmds.c     |    8 +-
 libpurple/protocols/mxit/formcmds.h     |    4 +-
 libpurple/protocols/mxit/http.c         |    4 +-
 libpurple/protocols/mxit/login.c        |    8 +-
 libpurple/protocols/mxit/markup.c       |   24 +++---
 libpurple/protocols/mxit/multimx.c      |    3 +-
 libpurple/protocols/mxit/mxit.c         |    8 +-
 libpurple/protocols/mxit/profile.c      |    3 +-
 libpurple/protocols/mxit/profile.h      |    4 +-
 libpurple/protocols/mxit/protocol.c     |  117 ++++++++++++++++---------------
 libpurple/protocols/mxit/roster.c       |   10 +-
 libpurple/protocols/mxit/roster.h       |    2 +-
 libpurple/protocols/mxit/splashscreen.c |    4 +-
 libpurple/protocols/mxit/voicevideo.c   |    5 +-
 libpurple/protocols/mxit/voicevideo.h   |    5 -
 20 files changed, 155 insertions(+), 150 deletions(-)

diffs (truncated from 984 to 300 lines):

diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c
--- a/libpurple/plugins/ssl/ssl-nss.c
+++ b/libpurple/plugins/ssl/ssl-nss.c
@@ -473,7 +473,7 @@ ssl_nss_close(PurpleSslConnection *gsc)
 static size_t
 ssl_nss_read(PurpleSslConnection *gsc, void *data, size_t len)
 {
-	ssize_t ret;
+	PRInt32 ret;
 	PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc);
 
 	ret = PR_Read(nss_data->in, data, len);
@@ -487,7 +487,7 @@ ssl_nss_read(PurpleSslConnection *gsc, v
 static size_t
 ssl_nss_write(PurpleSslConnection *gsc, const void *data, size_t len)
 {
-	ssize_t ret;
+	PRInt32 ret;
 	PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc);
 
 	if(!nss_data)
diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c
--- a/libpurple/protocols/mxit/actions.c
+++ b/libpurple/protocols/mxit/actions.c
@@ -23,8 +23,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include    "internal.h"
-#include	"purple.h"
+#include	"internal.h"
+#include	"debug.h"
+#include	"request.h"
 
 #include	"protocol.h"
 #include	"mxit.h"
@@ -186,7 +187,7 @@ out:
 			profile->flags &= ~CP_PROF_NOT_SUGGESTABLE;
 		else
 			profile->flags |= CP_PROF_NOT_SUGGESTABLE;
-		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%i", CP_PROFILE_FLAGS, CP_PROFILE_TYPE_LONG, profile->flags);
+		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%" G_GINT64_FORMAT, CP_PROFILE_FLAGS, CP_PROFILE_TYPE_LONG, profile->flags);
 		g_string_append( attributes, attrib );
 		acount++;
 
diff --git a/libpurple/protocols/mxit/chunk.c b/libpurple/protocols/mxit/chunk.c
--- a/libpurple/protocols/mxit/chunk.c
+++ b/libpurple/protocols/mxit/chunk.c
@@ -23,8 +23,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include    "internal.h"
-#include	"purple.h"
+#include	"internal.h"
+#include	"debug.h"
+
 #include	"protocol.h"
 #include	"mxit.h"
 #include	"chunk.h"
diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c
--- a/libpurple/protocols/mxit/cipher.c
+++ b/libpurple/protocols/mxit/cipher.c
@@ -23,8 +23,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include    "internal.h"
-#include	"purple.h"
+#include	"internal.h"
+#include	"debug.h"
 
 #include	"mxit.h"
 #include	"cipher.h"
@@ -107,12 +107,12 @@ static char* transport_layer_key( struct
  */
 char* mxit_encrypt_password( struct MXitSession* session )
 {
-	char		key[16 + 1];
-	char		exkey[512];
-	GString*	pass			= NULL;
-	GString*	encrypted		= NULL;
-	char*		base64;
-	int			i;
+	char			key[16 + 1];
+	char			exkey[512];
+	GString*		pass			= NULL;
+	GString*		encrypted		= NULL;
+	char*			base64;
+	unsigned int	i;
 
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_encrypt_password\n" );
 
@@ -154,11 +154,11 @@ char* mxit_encrypt_password( struct MXit
  */
 char* mxit_decrypt_message( struct MXitSession* session, char* message )
 {
-	guchar*		raw_message;
-	gsize		raw_len;
-	char		exkey[512];
-	GString*	decoded		= NULL;
-	int			i;
+	guchar*			raw_message;
+	gsize			raw_len;
+	char			exkey[512];
+	GString*		decoded		= NULL;
+	unsigned int	i;
 
 	/* remove optional header: <mxitencrypted ver="5.2"/> */
 	if ( strncmp( message, ENCRYPT_HEADER, strlen( ENCRYPT_HEADER ) ) == 0 )
@@ -209,11 +209,11 @@ char* mxit_decrypt_message( struct MXitS
  */
 char* mxit_encrypt_message( struct MXitSession* session, char* message )
 {
-	GString*	raw_message	= NULL;
-	char		exkey[512];
-	GString*	encoded		= NULL;
-	gchar*		base64;
-	int			i;
+	GString*		raw_message	= NULL;
+	char			exkey[512];
+	GString*		encoded		= NULL;
+	gchar*			base64;
+	unsigned int	i;
 
 	purple_debug_info( MXIT_PLUGIN_ID, "encrypt message: '%s'\n", message );
 
diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c
--- a/libpurple/protocols/mxit/filexfer.c
+++ b/libpurple/protocols/mxit/filexfer.c
@@ -23,8 +23,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include    "internal.h"
-#include	"purple.h"
+#include	"internal.h"
+#include	"debug.h"
+
 #include	"protocol.h"
 #include	"mxit.h"
 #include	"chunk.h"
@@ -97,7 +98,7 @@ const char* file_mime_type( const char* 
  */
 static void mxit_xfer_free( PurpleXfer* xfer )
 {
-	struct mxitxfer*	mx	= (struct mxitxfer*) xfer->data;;
+	struct mxitxfer*	mx		= (struct mxitxfer*) xfer->data;;
 
 	if ( mx ) {
 		g_free( mx );
@@ -153,7 +154,6 @@ static void mxit_xfer_start( PurpleXfer*
 {
 	goffset			filesize;
 	unsigned char*	buffer;
-	int				size;
 	int				wrote;
 
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_start\n" );
@@ -166,12 +166,18 @@ static void mxit_xfer_start( PurpleXfer*
 		 */
 		filesize = purple_xfer_get_bytes_remaining( xfer );
 		buffer = g_malloc( filesize );
-		size = fread( buffer, filesize, 1, xfer->dest_fp );
-		// TODO: If (size != 1) -> file read error
 
-		wrote = purple_xfer_write( xfer, buffer, filesize );
-		if ( wrote > 0 )
-			purple_xfer_set_bytes_sent( xfer, wrote );
+		if ( fread( buffer, filesize, 1, xfer->dest_fp ) > 0 ) {
+			/* send data */
+			wrote = purple_xfer_write( xfer, buffer, filesize );
+			if ( wrote > 0 )
+				purple_xfer_set_bytes_sent( xfer, wrote );
+		}
+		else {
+			/* file read error */
+			purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "Unable to access the local file" ) );
+			purple_xfer_cancel_local( xfer );
+		}
 
 		/* free the buffer */
 		g_free( buffer );
@@ -436,14 +442,20 @@ void mxit_xfer_rx_file( struct MXitSessi
 		/* this is the transfer we have been looking for */
 		purple_xfer_ref( xfer );
 		purple_xfer_start( xfer, -1, NULL, 0 );
-		fwrite( data, datalen, 1, xfer->dest_fp );
-		// TODO: Handle error from fwrite()
-		purple_xfer_unref( xfer );
-		purple_xfer_set_completed( xfer, TRUE );
-		purple_xfer_end( xfer );
 
-		/* inform MXit that file was successfully received */
-		mxit_send_file_received( session, fileid, RECV_STATUS_SUCCESS );
+		if ( fwrite( data, datalen, 1, xfer->dest_fp ) > 0 ) {
+			purple_xfer_unref( xfer );
+			purple_xfer_set_completed( xfer, TRUE );
+			purple_xfer_end( xfer );
+
+			/* inform MXit that file was successfully received */
+			mxit_send_file_received( session, fileid, RECV_STATUS_SUCCESS );
+		}
+		else {
+			/* file write error */
+			purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "Unable to save the file" ) );
+			purple_xfer_cancel_local( xfer );
+		}
 	}
 	else {
 		/* file transfer not found */
diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c
--- a/libpurple/protocols/mxit/formcmds.c
+++ b/libpurple/protocols/mxit/formcmds.c
@@ -25,9 +25,7 @@
 
 
 #include "internal.h"
-#include <glib.h>
-
-#include "purple.h"
+#include "debug.h"
 
 #include "protocol.h"
 #include "mxit.h"
@@ -475,7 +473,7 @@ static void command_screeninfo(struct MX
  *   menu ::= <menuitem> { ";" <menuitem> }
  *     menuitem ::= { type "," <text> "," <name> "," <meta> }
  *   colors ::= <color> { ";" <color> }
- *     color ::= <colorid> "," <ARGB hex color>   
+ *     color ::= <colorid> "," <ARGB hex color>
  *
  *  @param session		The MXit session object
  *  @param from			The sender of the message.
@@ -530,7 +528,7 @@ static void command_table(struct RXMsgDa
 
 	/* number of columns */
 	tmp = g_hash_table_lookup(hash, "col");
-	nr_columns = atoi(tmp);	
+	nr_columns = atoi(tmp);
 
 	/* number of rows */
 	tmp = g_hash_table_lookup(hash, "row");
diff --git a/libpurple/protocols/mxit/formcmds.h b/libpurple/protocols/mxit/formcmds.h
--- a/libpurple/protocols/mxit/formcmds.h
+++ b/libpurple/protocols/mxit/formcmds.h
@@ -26,10 +26,8 @@
 #ifndef		_MXIT_FORMCMDS_H_
 #define		_MXIT_FORMCMDS_H_
 
-#include	"mxit.h"
-
+#include	"protocol.h"
 
 int mxit_parse_command(struct RXMsgData* mx, char* message);
 
-
 #endif		/* _MXIT_FORMCMDS_H_ */
diff --git a/libpurple/protocols/mxit/http.c b/libpurple/protocols/mxit/http.c
--- a/libpurple/protocols/mxit/http.c
+++ b/libpurple/protocols/mxit/http.c
@@ -23,8 +23,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include    "internal.h"
-#include	"purple.h"
+#include	"internal.h"
+#include	"debug.h"
 
 #include	"mxit.h"
 #include	"protocol.h"
diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c
--- a/libpurple/protocols/mxit/login.c
+++ b/libpurple/protocols/mxit/login.c
@@ -23,8 +23,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include    "internal.h"
-#include	"purple.h"
+#include	"internal.h"
+#include	"debug.h"
+#include	"request.h"
+#include	"version.h"
 
 #include	"protocol.h"
 #include	"mxit.h"
@@ -57,7 +59,7 @@ static struct MXitSession* mxit_create_o
 		const char* username	= purple_account_get_username( account );
 
 		if ( username[0] == '+' ) {
-			char* fixed	= g_strdup( &username[1] );
+			char* fixed = g_strdup( &username[1] );
 			purple_account_set_username( account, fixed );
 			g_free( fixed );
 		}
diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c
--- a/libpurple/protocols/mxit/markup.c
+++ b/libpurple/protocols/mxit/markup.c



More information about the Commits mailing list