/soc/2013/ashmew2/filetransferX: f2afeb7a68d3: Adding Share Channel

Ashish Gupta ashmew2 at gmail.com
Sun Aug 18 07:53:45 EDT 2013


Changeset: f2afeb7a68d3aea1ea33bd9e8d29f146acaf633a
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-08-17 03:43 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/f2afeb7a68d3

Description:

Adding Share Channel

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  58 +++++++++++++++------
 1 files changed, 42 insertions(+), 16 deletions(-)

diffs (88 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
@@ -33,12 +33,30 @@
 #ifdef USE_VV
 
 typedef struct {
+	NiceAgent *agent;
+	guint stream_id;
+	guint component_id;
+	gchar *name;
+	gboolean agent_attached;
+	guint share_channel_id;
+	HttpStatus http_status;
+	gchar *status_line;
+	gboolean is_chunked;
+	guint64 content_length;
+	gchar *write_buffer;
+	guint write_len;
+	gchar *read_buffer;
+	guint read_len;
+} ShareChannel;
+
+typedef struct {
 	gchar *filename;                            /*File Details*/
 	guint64 filesize;
 	gchar *preview_url;
 	gchar *source_url;
 	/*Needs to have a manifest Entry for Folder Sharing*/
 	NiceAgent *share_agent; /*TODO : Assess the usefulness of share_agent and stream_id*/
+	ShareChannel *share_channel;
 	guint stream_id;
 	GList *remote_share_candidates; /* lists of PurpleMediaCandidate OR NiceCandidates(maybe?)*/
 	GList *local_share_candidates;  
@@ -60,22 +78,6 @@ typedef struct {
 	 							   to media (ie. after getting relay credentials */
 } GoogleAVSessionData;
 
-typedef struct {
-	NiceAgent *agent;
-	guint stream_id;
-	guint component_id;
-	gboolean agent_attached;
-	guint share_channel_id;
-	HttpStatus http_status;
-	gchar *status_line;
-	gboolean is_chunked;
-	guint64 content_length;
-	gchar *write_buffer;
-	guint write_len;
-	gchar *read_buffer;
-	guint read_len;
-} ShareChannel;
-
 
 /*TODO: When cleaning up typedef struct {
 
@@ -885,6 +887,30 @@ void
 google_session_handle_info(JabberStream  *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
 	JabberIq *iq;
+	xmlnode *channel = xmlnode_get_child(sess, "channel");
+	gchar *me = g_strdup_printf("%s@%s/%s",
+				    js->user->node,
+				    js->user->domain,
+				    js->user->resource);
+	
+	/*Since a channel was specified in the message, we should mostly be creating a ShareChannel right here TODO*/	
+
+	if(channel) {
+		GoogleAVSessionData *session_data = (GoogleAVSessionData *)session->session_data;
+		GoogleXferSessionData *share_session = session_data->share_session;
+		gboolean is_initiator = !strcmp(session->id.initiator, me);
+		share_session->share_channel = g_new0(ShareChannel, 1);
+		/*TODO: Make sure the NiceAgent exists here?*/
+		share_session->share_channel->stream_id = share_session->stream_id;
+		share_session->share_channel->agent = share_session->share_agent;
+		share_session->share_channel->name = g_strdup(xmlnode_get_attrib(channel, "name"));
+
+		if(share_session->share_agent)
+			purple_debug_info("google_session", "Added a channel !\n");
+		else
+			purple_debug_info("google_session", "Something messed up..Channel NOT Added.\n");
+	}
+
 	iq = jabber_iq_new(js, JABBER_IQ_RESULT);
 	jabber_iq_set_id(iq, iq_id);
 	xmlnode_set_attrib(iq->node, "to", session->remote_jid);



More information about the Commits mailing list