pidgin.vv: aa8b8681: Use stream-info instead of state-changed...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sat Mar 21 05:15:55 EDT 2009


-----------------------------------------------------------------
Revision: aa8b86815e77dd5a2d4d26c51be5283fd2825475
Ancestor: 37a31fa597ec5d7d9eaec451a1100b5bf5aa1501
Author: maiku at soc.pidgin.im
Date: 2009-03-21T00:54:34
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/aa8b86815e77dd5a2d4d26c51be5283fd2825475

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

ChangeLog: 

Use stream-info instead of state-changed for hangup and reject.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google.c	da78af2cfe0e1c502d65cc2f972533055a998de2
+++ libpurple/protocols/jabber/google.c	2e02af496d83dea9332116d6ea3b4047571e141e
@@ -224,26 +224,33 @@ google_session_state_changed_cb(PurpleMe
 	if (sid == NULL && name == NULL) {
 		if (type == PURPLE_MEDIA_STATE_CHANGED_END) {
 			google_session_destroy(session);
-		} else if (type == PURPLE_MEDIA_STATE_CHANGED_HANGUP) {
-			xmlnode *sess;
-			JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+		}
+	}
+}
 
-			xmlnode_set_attrib(iq->node, "to", session->remote_jid);
-			sess = google_session_create_xmlnode(session, "terminate");
-			xmlnode_insert_child(iq->node, sess);
-	
-			jabber_iq_send(iq);
-		} else if (type == PURPLE_MEDIA_STATE_CHANGED_REJECTED) {
-			xmlnode *sess;
-			JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+static void
+google_session_stream_info_cb(PurpleMedia *media,
+		PurpleMediaStateChangedType type,
+		gchar *sid, gchar *name, GoogleSession *session)
+{
+	if (type == PURPLE_MEDIA_INFO_HANGUP) {
+		xmlnode *sess;
+		JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
 
-			xmlnode_set_attrib(iq->node, "to", session->remote_jid);
-			sess = google_session_create_xmlnode(session, "reject");
-			xmlnode_insert_child(iq->node, sess);
-	
-			jabber_iq_send(iq);
-		}
-		
+		xmlnode_set_attrib(iq->node, "to", session->remote_jid);
+		sess = google_session_create_xmlnode(session, "terminate");
+		xmlnode_insert_child(iq->node, sess);
+
+		jabber_iq_send(iq);
+	} else if (type == PURPLE_MEDIA_INFO_REJECT) {
+		xmlnode *sess;
+		JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+
+		xmlnode_set_attrib(iq->node, "to", session->remote_jid);
+		sess = google_session_create_xmlnode(session, "reject");
+		xmlnode_insert_child(iq->node, sess);
+
+		jabber_iq_send(iq);
 	}
 }
 
@@ -329,6 +336,8 @@ jabber_google_session_initiate(JabberStr
 			G_CALLBACK(google_session_ready), session);
 	g_signal_connect(G_OBJECT(session->media), "state-changed",
 			G_CALLBACK(google_session_state_changed_cb), session);
+	g_signal_connect(G_OBJECT(session->media), "stream-info",
+			G_CALLBACK(google_session_stream_info_cb), session);
 
 	g_free(params);
 
@@ -394,6 +403,8 @@ google_session_handle_initiate(JabberStr
 			G_CALLBACK(google_session_ready), session);
 	g_signal_connect(G_OBJECT(session->media), "state-changed",
 			G_CALLBACK(google_session_state_changed_cb), session);
+	g_signal_connect(G_OBJECT(session->media), "stream-info",
+			G_CALLBACK(google_session_stream_info_cb), session);
 
 	purple_media_codec_list_free(codecs);
 


More information about the Commits mailing list