cpw.darkrain42.xmpp.bosh: 095d145f: Fix allowing gmail user to initiate voic...

paul at darkrain42.org paul at darkrain42.org
Sat Apr 4 15:20:49 EDT 2009


-----------------------------------------------------------------
Revision: 095d145f5bd3572daa52ffb9ee17e45fd1f2683b
Ancestor: 545a93cd754f61bec4f04687d073b3b4b7c1cc22
Author: paul at darkrain42.org
Date: 2009-04-04T17:01:59
Branch: im.pidgin.cpw.darkrain42.xmpp.bosh
URL: http://d.pidgin.im/viewmtn/revision/info/095d145f5bd3572daa52ffb9ee17e45fd1f2683b

Modified files:
        libpurple/protocols/jabber/caps.c
        libpurple/protocols/jabber/disco.c
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/jabber.h
        libpurple/protocols/jabber/presence.c

ChangeLog: 

Fix allowing gmail user to initiate voice call by advertising a specific ext

>From xep-0115 v1.3:
"The names of the feature bundles MUST NOT be used for semantic purposes: they
are merely opaque identifiers that will be used in other use cases."

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c	a95e5767d989013e75486f5a33f18d3dac8dd3bf
+++ libpurple/protocols/jabber/caps.c	aad0e6622bf4a47971e0f02f18de9c07fdd7b37c
@@ -552,7 +552,7 @@ void jabber_caps_get_info(JabberStream *
 	jabber_caps_cbplususerdata *userdata;
 
 	if (ext && *ext && hash)
-		purple_debug_warning("jabber", "Ignoring exts in new-style caps from %s\n",
+		purple_debug_info("jabber", "Ignoring exts in new-style caps from %s\n",
 		                     who);
 
 	/* Using this in a read-only fashion, so the cast is OK */
============================================================
--- libpurple/protocols/jabber/disco.c	88756c00dda0960e7d40c1b585391b40ab847f2f
+++ libpurple/protocols/jabber/disco.c	a769d07a02597e220daa29a14eeaf719b32365bb
@@ -148,6 +148,20 @@ void jabber_disco_info_parse(JabberStrea
 					xmlnode_set_attrib(feature, "var", feat->namespace);
 				}	
 			}
+#ifdef USE_VV
+		} else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) {
+			/*
+			 * HUGE HACK! We advertise this ext (see jabber_presence_create_js
+			 * where we add <c/> to the <presence/>) for the Google Talk
+			 * clients that don't actually check disco#info features.
+			 *
+			 * This specific feature is redundant but is what
+			 * node='http://mail.google.com/xmpp/client/caps', ver='1.1'
+			 * advertises as 'voice-v1'.
+			 */
+			xmlnode *feature = xmlnode_new_child(query, "feature");
+			xmlnode_set_attrib(feature, "var", "http://www.google.com/xmpp/protocol/voice/v1");
+#endif
 		} else {
 			xmlnode *error, *inf;
 				
============================================================
--- libpurple/protocols/jabber/jabber.c	c857e68a013293f28535b7577b775faab6ab715e
+++ libpurple/protocols/jabber/jabber.c	cc826ada363be2f80274b604ad2ab967036b3e7e
@@ -2730,8 +2730,8 @@ gboolean jabber_offline_message(const Pu
 }
 
 #ifdef USE_VV
-static gboolean
-feature_audio_enabled(JabberStream *js, const char *namespace)
+gboolean
+jabber_audio_enabled(JabberStream *js, const char *namespace)
 {
 	PurpleMediaManager *manager = purple_media_manager_get();
 	PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager);
@@ -2740,7 +2740,7 @@ static gboolean
 }
 
 static gboolean
-feature_video_enabled(JabberStream *js, const char *namespace)
+jabber_video_enabled(JabberStream *js, const char *namespace)
 {
 	PurpleMediaManager *manager = purple_media_manager_get();
 	PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager);
@@ -2749,7 +2749,7 @@ static gboolean
 }
 
 static gboolean
-feature_ice_transmitter_present(JabberStream *js, const char *namespace)
+jabber_ice_transmitter_present(JabberStream *js, const char *namespace)
 {
 	return purple_media_transmitter_exists("nice");
 }
@@ -3189,11 +3189,11 @@ jabber_init_plugin(PurplePlugin *plugin)
 	jabber_add_feature(JINGLE_TRANSPORT_RAWUDP, 0);
 
 #ifdef USE_VV
-	jabber_add_feature("http://www.google.com/xmpp/protocol/session", feature_audio_enabled);
-	jabber_add_feature("http://www.google.com/xmpp/protocol/voice/v1", feature_audio_enabled);
-	jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, feature_audio_enabled);
-	jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, feature_video_enabled);
-	jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, feature_ice_transmitter_present);
+	jabber_add_feature("http://www.google.com/xmpp/protocol/session", jabber_audio_enabled);
+	jabber_add_feature("http://www.google.com/xmpp/protocol/voice/v1", jabber_audio_enabled);
+	jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled);
+	jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled);
+	jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, jabber_ice_transmitter_present);
 #endif
 
 	/* IPC functions */
============================================================
--- libpurple/protocols/jabber/jabber.h	049e9f2ea4f517669a64f9605bc069f292f721a8
+++ libpurple/protocols/jabber/jabber.h	5bd5f70a13d011ad05bcd7f83fee7afe3ea8ca2e
@@ -355,9 +355,12 @@ GList *jabber_actions(PurplePlugin *plug
 gboolean jabber_offline_message(const PurpleBuddy *buddy);
 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len);
 GList *jabber_actions(PurplePlugin *plugin, gpointer context);
+
+gboolean jabber_audio_enabled(JabberStream *js, const char *unused);
 gboolean jabber_initiate_media(PurpleConnection *gc, const char *who,
 		PurpleMediaSessionType type);
 PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, const char *who);
+
 void jabber_register_commands(void);
 
 void jabber_init_plugin(PurplePlugin *plugin);
============================================================
--- libpurple/protocols/jabber/presence.c	8e33194e345b15aaecd2837eb00e17be59af0e21
+++ libpurple/protocols/jabber/presence.c	6d78751406f99792f5759a3649295173df146df3
@@ -273,6 +273,20 @@ xmlnode *jabber_presence_create_js(Jabbe
 	xmlnode_set_attrib(c, "hash", "sha-1");
 	xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js));
 
+#ifdef USE_VV
+	/*
+	 * MASSIVE HUGE DISGUSTING HACK
+	 * This is a huge hack. As far as I can tell, Google Talk's gmail client
+	 * doesn't bother to check the actual features we advertise; they
+	 * just assume that if we advertise a 'voice-v1' ext (ignoring that
+	 * these are to be assigned no semantic value). We need to advertise
+	 * this for the gmail web interface chat client to allow the mail user
+	 * to start a voice chat with us. Boo.
+	 */
+	if (jabber_audio_enabled(js, NULL /* unused */))
+		xmlnode_set_attrib(c, "ext", "voice-v1");
+#endif
+
 	return presence;
 }
 


More information about the Commits mailing list