/pidgin/main: 20d3040431eb: Merge with release-2.x.y (resolved v...

Daniel Atallah datallah at pidgin.im
Tue Apr 2 09:22:06 EDT 2013


Changeset: 20d3040431ebc8dcd3b242bedd3b014ef1c93524
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2013-04-02 09:20 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/20d3040431eb

Description:

Merge with release-2.x.y (resolved various conflicts in mxit)

diffstat:

 ChangeLog                             |   4 +
 libpurple/plugins/ssl/ssl-nss.c       |   4 +-
 libpurple/protocols/irc/Makefile.am   |   2 +-
 libpurple/protocols/mxit/actions.c    |   2 +-
 libpurple/protocols/mxit/filexfer.c   |  38 ++++++++-----
 libpurple/protocols/mxit/formcmds.c   |   4 +-
 libpurple/protocols/mxit/login.c      |   2 +-
 libpurple/protocols/mxit/markup.c     |   4 +-
 libpurple/protocols/mxit/profile.h    |   2 +-
 libpurple/protocols/mxit/protocol.c   |  96 +++++++++++++++++-----------------
 libpurple/protocols/mxit/roster.c     |   4 +-
 libpurple/protocols/mxit/roster.h     |   2 +-
 libpurple/protocols/mxit/voicevideo.c |   2 +-
 libpurple/win32/global.mak            |   2 +-
 14 files changed, 91 insertions(+), 77 deletions(-)

diffs (truncated from 647 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -57,6 +57,10 @@ version 3.0.0 (??/??/????):
 	* The Offline Message Emulation plugin now adds a note that the message
 	  was an offline message. (Flavius Anton) (#2497)
 
+	Windows-Specific Changes:
+	* Updates to dependencies:
+		* NSS 3.14.3 and NSPR 4.9.5
+
 version 2.10.7 (02/13/2013):
 	Alien hatchery:
 	* No changes
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/irc/Makefile.am b/libpurple/protocols/irc/Makefile.am
--- a/libpurple/protocols/irc/Makefile.am
+++ b/libpurple/protocols/irc/Makefile.am
@@ -27,7 +27,7 @@ else
 st =
 pkg_LTLIBRARIES   = libirc.la
 libirc_la_SOURCES = $(IRCSOURCES)
-libirc_la_LIBADD  = $(GLIB_LIBS)
+libirc_la_LIBADD  = $(GLIB_LIBS) $(SASL_LIBS)
 
 endif
 
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
@@ -186,7 +186,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/filexfer.c b/libpurple/protocols/mxit/filexfer.c
--- a/libpurple/protocols/mxit/filexfer.c
+++ b/libpurple/protocols/mxit/filexfer.c
@@ -153,7 +153,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 +165,17 @@ 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 +440,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
@@ -478,7 +478,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.
@@ -533,7 +533,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/login.c b/libpurple/protocols/mxit/login.c
--- a/libpurple/protocols/mxit/login.c
+++ b/libpurple/protocols/mxit/login.c
@@ -58,7 +58,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
@@ -392,7 +392,7 @@ void mxit_show_message( struct RXMsgData
 			if ( end == mx->msg->len )			/* end of emoticon tag not found */
 				break;
 
-			ii = g_strndup(&mx->msg->str[emo_ofs], end - emo_ofs);
+			ii = g_strndup( &mx->msg->str[emo_ofs], end - emo_ofs );
 
 			/* remove inline image tag */
 			g_string_erase( mx->msg, start, ( end - start ) + 1 );
@@ -411,7 +411,7 @@ void mxit_show_message( struct RXMsgData
 				g_string_insert( mx->msg, start, tag );
 			}
 
-			g_free(ii);
+			g_free( ii );
 		}
 	}
 
diff --git a/libpurple/protocols/mxit/profile.h b/libpurple/protocols/mxit/profile.h
--- a/libpurple/protocols/mxit/profile.h
+++ b/libpurple/protocols/mxit/profile.h
@@ -61,7 +61,7 @@ struct MXitProfile {
 	char		aboutme[513];						/* about me */
 	int			relationship;						/* relationship status */
 
-	int			flags;								/* user's profile flags */
+	gint64		flags;								/* user's profile flags */
 	gint64		lastonline;							/* user's last-online timestamp */
 };
 
diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c
--- a/libpurple/protocols/mxit/protocol.c
+++ b/libpurple/protocols/mxit/protocol.c
@@ -38,6 +38,7 @@
 #include	"login.h"
 #include	"formcmds.h"
 #include	"http.h"
+#include	"cipher.h"
 #include	"voicevideo.h"
 
 
@@ -462,23 +463,23 @@ static void mxit_queue_packet( struct MX
 	packet->headerlen = 0;
 
 	/* create generic packet header */
-	hlen = snprintf( header, sizeof( header ), "id=%s%c", purple_account_get_username( session->acc ), CP_REC_TERM );			/* client msisdn */
+	hlen = g_snprintf( header, sizeof( header ), "id=%s%c", purple_account_get_username( session->acc ), CP_REC_TERM );	/* client mxitid */
 
 	if ( session->http ) {
 		/* http connection only */
-		hlen += sprintf( header + hlen,	"s=" );
+		hlen += g_snprintf( header + hlen, sizeof( header ) - hlen, "s=" );
 		if ( session->http_sesid > 0 ) {
-			hlen += sprintf( header + hlen,	"%u%c", session->http_sesid, CP_FLD_TERM );	/* http session id */
+			hlen += g_snprintf( header + hlen, sizeof( header ) - hlen, "%u%c", session->http_sesid, CP_FLD_TERM );	/* http session id */
 		}
 		session->http_seqno++;
-		hlen += sprintf( header + hlen,	"%u%c", session->http_seqno, CP_REC_TERM );		/* http request sequence id */
+		hlen += g_snprintf( header + hlen, sizeof( header ) - hlen, "%u%c", session->http_seqno, CP_REC_TERM );		/* http request sequence id */
 	}
 
-	hlen += sprintf( header + hlen,	"cm=%i%c", cmd, CP_REC_TERM ); 						/* packet command */
+	hlen += g_snprintf( header + hlen, sizeof( header ) - hlen, "cm=%i%c", cmd, CP_REC_TERM ); 						/* packet command */
 
 	if ( !session->http ) {
 		/* socket connection only */
-		packet->headerlen += sprintf( packet->header, "ln=%i%c", ( datalen + hlen ), CP_REC_TERM );		/* packet length */
+		packet->headerlen = g_snprintf( packet->header, sizeof( packet->header ), "ln=%i%c", ( datalen + hlen ), CP_REC_TERM );		/* packet length */
 	}
 
 	/* copy the header to packet */
@@ -612,7 +613,6 @@ gboolean mxit_manage_polling( gpointer u
 	struct MXitSession* session		= (struct MXitSession*) user_data;
 	gboolean			poll		= FALSE;
 	gint64				now			= mxit_now_milli();
-	int					polldiff;
 	gint64				rxdiff;
 
 	if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) {
@@ -622,7 +622,6 @@ gboolean mxit_manage_polling( gpointer u
 
 	/* calculate the time differences */
 	rxdiff = now - session->last_rx;
-	polldiff = now - session->http_last_poll;
 
 	if ( rxdiff < MXIT_HTTP_POLL_MIN ) {
 		/* we received some reply a few moments ago, so reset the poll interval */
@@ -639,7 +638,7 @@ gboolean mxit_manage_polling( gpointer u
 	}
 
 	/* debugging */
-	//purple_debug_info( MXIT_PLUGIN_ID, "POLL TIMER: %i (%i,%i)\n", session->http_interval, rxdiff, polldiff );
+	//purple_debug_info( MXIT_PLUGIN_ID, "POLL TIMER: %i (%i)\n", session->http_interval, rxdiff );
 
 	if ( poll ) {
 		/* send poll request */
@@ -717,7 +716,7 @@ void mxit_send_register( struct MXitSess
 	clientVersion = g_strdup_printf( "%c-%i.%i.%i-%s-%s", MXIT_CP_DISTCODE, PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, MXIT_CP_ARCH, MXIT_CP_PLATFORM );
 
 	/* convert the packet to a byte stream */
-	datalen = snprintf( data, sizeof( data ),
+	datalen = g_snprintf( data, sizeof( data ),
 								"ms=%s%c%s%c%i%c%s%c"		/* "ms"=password\1version\1maxreplyLen\1name\1 */
 								"%s%c%i%c%s%c%s%c"			/* dateOfBirth\1gender\1location\1capabilities\1 */
 								"%s%c%i%c%s%c%s"			/* dc\1features\1dialingcode\1locale */
@@ -761,7 +760,7 @@ void mxit_send_login( struct MXitSession
 	clientVersion = g_strdup_printf( "%c-%i.%i.%i-%s-%s", MXIT_CP_DISTCODE, PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, MXIT_CP_ARCH, MXIT_CP_PLATFORM );
 
 	/* convert the packet to a byte stream */
-	datalen = snprintf( data, sizeof( data ),
+	datalen = g_snprintf( data, sizeof( data ),
 								"ms=%s%c%s%c%i%c"			/* "ms"=password\1version\1getContacts\1 */
 								"%s%c%s%c%i%c"				/* capabilities\1dc\1features\1 */
 								"%s%c%s%c"					/* dialingcode\1locale\1 */
@@ -775,7 +774,7 @@ void mxit_send_login( struct MXitSession
 	/* include "custom resource" information */
 	splashId = splash_current( session );
 	if ( splashId != NULL )
-		datalen += sprintf( data + datalen, "%ccr=%s", CP_REC_TERM, splashId );
+		datalen += g_snprintf( data + datalen, sizeof( data ) - datalen, "%ccr=%s", CP_REC_TERM, splashId );
 
 	/* queue packet for transmission */
 	mxit_queue_packet( session, data, datalen, CP_CMD_LOGIN );
@@ -805,7 +804,7 @@ void mxit_send_message( struct MXitSessi
 		markuped_msg = g_strdup( msg );
 
 	/* convert the packet to a byte stream */
-	datalen = snprintf( data, sizeof( data ),
+	datalen = g_snprintf( data, sizeof( data ),
 								"ms=%s%c%s%c%i%c%i",		/* "ms"=jid\1msg\1type\1flags */
 								to, CP_FLD_TERM, markuped_msg, CP_FLD_TERM, msgtype, CP_FLD_TERM, CP_MSG_MARKUP | CP_MSG_EMOTICON
 	);
@@ -832,14 +831,14 @@ void mxit_send_extprofile_request( struc
 	int				datalen;
 	unsigned int	i;
 
-	datalen = snprintf( data, sizeof( data ),
+	datalen = g_snprintf( data, sizeof( data ),
 								"ms=%s%c%i",		/* "ms="mxitid\1nr_attributes */
 								( username ? username : "" ), CP_FLD_TERM, nr_attrib
 	);
 



More information about the Commits mailing list