/soc/2013/ashmew2/filetransferY: 1a068ebd789d: Merged default to...
Ashish Gupta
ashmew2 at gmail.com
Sun Feb 2 14:15:44 EST 2014
Changeset: 1a068ebd789d828547f7c466f9ea319e611ff67e
Author: Ashish Gupta <ashmew2 at gmail.com>
Date: 2014-02-02 23:37 +0530
Branch: default
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferY/rev/1a068ebd789d
Description:
Merged default to fty
diffstat:
.hgignore | 2 +
configure.ac | 19 +
libpurple/protocols/jabber/Makefile.am | 7 +-
libpurple/protocols/jabber/caps.c | 8 +-
libpurple/protocols/jabber/disco.c | 4 +
libpurple/protocols/jabber/google/google_session.c | 536 ++++++-
libpurple/protocols/jabber/google/google_session.h | 80 +-
libpurple/protocols/jabber/google/google_share.c | 1377 ++++++++++++++++++++
libpurple/protocols/jabber/google/jingleinfo.c | 1 -
libpurple/protocols/jabber/google/relay.c | 17 +
libpurple/protocols/jabber/google/relay.h | 6 +
libpurple/protocols/jabber/iq.c | 4 +-
libpurple/protocols/jabber/jabber.c | 18 +-
libpurple/protocols/jabber/jabber.h | 3 +
libpurple/protocols/jabber/namespaces.h | 3 +
libpurple/protocols/jabber/parser.c | 2 +
libpurple/protocols/jabber/presence.c | 10 +-
libpurple/protocols/jabber/si.c | 11 +
libpurple/protocols/yahoo/yahoo_filexfer.c | 8 +-
libpurple/xfer.c | 4 +-
libpurple/xfer.h | 46 +
libpurple/xmlnode.c | 1 +
22 files changed, 2043 insertions(+), 124 deletions(-)
diffs (truncated from 2757 to 300 lines):
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -121,3 +121,5 @@ po/stamp-it
stamp-h1
test-driver
win32-install-dir(\.release)?
+\#.*\#
+test-driver
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1029,6 +1029,25 @@ fi
AM_CONDITIONAL(USE_VV, test "x$enable_vv" != "xno")
dnl #######################################################################
+dnl # Check for libnice
+dnl #######################################################################
+PKG_CHECK_MODULES(LIBNICE, nice, , [
+ AC_MSG_RESULT(no)
+ enable_libnice="no"
+ if test "x$force_deps" = "xyes" ; then
+ AC_MSG_ERROR([
+libnice development headers not found.
+Use --disable-libnice if you do not need it.
+])
+ fi])
+if test "x$enable_libnice" = "xyes" ; then
+ AC_DEFINE(USE_LIBNICE, 1, [Define if we're using libnice])
+ AC_SUBST(LIBNICE_CFLAGS)
+ AC_SUBST(LIBNICE_LIBS)
+fi
+
+
+dnl #######################################################################
dnl # Check for Internationalized Domain Name support
dnl #######################################################################
diff --git a/libpurple/protocols/jabber/Makefile.am b/libpurple/protocols/jabber/Makefile.am
--- a/libpurple/protocols/jabber/Makefile.am
+++ b/libpurple/protocols/jabber/Makefile.am
@@ -39,6 +39,8 @@ JABBERSOURCES = \
google/google_roster.h \
google/google_session.c \
google/google_session.h \
+ google/google_share.c \
+ google/google_share.h \
google/jingleinfo.c \
google/jingleinfo.h \
google/relay.c \
@@ -115,8 +117,8 @@ pkg_LTLIBRARIES = libjabber.la libf
libjabber_la_SOURCES = $(JABBERSOURCES)
libjabber_la_LIBADD = $(GLIB_LIBS) $(SASL_LIBS) $(LIBXML_LIBS) $(IDN_LIBS)\
$(FARSTREAM_LIBS) \
- $(GSTREAMER_LIBS)
-
+ $(GSTREAMER_LIBS) \
+ $(LIBNICE_LIBS)
libfacebook_la_SOURCES = libfacebook.c
libfacebook_la_LIBADD = libjabber.la
@@ -134,6 +136,7 @@ AM_CPPFLAGS = \
$(DEBUG_CFLAGS) \
$(GLIB_CFLAGS) \
$(IDN_CFLAGS) \
+ $(LIBNICE_CFLAGS) \
$(LIBXML_CFLAGS) \
$(FARSTREAM_CFLAGS) \
$(GSTREAMER_CFLAGS)
diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c
--- a/libpurple/protocols/jabber/caps.c
+++ b/libpurple/protocols/jabber/caps.c
@@ -359,8 +359,14 @@ gboolean jabber_caps_exts_known(const Ja
for (i = 0; exts[i]; ++i) {
/* Hack since we advertise the ext along with v1.5 caps but don't
* store any exts */
- if (g_str_equal(exts[i], "voice-v1") && !info->exts)
+ if (g_str_equal(exts[i], "voice-v1") && !info->exts) {
+ purple_debug_info("caps","voice-v1 detected.");
continue;
+ }
+ if (g_str_equal(exts[i], "share-v1") && !info->exts) {
+ purple_debug_info("caps","share-v1 detected.");
+ continue;
+ }
if (!info->exts ||
!g_hash_table_lookup(info->exts->exts, exts[i]))
return FALSE;
diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c
--- a/libpurple/protocols/jabber/disco.c
+++ b/libpurple/protocols/jabber/disco.c
@@ -142,6 +142,10 @@ void jabber_disco_info_parse(JabberStrea
purple_xmlnode_set_attrib(feature, "var", feat->namespace);
}
}
+ } else if (g_str_equal(node, CAPS0115_NODE "#" "share-v1")) {
+
+ xmlnode *feature = xmlnode_new_child(query, "feature");
+ xmlnode_set_attrib(feature, "var", NS_GOOGLE_SHARE);
#ifdef USE_VV
} else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) {
/*
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
@@ -22,8 +22,8 @@
#include "debug.h"
#include "google_session.h"
#include "relay.h"
-
#include "jingle/jingle.h"
+#include <nice/agent.h>
#ifdef USE_VV
@@ -32,8 +32,10 @@ typedef struct {
gboolean video;
GList *remote_audio_candidates; /* list of PurpleMediaCandidate */
GList *remote_video_candidates; /* list of PurpleMediaCandidate */
- gboolean added_streams; /* this indicates if the streams have been
- to media (ie. after getting relay credentials */
+ gboolean added_streams; /* this indicates if the streams have
+ * been to media (ie. after getting
+ * relay credentials
+ */
} GoogleAVSessionData;
static gboolean
@@ -45,21 +47,93 @@ google_session_id_equal(gconstpointer a,
return !strcmp(c->id, d->id) && !strcmp(c->initiator, d->initiator);
}
-static void
+void
google_session_destroy(GoogleSession *session)
{
- GoogleAVSessionData *session_data =
- (GoogleAVSessionData *) session->session_data;
+ JabberStream *js = session->js;
+ session->state = TERMINATED;
+
+ if(session->share) {
+
+ GoogleXferSessionData *share_session = session->session_data;
+ GSList *temp = NULL;
+
+ if(share_session->xfer) {
+ if(purple_xfer_get_status(share_session->xfer) ==
+ PURPLE_XFER_STATUS_CANCEL_REMOTE) {
+ purple_xfer_cancel_remote(share_session->xfer);
+ }
+ else if (purple_xfer_get_status(share_session->xfer)
+ != PURPLE_XFER_STATUS_CANCEL_LOCAL &&
+ purple_xfer_get_status(share_session->xfer)
+ != PURPLE_XFER_STATUS_DONE) {
+ purple_xfer_cancel_local(share_session->xfer);
+ }
+ }
+
+ if(share_session->file_to_send)
+ fclose(share_session->file_to_send);
+
+ share_session->xfer = NULL;
+ g_free(share_session->filename);
+ g_free(share_session->preview_url);
+ g_free(share_session->source_url);
+ g_free(share_session->file_buf);
+ g_free(share_session->channel_name);
+
+ if(share_session->share_agent) {
+ g_signal_handlers_disconnect_by_func(
+ G_OBJECT(share_session->share_agent),
+ G_CALLBACK(cb_candidate_gathering_done),
+ session);
+
+ g_signal_handlers_disconnect_by_func(
+ G_OBJECT(share_session->share_agent),
+ G_CALLBACK (cb_new_selected_pair), NULL);
+
+ g_signal_handlers_disconnect_by_func(
+ G_OBJECT(share_session->share_agent),
+ G_CALLBACK (cb_nice_component_state_changed),
+ session);
+
+ g_signal_handlers_disconnect_by_func(
+ G_OBJECT(share_session->share_agent),
+ G_CALLBACK (cb_nice_component_writable),
+ share_session);
+ g_object_unref(share_session->share_agent);
+ }
+
+ purple_circ_buffer_destroy(share_session->buffer);
+
+ for (temp = share_session->remote_share_candidates; temp; temp =
+ g_slist_delete_link(temp, temp)) {
+ nice_candidate_free(temp->data);
+ }
+
+ for (temp = share_session->local_share_candidates; temp; temp =
+ g_slist_delete_link(temp, temp)) {
+ nice_candidate_free(temp->data);
+ }
+
+ g_free(temp);
+ }
+ else { /*If it is an AV session*/
+ GoogleAVSessionData *session_data = session->session_data;
+ if (session_data->remote_audio_candidates)
+ purple_media_candidate_list_free(
+ session_data->remote_audio_candidates);
+
+ if (session_data->remote_video_candidates)
+ purple_media_candidate_list_free(
+ session_data->remote_video_candidates);
+ }
+
+ js->google_share_sessions = g_list_remove(js->google_share_sessions,session);
+
g_free(session->id.id);
g_free(session->id.initiator);
g_free(session->remote_jid);
- if (session_data->remote_audio_candidates)
- purple_media_candidate_list_free(session_data->remote_audio_candidates);
-
- if (session_data->remote_video_candidates)
- purple_media_candidate_list_free(session_data->remote_video_candidates);
-
if (session->description)
purple_xmlnode_free(session->description);
@@ -67,7 +141,7 @@ google_session_destroy(GoogleSession *se
g_free(session);
}
-static PurpleXmlNode *
+PurpleXmlNode *
google_session_create_xmlnode(GoogleSession *session, const char *type)
{
PurpleXmlNode *node = purple_xmlnode_new("session");
@@ -170,6 +244,9 @@ google_session_ready(GoogleSession *sess
((GoogleAVSessionData *)session->session_data)->media;
gboolean video =
((GoogleAVSessionData *)session->session_data)->video;
+
+ gboolean share = session->share;
+
if (purple_media_codecs_ready(media, NULL) &&
purple_media_candidates_prepared(media, NULL, NULL)) {
gchar *me = g_strdup_printf("%s@%s/%s",
@@ -206,7 +283,10 @@ google_session_ready(GoogleSession *sess
}
purple_xmlnode_insert_child(iq->node, sess);
desc = purple_xmlnode_new_child(sess, "description");
- if (video)
+
+ if (share)
+ purple_xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_SHARE);
+ else if (video)
purple_xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_VIDEO);
else
purple_xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_PHONE);
@@ -340,56 +420,109 @@ jabber_google_session_get_params(JabberS
return new_params;
}
-
-static void
+void
jabber_google_relay_response_session_initiate_cb(GoogleSession *session,
const gchar *relay_ip, guint relay_udp, guint relay_tcp, guint relay_ssltcp,
const gchar *relay_username, const gchar *relay_password)
{
- GParameter *params;
- guint num_params;
JabberStream *js = session->js;
- GoogleAVSessionData *session_data =
- (GoogleAVSessionData *) session->session_data;
+
+ purple_debug_info("google_session", "Inside jabber_google_relay_response_initiate_cb!\n");
- session_data->media = purple_media_manager_create_media(
+ if(session->share) {
+ GoogleXferSessionData *share_session =
+ (GoogleXferSessionData *)session->session_data;
+ gint stream_id = share_session->stream_id;
+ NiceAgent *agent = share_session->share_agent;
+
+ purple_debug_info("Google_session", "Here\n\n\n\n");
+
+ if(!agent) {
+/* if(purple_xfer_get_type(share_session->xfer) == PURPLE_XFER_RECEIVE)
+ purple_xfer_request(share_session->xfer);
+*/ /*if xfer is of type PURPLE_XFER_SEND, We've already requested it*/
+
+ stream_id = gtalk_xfer_init_agent(session);
+ agent = share_session->share_agent;
+
+ purple_debug_info("google_session", "share_agent created with stream id : %d!\n", stream_id);
+
More information about the Commits
mailing list