cpw.darkrain42.xmpp.iq-handlers: cb862657: And google session handling

paul at darkrain42.org paul at darkrain42.org
Sat Apr 4 04:05:38 EDT 2009


-----------------------------------------------------------------
Revision: cb862657883e0d36c1c99a18e8ede75de9a0ab9d
Ancestor: b81f51329b7872daf2d99302e23d6b2f98d9c342
Author: paul at darkrain42.org
Date: 2009-04-04T08:02:52
Branch: im.pidgin.cpw.darkrain42.xmpp.iq-handlers
URL: http://d.pidgin.im/viewmtn/revision/info/cb862657883e0d36c1c99a18e8ede75de9a0ab9d

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

ChangeLog: 

And google session handling
(it turns out this workingdir was --disable-vv. whoops...)

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google.c	b3a51bf38bcea68faf5b33a829363ea547c7b55e
+++ libpurple/protocols/jabber/google.c	949581561107d027e5a7a6c3171dbe7b35e6a107
@@ -374,7 +374,7 @@ static void
 }
 
 static void
-google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
+google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
 	JabberIq *result;
 	GList *codecs = NULL;
@@ -440,13 +440,13 @@ google_session_handle_initiate(JabberStr
 	purple_media_codec_list_free(codecs);
 
 	result = jabber_iq_new(js, JABBER_IQ_RESULT);
-	jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id"));
+	jabber_iq_set_id(result, iq_id);
 	xmlnode_set_attrib(result->node, "to", session->remote_jid);
 	jabber_iq_send(result);
 }
 
 static void 
-google_session_handle_candidates(JabberStream  *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
+google_session_handle_candidates(JabberStream  *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
 	JabberIq *result;
 	GList *list = NULL;
@@ -480,13 +480,13 @@ google_session_handle_candidates(JabberS
 	purple_media_candidate_list_free(list);
 
 	result = jabber_iq_new(js, JABBER_IQ_RESULT);
-	jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id"));
+	jabber_iq_set_id(result, iq_id);
 	xmlnode_set_attrib(result->node, "to", session->remote_jid);
 	jabber_iq_send(result);
 }
 
 static void
-google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
+google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
 	xmlnode *desc_element = xmlnode_get_child(sess, "description");
 	xmlnode *codec_element = xmlnode_get_child(desc_element, "payload-type");
@@ -514,60 +514,56 @@ google_session_handle_accept(JabberStrea
 			NULL, NULL, FALSE);
 
 	result = jabber_iq_new(js, JABBER_IQ_RESULT);
-	jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id"));
+	jabber_iq_set_id(result, iq_id);
 	xmlnode_set_attrib(result->node, "to", session->remote_jid);
 	jabber_iq_send(result);
 }
 
 static void
-google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
+google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode *sess)
 {
 	purple_media_end(session->media, NULL, NULL);
 }
 
 static void
-google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnode *packet, xmlnode *sess)
+google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnode *sess)
 {
 	purple_media_end(session->media, NULL, NULL);
 }
 
 static void
-google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *packet)
+google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
 {
-	xmlnode *sess = xmlnode_get_child(packet, "session");	
 	const char *type = xmlnode_get_attrib(sess, "type");
 
 	if (!strcmp(type, "initiate")) {
-		google_session_handle_initiate(js, session, packet, sess);
+		google_session_handle_initiate(js, session, sess, iq_id);
 	} else if (!strcmp(type, "accept")) {
-		google_session_handle_accept(js, session, packet, sess);
+		google_session_handle_accept(js, session, sess, iq_id);
 	} else if (!strcmp(type, "reject")) {
-		google_session_handle_reject(js, session, packet, sess);
+		google_session_handle_reject(js, session, sess);
 	} else if (!strcmp(type, "terminate")) {
-		google_session_handle_terminate(js, session, packet, sess);
+		google_session_handle_terminate(js, session, sess);
 	} else if (!strcmp(type, "candidates")) {
-		google_session_handle_candidates(js, session, packet, sess);
+		google_session_handle_candidates(js, session, sess, iq_id);
 	}
 }
 
 void
-jabber_google_session_parse(JabberStream *js, xmlnode *packet)
+jabber_google_session_parse(JabberStream *js, const char *from,
+                            JabberIqType type, const char *iq_id,
+                            xmlnode *session_node)
 {
 	GoogleSession *session = NULL;
 	GoogleSessionId id;
 
-	xmlnode *session_node;
 	xmlnode *desc_node;
 
 	GList *iter = NULL;
 
-	if (strcmp(xmlnode_get_attrib(packet, "type"), "set"))
+	if (type != JABBER_IQ_SET)
 		return;
 
-	session_node = xmlnode_get_child(packet, "session");
-	if (!session_node)
-		return;
-
 	id.id = (gchar*)xmlnode_get_attrib(session_node, "id");
 	if (!id.id)
 		return;
@@ -591,7 +587,7 @@ jabber_google_session_parse(JabberStream
 	}
 
 	if (session) {
-		google_session_parse_iq(js, session, packet);
+		google_session_parse_iq(js, session, session_node, iq_id);
 		return;
 	}
 
@@ -608,7 +604,7 @@ jabber_google_session_parse(JabberStream
 	session->js = js;
 	session->remote_jid = g_strdup(session->id.initiator);
 
-	google_session_parse_iq(js, session, packet);
+	google_session_parse_iq(js, session, session_node, iq_id);
 }
 #endif /* USE_VV */
 
============================================================
--- libpurple/protocols/jabber/google.h	ff1fb8c93ce04024f4e29c4c3f42d4233d4fc12d
+++ libpurple/protocols/jabber/google.h	e389ba787863139653e396db91b65aa2254f8cb3
@@ -51,7 +51,7 @@ gboolean jabber_google_session_initiate(
 char *jabber_google_format_to_html(const char *text);
 
 gboolean jabber_google_session_initiate(JabberStream *js, const gchar *who, PurpleMediaSessionType type);
-void jabber_google_session_parse(JabberStream *js, xmlnode *node);
+void jabber_google_session_parse(JabberStream *js, const char *from, JabberIqType type, const char *iq, xmlnode *session);
 
 void jabber_google_handle_jingle_info(JabberStream *js, const char *from,
                                       JabberIqType type, const char *id,


More information about the Commits mailing list