diff libpurple/protocols/jabber/si.c @ 29612:8f442c566ff2

jabber: Adjust amount of data to send in IBB packets so that at most block-size bytes of BASE64-encoded data is sent, based on discussion on the standars@j.o list. Keep accepting receiving packets containing up to block-size bytes of decoded data to stay compatible with previous version, and other clients who made that assuption.
author Marcus Lundblad <ml@update.uu.se>
date Thu, 18 Mar 2010 21:19:44 +0000
parents 356d1f40a56d
children 9f59abd49def 885ceb384678
line wrap: on
line diff
--- a/libpurple/protocols/jabber/si.c	Wed Mar 17 20:42:48 2010 +0000
+++ b/libpurple/protocols/jabber/si.c	Thu Mar 18 21:19:44 2010 +0000
@@ -1075,6 +1075,9 @@
 				jabber_si_xfer_ibb_error_cb);
 
 			jsx->ibb_session = sess;
+			/* we handle up to block-size bytes of decoded data, to handle
+			 clients interpreting the block-size attribute as that
+			 (see also remark in ibb.c) */
 			jsx->ibb_buffer =
 				purple_circ_buffer_new(jabber_ibb_session_get_block_size(sess));
 
@@ -1103,8 +1106,8 @@
 {
 	JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
 	JabberIBBSession *sess = jsx->ibb_session;
-	gsize packet_size = len < jabber_ibb_session_get_block_size(sess) ?
-		len : jabber_ibb_session_get_block_size(sess);
+	gsize packet_size = len < jabber_ibb_session_get_max_data_size(sess) ?
+		len : jabber_ibb_session_get_max_data_size(sess);
 
 	jabber_ibb_session_send_data(sess, buffer, packet_size);
 
@@ -1170,7 +1173,7 @@
 		purple_xfer_set_write_fnc(xfer, jabber_si_xfer_ibb_write);
 
 		jsx->ibb_buffer =
-			purple_circ_buffer_new(jabber_ibb_session_get_block_size(jsx->ibb_session));
+			purple_circ_buffer_new(jabber_ibb_session_get_max_data_size(jsx->ibb_session));
 
 		/* open the IBB session */
 		jabber_ibb_session_open(jsx->ibb_session);