soc.2008.vv: 71da470e: Further decouple Jingle from iq.c

maiku at soc.pidgin.im maiku at soc.pidgin.im
Thu Jul 10 21:25:49 EDT 2008


-----------------------------------------------------------------
Revision: 71da470ef49588be00e0c82ec4486b5abb0bfd29
Ancestor: d0d9b5b70d3c076faa9558032cc1399604056f9d
Author: maiku at soc.pidgin.im
Date: 2008-07-10T22:49:52
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/71da470ef49588be00e0c82ec4486b5abb0bfd29

Modified files:
        libpurple/protocols/jabber/iq.c
        libpurple/protocols/jabber/jingle.c
        libpurple/protocols/jabber/jingle.h

ChangeLog: 

Further decouple Jingle from iq.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/iq.c	b1589a2fd69df13ea30216bee66b9c9a3b15bced
+++ libpurple/protocols/jabber/iq.c	55db451916981367aecf1742524d08b810a7690a
@@ -360,31 +360,9 @@ void jabber_iq_parse(JabberStream *js, x
 	}
 	
 #ifdef USE_VV
-	/* handle session initiate XEP 0167 */
-	if (type && !strcmp(type, "set")) {
-		/* is this a Jingle package? */
-		xmlnode *jingle = xmlnode_get_child(packet, "jingle");
-		if (jingle) {
-			const char *action = xmlnode_get_attrib(jingle, "action");
-			purple_debug_info("jabber", "got Jingle package action = %s\n",
-							  action);
-			if (!strcmp(action, "session-initiate")) {
-				jabber_jingle_session_handle_session_initiate(js, packet);
-			} else if (!strcmp(action, "session-accept")
-					   || !strcmp(action, "content-accept")) {
-				jabber_jingle_session_handle_session_accept(js, packet);
-			} else if (!strcmp(action, "session-info")) {
-				jabber_jingle_session_handle_session_info(js, packet);
-			} else if (!strcmp(action, "session-terminate")) {
-				jabber_jingle_session_handle_session_terminate(js, packet);
-			} else if (!strcmp(action, "transport-info")) {
-				jabber_jingle_session_handle_transport_info(js, packet);
-			} else if (!strcmp(action, "content-replace")) {
-				jabber_jingle_session_handle_content_replace(js, packet);
-			}
-
-			return;
-		}
+	if (xmlnode_get_child_with_namespace(packet, "jingle", "urn:xmpp:tmp:jingle")) {
+		jabber_jingle_session_parse(js, packet);
+		return;
 	}
 #endif
 
@@ -427,6 +405,7 @@ void jabber_iq_init(void)
 	jabber_iq_register_handler("http://jabber.org/protocol/disco#items", jabber_disco_items_parse);
 	jabber_iq_register_handler("jabber:iq:register", jabber_register_parse);
 	jabber_iq_register_handler("urn:xmpp:ping", urn_xmpp_ping_parse);
+	jabber_iq_register_handler("urn:xmpp:tmp:jingle", jabber_jingle_session_parse);
 }
 
 void jabber_iq_uninit(void)
============================================================
--- libpurple/protocols/jabber/jingle.c	6c9041596ef3ea79815e9d33a0edab736666e872
+++ libpurple/protocols/jabber/jingle.c	673cfc0847e365b42759877c84b1706d39d34dc7
@@ -1394,5 +1394,37 @@ jabber_jingle_session_handle_transport_i
 	}
 }
 
+void
+jabber_jingle_session_parse(JabberStream *js, xmlnode *packet)
+{
+	const gchar *type = xmlnode_get_attrib(packet, "type");
+
+	if (type && !strcmp(type, "set")) {
+		/* is this a Jingle package? */
+		xmlnode *jingle = xmlnode_get_child(packet, "jingle");
+		if (jingle) {
+			const char *action = xmlnode_get_attrib(jingle, "action");
+			purple_debug_info("jabber", "got Jingle package action = %s\n",
+							  action);
+			if (!strcmp(action, "session-initiate")) {
+				jabber_jingle_session_handle_session_initiate(js, packet);
+			} else if (!strcmp(action, "session-accept")
+					   || !strcmp(action, "content-accept")) {
+				jabber_jingle_session_handle_session_accept(js, packet);
+			} else if (!strcmp(action, "session-info")) {
+				jabber_jingle_session_handle_session_info(js, packet);
+			} else if (!strcmp(action, "session-terminate")) {
+				jabber_jingle_session_handle_session_terminate(js, packet);
+			} else if (!strcmp(action, "transport-info")) {
+				jabber_jingle_session_handle_transport_info(js, packet);
+			} else if (!strcmp(action, "content-replace")) {
+				jabber_jingle_session_handle_content_replace(js, packet);
+			}
+
+			return;
+		}
+	}
+}
+
 #endif /* USE_VV */
 
============================================================
--- libpurple/protocols/jabber/jingle.h	889e0f7ae41ef755ab140581996e654b2af433de
+++ libpurple/protocols/jabber/jingle.h	f0496c3ce8ed65613ac44a12baeb7d8a2ba057db
@@ -33,6 +33,8 @@ G_BEGIN_DECLS
 
 G_BEGIN_DECLS
 
+void jabber_jingle_session_parse(JabberStream *js, xmlnode *packet);
+
 PurpleMedia *jabber_jingle_session_initiate_media(JabberStream *js,
 						  const char *who,
 						  PurpleMediaStreamType type);


More information about the Commits mailing list