# HG changeset patch # User Paul Aurich # Date 1238864519 0 # Node ID 20743d9bd62dc451ba838c1e54474b74c7de1a18 # Parent a9d5067ad6e7aa4b1a6afe32d86d68d5964fe6e9 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." diff -r a9d5067ad6e7 -r 20743d9bd62d libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Sat Apr 04 07:29:50 2009 +0000 +++ b/libpurple/protocols/jabber/caps.c Sat Apr 04 17:01:59 2009 +0000 @@ -552,7 +552,7 @@ 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 */ diff -r a9d5067ad6e7 -r 20743d9bd62d libpurple/protocols/jabber/disco.c --- a/libpurple/protocols/jabber/disco.c Sat Apr 04 07:29:50 2009 +0000 +++ b/libpurple/protocols/jabber/disco.c Sat Apr 04 17:01:59 2009 +0000 @@ -148,6 +148,20 @@ 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 to the ) 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; diff -r a9d5067ad6e7 -r 20743d9bd62d libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Sat Apr 04 07:29:50 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Apr 04 17:01:59 2009 +0000 @@ -2730,8 +2730,8 @@ } #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 -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 -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_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 */ diff -r a9d5067ad6e7 -r 20743d9bd62d libpurple/protocols/jabber/jabber.h --- a/libpurple/protocols/jabber/jabber.h Sat Apr 04 07:29:50 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sat Apr 04 17:01:59 2009 +0000 @@ -355,9 +355,12 @@ 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); diff -r a9d5067ad6e7 -r 20743d9bd62d libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Sat Apr 04 07:29:50 2009 +0000 +++ b/libpurple/protocols/jabber/presence.c Sat Apr 04 17:01:59 2009 +0000 @@ -273,6 +273,20 @@ 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; }