/soc/2013/ashmew2/filetransferX: 33e5daf93f99: Adding libnice fo...
Ashish Gupta
ashmew2 at gmail.com
Sat Aug 10 19:24:21 EDT 2013
Changeset: 33e5daf93f99439798f82ffb6806af1408fb2dc1
Author: Ashish Gupta <ashmew2 at gmail.com>
Date: 2013-08-11 04:54 +0530
Branch: filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/33e5daf93f99
Description:
Adding libnice for ICE
diffstat:
libpurple/protocols/jabber/Makefile.am | 2 +-
libpurple/protocols/jabber/google/google_session.c | 26 ++++++++++++++++-----
2 files changed, 20 insertions(+), 8 deletions(-)
diffs (79 lines):
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
@@ -93,7 +93,7 @@ JABBERSOURCES = \
AM_CFLAGS = $(st)
-libxmpp_la_LDFLAGS = -module -avoid-version
+libxmpp_la_LDFLAGS = -module -avoid-version -lnice
if USE_CYRUS_SASL
JABBERSOURCES += auth_cyrus.c
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
@@ -1035,22 +1035,25 @@ cb_candidate_gathering_done(void)
void
gtalk_xfer_send_candidates(GoogleSession *session)
{
+
guint stream_id;
gchar buffer[] = "hello world!";
GSList *lcands = NULL, *rcands = NULL;
// Create a nice agent
- NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_GOOGLE);
+ NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_GOOGLE);
// Connect the signals
- g_signal_connect (G_OBJECT (agent), "candidate-gathering-done",
- G_CALLBACK (cb_candidate_gathering_done), NULL);
+ /* g_signal_connect (G_OBJECT (agent), "candidate-gathering-done",
+ G_CALLBACK (cb_candidate_gathering_done), NULL);*/
+
/* g_signal_connect (G_OBJECT (agent), "component-state-changed",
G_CALLBACK (cb_component_state_changed), NULL);
g_signal_connect (G_OBJECT (agent), "new-selected-pair",
G_CALLBACK (cb_new_selected_pair), NULL);
*/
// Create a new stream with one component and start gathering candidates
+
stream_id = nice_agent_add_stream (agent, 1);
nice_agent_gather_candidates (agent, stream_id);
@@ -1060,13 +1063,22 @@ gtalk_xfer_send_candidates(GoogleSession
*/
// ... Wait until the signal candidate-gathering-done is fired ...
lcands = nice_agent_get_local_candidates(agent, stream_id, 1);
-
+
+ for(; lcands ; lcands=lcands->next) {
+ NiceCandidate *x = (NiceCandidate *)(lcands->data);
+ NiceAddress *address;
+ address = &(x->addr);
+ char *ip;
+ nice_address_to_string(address, ip);
+ purple_debug_info("google_session", "IP is : %s\n",ip);
+ }
+ return;
// ... Send local candidates to the peer and set the peer's remote candidates
- nice_agent_set_remote_candidates (agent, stream_id, 1, rcands);
+ //nice_agent_set_remote_candidates (agent, stream_id, 1, rcands);
// ... Wait until the signal new-selected-pair is fired ...
// Send our message!
- nice_agent_send (agent, stream_id, 1, sizeof(buffer), buffer);
+ //nice_agent_send (agent, stream_id, 1, sizeof(buffer), buffer);
// Anything received will be received through the cb_nice_recv callback
@@ -1463,7 +1475,7 @@ google_session_parse_iq(JabberStream *js
if(local_received && stun_received) {
/*Time to send out our candidates if both the local and stun have been received*/
purple_debug_info("google_session", "Calling send candidates.\n");
- // gtalk_xfer_send_candidates(session);
+ gtalk_xfer_send_candidates(session);
local_received = stun_received = FALSE;
}
// google_xfer_send(js,session);
More information about the Commits
mailing list