cpw.malu.xmpp.jingle_ft: 8e2028fa: Actually use the block-size the other en...

malu at pidgin.im malu at pidgin.im
Sun May 3 08:15:34 EDT 2009


-----------------------------------------------------------------
Revision: 8e2028fa9c85dfaa7b605469557a8713228b2471
Ancestor: 18ee20836f032092bac7276f458868160c4850e5
Author: malu at pidgin.im
Date: 2009-05-03T12:10:11
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/8e2028fa9c85dfaa7b605469557a8713228b2471

Modified files:
        libpurple/protocols/jabber/jingle/ibbs.c

ChangeLog: 

Actually use the block-size the other end has suggested (if available) when
getting a an IBB transport element.
Remove a couple of formatting warnings.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/ibbs.c	a788c003e6225e37d2b584d16d9ca802b3621221
+++ libpurple/protocols/jabber/jingle/ibbs.c	a7bd93e4a44e1c9834452220b6dc47f2e69b9881
@@ -29,6 +29,7 @@ struct _JingleIBBPrivate {
 	JingleIBBSentCallback *sent_cb;
 	JingleIBBDataCallback *recv_cb;
 	JingleIBBErrorCallback *error_cb;
+	guint block_size;
 };
 
 #define JINGLE_IBB_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_IBB, JingleIBBPrivate))
@@ -164,7 +165,14 @@ jingle_ibb_parse_internal(xmlnode *ibb)
 	xmlnode *jingle = xmlnode_get_parent(xmlnode_get_parent(ibb));
 	const gchar *who = xmlnode_get_attrib(jingle, "initiator");
 	const gchar *sid = xmlnode_get_attrib(ibb, "sid");
-	
+	const gchar *block_size = xmlnode_get_attrib(ibb, "block-size");
+
+	if (block_size) {
+		guint block_size_int = atoi(block_size);
+		purple_debug_info("jingle-ibb", 
+			"got block-size from incoming offer = %d\n", block_size_int);
+		priv->block_size = block_size_int;
+	}
 	return transport;
 }
 
@@ -269,13 +277,18 @@ jingle_ibb_create_session(JingleIBB *ibb
 	/* we will set the IBB session to "open" immediatly, since the Jingle
 	 negotiation defines the "open" state */
 	jabber_ibb_session_set_state(session, JABBER_IBB_SESSION_OPENED);
+	/* if the block size attribute is set, it means we got it from an incoming
+	 request, then set that */
+	if (ibb->priv->block_size) {
+		jabber_ibb_session_set_block_size(session, ibb->priv->block_size);
+	}
 	/* set callbacks... */
 	jabber_ibb_session_set_data_sent_callback(session, 
 		jingle_ibb_data_sent_callback);
 	jabber_ibb_session_set_data_received_callback(session,
 		jingle_ibb_data_recv_callback);
 	jabber_ibb_session_set_error_callback(session, jingle_ibb_error_callback);
-	purple_debug_info("jingle-ibb", "setting session %lx on transport %lx\n",
+	purple_debug_info("jingle-ibb", "setting session %p on transport %p\n",
 		session, ibb);
 	JINGLE_IBB_GET_PRIVATE(ibb)->session = session;
 


More information about the Commits mailing list