cpw.malu.xmpp.jingle_ft: 0b0ca084: Close local streamhosts when getting a s...
malu at pidgin.im
malu at pidgin.im
Tue Apr 7 14:50:40 EDT 2009
-----------------------------------------------------------------
Revision: 0b0ca0846f264e4126ca831b7aea27fdd1605783
Ancestor: 461f111b18f438eebe36dc8e07976ebe321a04d6
Author: malu at pidgin.im
Date: 2009-04-07T18:48:32
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/0b0ca0846f264e4126ca831b7aea27fdd1605783
Modified files:
libpurple/protocols/jabber/jingle/s5b.c
libpurple/protocols/jabber/jingle/s5b.h
ChangeLog:
Close local streamhosts when getting a successful response on a S5B
transport-accept.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c c03d7d05ada5999be5f3d55d79f93b9c76dd0963
+++ libpurple/protocols/jabber/jingle/s5b.c e26176b1275c5acf54323f7878f608638f931368
@@ -808,11 +808,33 @@ static void
}
static void
+jingle_s5b_transport_accept_cb(JabberStream *js, const char *from,
+ JabberIqType type, const char *id, xmlnode *packet, gpointer data)
+{
+ JingleS5BConnectData *cd = (JingleS5BConnectData *) data;
+ JingleSession *session = cd->session;
+ JingleS5B *s5b = cd->s5b;
+
+ if (type == JABBER_IQ_RESULT) {
+ if (!(jingle_session_is_initiator(session) &&
+ jingle_s5b_remote_is_connected(s5b))) {
+ /* unless we are the initiator and the receiver could connect,
+ now we shall "surrender" to other side and signal the content
+ to start */
+ jingle_s5b_surrender(s5b);
+ }
+ }
+
+ g_free(cd);
+}
+
+static void
jingle_s5b_connect_cb(gpointer data, gint source, const gchar *error_message)
{
JingleS5BConnectData *cd = (JingleS5BConnectData *) data;
JingleS5B *s5b = cd->s5b;
JingleSession *session = cd->session;
+ JabberIq *result = NULL;
purple_debug_info("jingle-s5b", "Successful in connecting!\n");
@@ -827,9 +849,9 @@ jingle_s5b_connect_cb(gpointer data, gin
jingle_s5b_stop_connection_attempts(s5b);
/* should send transport-info with streamhost-used */
- jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_ACCEPT));
-
- g_free(cd);
+ result = jingle_session_to_packet(session, JINGLE_TRANSPORT_ACCEPT);
+ jabber_iq_set_callback(result, jingle_s5b_transport_accept_cb, cd);
+ jabber_iq_send(result);
}
static void
@@ -904,6 +926,11 @@ jingle_s5b_stop_connection_attempts(Jing
purple_proxy_connect_cancel(s5b->priv->connect_data);
s5b->priv->connect_data = NULL;
}
+
+ if (s5b->priv->watcher) {
+ purple_input_remove(s5b->priv->watcher);
+ s5b->priv->watcher = 0;
+ }
}
gboolean
@@ -912,6 +939,12 @@ jingle_s5b_is_connected_to_remote(const
return s5b->priv->remote_fd;
}
+gboolean
+jingle_s5b_remote_is_connected(const JingleS5B *s5b)
+{
+ return s5b->priv->local_fd;
+}
+
void
jingle_s5b_surrender(JingleS5B *s5b)
{
@@ -923,6 +956,11 @@ jingle_s5b_surrender(JingleS5B *s5b)
close(s5b->priv->local_fd);
s5b->priv->local_fd = 0;
}
+
+ if (s5b->priv->watcher) {
+ purple_input_remove(s5b->priv->watcher);
+ s5b->priv->watcher = 0;
+ }
}
void
@@ -936,4 +974,9 @@ jingle_s5b_take_command(JingleS5B *s5b)
close(s5b->priv->remote_fd);
s5b->priv->remote_fd = 0;
}
+
+ if (s5b->priv->watcher) {
+ purple_input_remove(s5b->priv->watcher);
+ s5b->priv->watcher = 0;
+ }
}
\ No newline at end of file
============================================================
--- libpurple/protocols/jabber/jingle/s5b.h 7df0a51548ed1164677ea0450816480b7004ead8
+++ libpurple/protocols/jabber/jingle/s5b.h 22626223759284ce98076d8b1427b974ca3a89a1
@@ -79,6 +79,7 @@ gboolean jingle_s5b_is_connected_to_remo
void jingle_s5b_stop_connection_attempts(JingleS5B *s5b);
gboolean jingle_s5b_is_connected_to_remote(const JingleS5B *s5b);
+gboolean jingle_s5b_remote_is_connected(const JingleS5B *s5b);
void jingle_s5b_surrender(JingleS5B *s5b);
void jingle_s5b_take_command(JingleS5B *s5b);
More information about the Commits
mailing list