/soc/2013/ashmew2/filetransferX: dc15f6826de3: Added gtalk_xfer_...

Ashish Gupta ashmew2 at gmail.com
Wed Aug 7 11:52:30 EDT 2013


Changeset: dc15f6826de3f088c5e7925cac9ba7b06ab00e06
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-08-07 18:53 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/dc15f6826de3

Description:

Added gtalk_xfer_send_* functions

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  73 ++++++++++++++++++++-
 1 files changed, 68 insertions(+), 5 deletions(-)

diffs (103 lines):

diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -1232,17 +1232,74 @@ gtalk_xfer_init(PurpleXfer *xfer)
 	//	purple_xfer_start( xfer, -1, xfer->remote_ip, xfer->remote_port );
 	
 }
+void gtalk_xfer_send_info(JabberStream *js, GoogleSession *session, xmlnode *sess)
+{
+<iq to="doondoon1234 at gmail.com/0E981CDD" type="set" id="163" from="ashmew2 at gmail.com/Talk.v104168E5E46"><session type="info" id="purple92bdb9d8" initiator="doondoon1234 at gmail.com/0E981CDD" xmlns="http://www.google.com/session"><channel name="private-1" xmlns="http://www.google.com/session/share"/></session></iq>
+
+	JabberIq *iq;
+	xmlnode *session_node, *channel_node;
+
+	purple_debug_info("google_session", "Inside google_xfer_send__accept()\n");
+	iq = jabber_iq_new(js, JABBER_IQ_SET);
+	xmlnode_set_attrib(iq->node, "to", session->remote_jid);
+	
+	session_node = xmlnode_new_child(iq->node, "session");
+	xmlnode_set_attrib(session_node, "type", "info");
+	xmlnode_set_attrib(session_node, "id", xmlnode_get_attrib(sess, "id"));
+	xmlnode_set_attrib(session_node, "initiator", session->remote_jid);
+	xmlnode_set_namespace(session_node, NS_GOOGLE_SESSION);
+	
+	channel_node = xmlnode_new_child(session_node, "channel");
+	xmlnode_set_attrib(channel_node, "name", "private-1");
+	xmlnode_set_namespace(channel_node, NS_GOOGLE_SESSION_SHARE);
+	
+	jabber_iq_send(iq);
+}
+
+void gtalk_xfer_send_accept(JabberStream *js, GoogleSession *session, xmlnode *sess)
+{
+/*
+TODO: CLEAN UP
+<iq to="doondoon1234 at gmail.com/0E981CDD" type="set" id="162" from="ashmew2 at gmail.com/Talk.v104168E5E46"><session type="accept" id="purple92bdb9d8" initiator="doondoon1234 at gmail.com/0E981CDD" xmlns="http://www.google.com/session">
+<description xmlns="http://www.google.com/session/share">
+<manifest/>
+<protocol>
+<http/>
+</protocol>
+</description>
+</session>
+</iq>
+*/
+	JabberIq *iq;
+	xmlnode *session_node, *description_node, *protocol_node;
+
+	purple_debug_info("google_session", "Inside google_xfer_send__accept()\n");
+	iq = jabber_iq_new(js, JABBER_IQ_SET);
+	xmlnode_set_attrib(iq->node, "to", session->remote_jid);
+	
+	session_node = xmlnode_new_child(iq->node, "session");
+	description_node = xmlnode_new_child(session_node, "transport");
+	
+	xmlnode_set_attrib(session_node, "type", "accept");
+	xmlnode_set_attrib(session_node, "id", xmlnode_get_attrib(sess, "id"));
+	xmlnode_set_attrib(session_node, "initiator", session->remote_jid);
+	xmlnode_set_namespace(session_node, NS_GOOGLE_SESSION);
+
+	xmlnode_new_child(description_node, "manifest");
+	protocol_node = xmlnode_new_child(description_node, "protocol");
+	xmlnode_new_child(protocol_node, "http");
+
+	xmlnode_set_namespace(transport_node, NS_GOOGLE_SESSION_SHARE);
+
+	jabber_iq_send(iq);
+}
 
 void
 gtalk_xfer_send_transport_accept(JabberStream *js, GoogleSession *session, xmlnode *sess)
 {
 	JabberIq *iq;
 	xmlnode *session_node, *transport_node;
-/*TODO:  REMOVE ME gchar *me = g_strdup_printf("%s@%s/%s",
-				    js->user->node,
-				    js->user->domain,
-				    js->user->resource);
-*/	
+
 	purple_debug_info("google_session", "Inside google_xfer_send_transport_accept()\n");
 	iq = jabber_iq_new(js, JABBER_IQ_SET);
 	xmlnode_set_attrib(iq->node, "to", session->remote_jid);
@@ -1259,6 +1316,11 @@ gtalk_xfer_send_transport_accept(JabberS
 
 	jabber_iq_send(iq);
 
+/*TODO : Remove these temporary lines and put at their appropriate location : */
+	gtalk_xfer_send_accept(js, session, sess);
+	gtalk_xfer_send_info(js, session, sess);
+/*************************************************************/
+
 /*TODO: CLEAN UP: WHAT WESEND : 
 <iq type='set' id='purple154daa44' to='ashmew2 at gmail.com/Talk.v104168E5E46'>
 <session xmlns='http://www.google.com/session' type='transport-accept' id='3162060852' initiator='doondoon1234 at gmail.com/E4494551'><transport xmlns='http://www.google.com/transport/p2p'/></session></iq>
@@ -1283,6 +1345,7 @@ google_xfer_send(JabberStream *js, Googl
 static void
 google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
+	/*TODO: Add an action for type="info"*/
 	const char *type = xmlnode_get_attrib(sess, "type");
 	purple_debug_info("google_session", "\nType of IQ being parsed : %s\n",type);
 	GoogleAVSessionData *session_data = (GoogleAVSessionData *)(session->session_data);



More information about the Commits mailing list