pidgin.vv: 6d3cbc3e: Remove ready-new from use.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Mar 20 04:35:46 EDT 2009


-----------------------------------------------------------------
Revision: 6d3cbc3e18ffdb622d7c7385f4fe3287b08256d4
Ancestor: 8c41751fba489cf5b791b4e06387cbd988d0cfe2
Author: maiku at soc.pidgin.im
Date: 2009-03-20T01:48:28
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/6d3cbc3e18ffdb622d7c7385f4fe3287b08256d4

Modified files:
        libpurple/media.c libpurple/media.h
        libpurple/protocols/jabber/google.c

ChangeLog: 

Remove ready-new from use.

-------------- next part --------------
============================================================
--- libpurple/media.c	8267805228f68b38efe6ba9880904187b788b264
+++ libpurple/media.c	f44c99a03dd28a60a3425ff11f17a131dca934e8
@@ -501,7 +501,7 @@ purple_media_candidate_new(const gchar *
 	return candidate;
 }
 
-static PurpleMediaCandidate *
+PurpleMediaCandidate *
 purple_media_candidate_copy(PurpleMediaCandidate *candidate)
 {
 	PurpleMediaCandidate *new_candidate;
@@ -756,7 +756,7 @@ purple_media_codec_new(int id, const cha
 	return codec;
 }
 
-static PurpleMediaCodec *
+PurpleMediaCodec *
 purple_media_codec_copy(PurpleMediaCodec *codec)
 {
 	PurpleMediaCodec *new_codec;
============================================================
--- libpurple/media.h	12f48910cb7b4aab44f60d32a888606a4f8eb513
+++ libpurple/media.h	6e56939a2014daf75e28f1bac53a492edd597f10
@@ -207,6 +207,16 @@ PurpleMediaCandidate *purple_media_candi
 		const gchar *ip, guint port);
 
 /**
+ * Copies a PurpleMediaCandidate instance.
+ *
+ * @param candidate The candidate to copy
+ *
+ * @return The newly created PurpleMediaCandidate copy.
+ */
+PurpleMediaCandidate *purple_media_candidate_copy(
+		PurpleMediaCandidate *candidate);
+
+/**
  * Copies a GList of PurpleMediaCandidate and its contents.
  *
  * @param candidates The list of candidates to be copied.
@@ -243,6 +253,15 @@ PurpleMediaCodec *purple_media_codec_new
 		PurpleMediaSessionType media_type, guint clock_rate);
 
 /**
+ * Copies a PurpleMediaCodec instance.
+ *
+ * @param codec The codec to copy
+ *
+ * @return The newly created PurpleMediaCodec copy.
+ */
+PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec);
+
+/**
  * Creates a string representation of the codec.
  *
  * @param codec The codec to create the string of.
============================================================
--- libpurple/protocols/jabber/google.c	5c002b84e944b59b8fc7de3bd5c91a30c17fb94a
+++ libpurple/protocols/jabber/google.c	e8af81cc6cea17f57d70b85a3dcab343728210fc
@@ -156,19 +156,29 @@ static void
 }
 
 static void
-google_session_ready(PurpleMedia *media, gchar *id,
-		gchar *participant, GoogleSession *session)
+google_session_ready(GoogleSession *session)
 {
-	if (id == NULL && participant == NULL) {
+	PurpleMedia *media = session->media;
+	if (purple_media_codecs_ready(media, NULL) &&
+			purple_media_candidates_prepared(media, NULL, NULL)) {
 		gchar *me = g_strdup_printf("%s@%s/%s",
 				session->js->user->node,
 				session->js->user->domain,
 				session->js->user->resource);
-		JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+		JabberIq *iq;
 		xmlnode *sess, *desc, *payload;
 		GList *codecs, *iter;
+		gboolean is_initiator = !strcmp(session->id.initiator, me);
 
-		if (!strcmp(session->id.initiator, me)) {
+		if (!is_initiator &&
+				!purple_media_accepted(media, NULL, NULL)) {
+			g_free(me);
+			return;
+		}
+
+		iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+
+		if (is_initiator) {
 			xmlnode_set_attrib(iq->node, "to", session->remote_jid);
 			xmlnode_set_attrib(iq->node, "from", session->id.initiator);
 			sess = google_session_create_xmlnode(session, "initiate");
@@ -309,8 +319,11 @@ jabber_google_session_initiate(JabberStr
 		return NULL;
 	}
 
-	g_signal_connect(G_OBJECT(session->media), "ready-new",
+	g_signal_connect_swapped(G_OBJECT(session->media),
+			"candidates-prepared",
 			G_CALLBACK(google_session_ready), session);
+	g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed",
+			G_CALLBACK(google_session_ready), session);
 	g_signal_connect(G_OBJECT(session->media), "state-changed",
 			G_CALLBACK(google_session_state_changed_cb), session);
 
@@ -369,8 +382,13 @@ google_session_handle_initiate(JabberStr
 
 	purple_media_set_remote_codecs(session->media, "google-voice", session->remote_jid, codecs);
 
-	g_signal_connect(G_OBJECT(session->media), "ready-new",
+	g_signal_connect_swapped(G_OBJECT(session->media), "accepted",
 			G_CALLBACK(google_session_ready), session);
+	g_signal_connect_swapped(G_OBJECT(session->media),
+			"candidates-prepared",
+			G_CALLBACK(google_session_ready), session);
+	g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed",
+			G_CALLBACK(google_session_ready), session);
 	g_signal_connect(G_OBJECT(session->media), "state-changed",
 			G_CALLBACK(google_session_state_changed_cb), session);
 


More information about the Commits mailing list