/pidgin/main: 74bc66c67211: Merge from /pidgin/main using "hg pu...

Mark Doliner mark at kingant.net
Tue Jan 28 10:38:08 EST 2014


Changeset: 74bc66c67211b31f7c48578ad3d0d99c9a7f8b18
Author:	 Mark Doliner <mark at kingant.net>
Date:	 2013-04-03 22:55 -0700
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/74bc66c67211

Description:

Merge from /pidgin/main using "hg pull https://hg.pidgin.im/pidgin/main"
No conflicts.

diffstat:

 libpurple/plugins/ssl/ssl-nss.c         |    4 +-
 libpurple/protocols/mxit/actions.c      |   37 ++++----
 libpurple/protocols/mxit/chunk.c        |    5 +-
 libpurple/protocols/mxit/cipher.c       |   36 ++++----
 libpurple/protocols/mxit/filexfer.c     |   53 +++++++----
 libpurple/protocols/mxit/formcmds.c     |   12 +-
 libpurple/protocols/mxit/formcmds.h     |    4 +-
 libpurple/protocols/mxit/http.c         |    4 +-
 libpurple/protocols/mxit/login.c        |   57 ++++++++-----
 libpurple/protocols/mxit/markup.c       |   24 ++--
 libpurple/protocols/mxit/multimx.c      |    5 +-
 libpurple/protocols/mxit/mxit.c         |   53 +++++------
 libpurple/protocols/mxit/mxit.h         |    2 +-
 libpurple/protocols/mxit/profile.c      |   15 +-
 libpurple/protocols/mxit/profile.h      |    4 +-
 libpurple/protocols/mxit/protocol.c     |  137 ++++++++++++++++---------------
 libpurple/protocols/mxit/roster.c       |   68 +++++++-------
 libpurple/protocols/mxit/roster.h       |    2 +-
 libpurple/protocols/mxit/splashscreen.c |   12 +-
 libpurple/protocols/mxit/voicevideo.c   |    9 +-
 libpurple/protocols/mxit/voicevideo.h   |    5 -
 po/de.po                                |   12 ++-
 22 files changed, 289 insertions(+), 271 deletions(-)

diffs (truncated from 1745 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"
@@ -43,7 +44,7 @@
  */
 static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields )
 {
-	struct MXitSession*		session	= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*		session	= purple_connection_get_protocol_data( gc );
 	PurpleRequestField*		field	= NULL;
 	const char*				name	= NULL;
 	const char*				bday	= NULL;
@@ -159,7 +160,7 @@ out:
 
 		/* update where am i */
 		name = purple_request_fields_get_string( fields, "whereami" );
-		if ( !name)
+		if ( !name )
 			profile->whereami[0] = '\0';
 		else
 			g_strlcpy( profile->whereami, name, sizeof( profile->whereami ) );
@@ -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++;
 
@@ -209,7 +210,7 @@ out:
 static void mxit_profile_action( PurplePluginAction* action )
 {
 	PurpleConnection*			gc		= (PurpleConnection*) action->context;
-	struct MXitSession*			session	= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*			session	= purple_connection_get_protocol_data( gc );
 	struct MXitProfile*			profile	= session->profile;
 
 	PurpleRequestFields*		fields	= NULL;
@@ -322,7 +323,7 @@ static void mxit_profile_action( PurpleP
  */
 static void mxit_change_pin_cb( PurpleConnection* gc, PurpleRequestFields* fields )
 {
-	struct MXitSession*		session	= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*		session	= purple_connection_get_protocol_data( gc );
 	const char*				pin		= NULL;
 	const char*				pin2	= NULL;
 	const char*				err		= NULL;
@@ -384,7 +385,7 @@ out:
 static void mxit_change_pin_action( PurplePluginAction* action )
 {
 	PurpleConnection*			gc		= (PurpleConnection*) action->context;
-	struct MXitSession*			session	= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*			session	= purple_connection_get_protocol_data( gc );
 
 	PurpleRequestFields*		fields	= NULL;
 	PurpleRequestFieldGroup*	group	= NULL;
@@ -393,16 +394,16 @@ static void mxit_change_pin_action( Purp
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_change_pin_action\n" );
 
 	fields = purple_request_fields_new();
-	group = purple_request_field_group_new(NULL);
-	purple_request_fields_add_group(fields, group);
+	group = purple_request_field_group_new( NULL );
+	purple_request_fields_add_group( fields, group );
 
 	/* pin */
-	field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE );
+	field = purple_request_field_string_new( "pin", _( "PIN" ), purple_account_get_password( session->acc ), FALSE );
 	purple_request_field_string_set_masked( field, TRUE );
 	purple_request_field_group_add_field( group, field );
 
 	/* verify pin */
-	field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), session->acc->password, FALSE );
+	field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), purple_account_get_password( session->acc ), FALSE );
 	purple_request_field_string_set_masked( field, TRUE );
 	purple_request_field_group_add_field( group, field );
 
@@ -420,7 +421,7 @@ static void mxit_change_pin_action( Purp
 static void mxit_splash_action( PurplePluginAction* action )
 {
 	PurpleConnection*		gc		= (PurpleConnection*) action->context;
-	struct MXitSession*		session	= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*		session	= purple_connection_get_protocol_data( gc );
 
 	if ( splash_current( session ) != NULL )
 		splash_display( session );
@@ -457,7 +458,7 @@ static void mxit_about_action( PurplePlu
 static void mxit_suggested_friends_action( PurplePluginAction* action )
 {
 	PurpleConnection*		gc				= (PurpleConnection*) action->context;
-	struct MXitSession*		session			= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*		session			= purple_connection_get_protocol_data( gc );
 	const char*				profilelist[]	= {
 				CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME,
 				CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR,
@@ -474,7 +475,7 @@ static void mxit_suggested_friends_actio
  */
 static void mxit_user_search_cb( PurpleConnection *gc, const char *input )
 {
-	struct MXitSession*		session			= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*		session			= purple_connection_get_protocol_data( gc );
 	const char*				profilelist[]	= {
 				CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME,
 				CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR,
@@ -497,10 +498,10 @@ static void mxit_user_search_action( Pur
 		_( "Search for a MXit contact" ),
 		_( "Type search information" ),
 		NULL, FALSE, FALSE, NULL,
-		_("_Search"), G_CALLBACK( mxit_user_search_cb ),
-		_("_Cancel"), NULL,
+		_( "_Search" ), G_CALLBACK( mxit_user_search_cb ),
+		_( "_Cancel" ), NULL,
 		purple_connection_get_account( gc ), NULL, NULL,
-		gc);
+		gc );
 }
 
 
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"
@@ -126,7 +127,7 @@ static void mxit_xfer_init( PurpleXfer* 
 
 		if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) {
 			/* the file is too big */
-			purple_xfer_error( xfer->type, xfer->account, xfer->who, _( "The file you are trying to send is too large!" ) );
+			purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "The file you are trying to send is too large!" ) );
 			purple_xfer_cancel_local( xfer );
 			return;
 		}
@@ -151,8 +152,8 @@ static void mxit_xfer_init( PurpleXfer* 
  */
 static void mxit_xfer_start( PurpleXfer* xfer )
 {
+	goffset			filesize;
 	unsigned char*	buffer;
-	int				size;
 	int				wrote;
 
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_start\n" );
@@ -163,12 +164,20 @@ static void mxit_xfer_start( PurpleXfer*
 		 * a buffer and copy the file data into memory and then we can send it to
 		 * the contact. we will send the whole file with one go.
 		 */
-		buffer = g_malloc( xfer->bytes_remaining );
-		size = fread( buffer, xfer->bytes_remaining, 1, xfer->dest_fp );
+		filesize = purple_xfer_get_bytes_remaining( xfer );
+		buffer = g_malloc( filesize );
 
-		wrote = purple_xfer_write( xfer, buffer, xfer->bytes_remaining );
-		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 );
@@ -295,7 +304,7 @@ gboolean mxit_xfer_enabled( PurpleConnec
  */
 PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who )
 {
-	struct MXitSession*	session	= (struct MXitSession*) gc->proto_data;
+	struct MXitSession*	session	= purple_connection_get_protocol_data( gc );



More information about the Commits mailing list