[Telepathy-commits] [telepathy-gabble/master] Do not advertise bundle since we use the verification string, except for voice-v1 for compatibility with Gabble 0.2 and Google Talk
Alban Crequy
alban.crequy at collabora.co.uk
Tue Aug 19 10:52:38 PDT 2008
20080514115431-a41c0-6c1de1fcbaeec9656e32d77bfc52a955b78182e2.gz
---
src/capabilities.c | 4 +++
src/capabilities.h | 7 +++++
src/gabble-connection.c | 45 +++-----------------------------
tests/twisted/jingle/jingletest.py | 6 +++-
tests/twisted/olpc/test-olpc-bundle.py | 3 --
5 files changed, 20 insertions(+), 45 deletions(-)
diff --git a/src/capabilities.c b/src/capabilities.c
index beae1cd..d3c340c 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -69,6 +69,10 @@ void
capabilities_fill_cache (GabblePresenceCache *cache)
{
const Feature *feat;
+
+ /* We don't advertise bundles anymore, but we keep them in the cache. So if
+ * we speak to an old version of Gabble, we don't need to make discovery
+ * requests for theses bundles. */
for (feat = self_advertised_features; NULL != feat->ns; feat++)
{
gchar *node = g_strconcat (NS_GABBLE_CAPS "#", feat->bundle, NULL);
diff --git a/src/capabilities.h b/src/capabilities.h
index d0af024..3a6c1c2 100644
--- a/src/capabilities.h
+++ b/src/capabilities.h
@@ -34,6 +34,13 @@
* "voice-v1". We keep this name for compatibility.
*/
#define BUNDLE_VOICE_V1 "voice-v1"
+
+/* The bundles "jingle-audio", "jingle-video" and "olpc1" are no more
+ * advertised in the 'ext' attribute of the presence stanza. But the following
+ * identifiers are still used in self_advertised_features to identify whether
+ * it is a fixed feature, which we always advertise. VERSION == bundle means a
+ * fixed feature.
+ */
#define BUNDLE_JINGLE_AUDIO "jingle-audio"
#define BUNDLE_JINGLE_VIDEO "jingle-video"
#define BUNDLE_OLPC_1 "olpc1"
diff --git a/src/gabble-connection.c b/src/gabble-connection.c
index db20e05..2eded54 100644
--- a/src/gabble-connection.c
+++ b/src/gabble-connection.c
@@ -1285,9 +1285,6 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
LmMessage *message = gabble_presence_as_message (presence, priv->resource);
LmMessageNode *node = lm_message_get_node (message);
gboolean ret;
- GString *ext_string = NULL;
- GSList *features, *i;
- GHashTable *bundles;
gchar *caps_hash;
if (presence->status == GABBLE_PRESENCE_HIDDEN)
@@ -1296,36 +1293,6 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
lm_message_node_set_attribute (node, "type", "invisible");
}
- features = capabilities_get_features (presence->caps);
-
- /* this is used as a set, so any non-NULL value will do */
- bundles = g_hash_table_new (g_str_hash, g_str_equal);
- for (i = features; NULL != i; i = i->next)
- {
- const Feature *feat = (const Feature *) i->data;
-
- if ((NULL != feat->bundle) && tp_strdiff (VERSION, feat->bundle))
- {
- if (NULL != ext_string)
- {
- if (g_hash_table_lookup (bundles, (gchar *) feat->bundle) == NULL)
- {
- /* This bundle wasn't added yet */
- g_string_append_printf (ext_string, " %s", feat->bundle);
- g_hash_table_insert (bundles, (gchar *) feat->bundle,
- (gpointer) feat);
- }
- }
- else
- {
- ext_string = g_string_new (feat->bundle);
- g_hash_table_insert (bundles, (gchar *) feat->bundle,
- (gpointer) feat);
- }
- }
- }
- g_hash_table_destroy (bundles);
-
/* XEP-0115 version 1.5 uses a verification string in the 'ver' attribute */
caps_hash = caps_hash_compute_from_self_presence (self);
node = lm_message_node_add_child (node, "c", NULL);
@@ -1337,18 +1304,14 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
"ver", caps_hash,
NULL);
- /* XEP-0115 deprecates 'ext' feature bundles. But we need it for
- * backward-compatibility */
- if (NULL != ext_string)
- {
- lm_message_node_set_attribute (node, "ext", ext_string->str);
- g_string_free (ext_string, TRUE);
- }
+ /* XEP-0115 deprecates 'ext' feature bundles. But we still need
+ * BUNDLE_VOICE_V1 it for backward-compatibility with Gabble 0.2 */
+ if (presence->caps & PRESENCE_CAP_GOOGLE_VOICE)
+ lm_message_node_set_attribute (node, "ext", BUNDLE_VOICE_V1);
ret = _gabble_connection_send (self, message, error);
g_free (caps_hash);
- g_slist_free (features);
lm_message_unref (message);
return ret;
diff --git a/tests/twisted/jingle/jingletest.py b/tests/twisted/jingle/jingletest.py
index 2c32131..1022aef 100644
--- a/tests/twisted/jingle/jingletest.py
+++ b/tests/twisted/jingle/jingletest.py
@@ -50,7 +50,11 @@ class JingleTest:
# Default feats for remote end
self.remote_feats = [ 'http://www.google.com/xmpp/protocol/session',
'http://www.google.com/transport/p2p',
- 'http://jabber.org/protocol/jingle' ]
+ 'http://jabber.org/protocol/jingle',
+ # was previously in bundles:
+ 'http://jabber.org/protocol/jingle/description/audio',
+ 'http://jabber.org/protocol/jingle/description/video',
+ 'http://www.google.com/xmpp/protocol/voice/v1']
# Default audio codecs for the remote end
self.audio_codecs = [ ('GSM', 3, 8000), ('PCMA', 8, 8000), ('PCMU', 0, 8000) ]
diff --git a/tests/twisted/olpc/test-olpc-bundle.py b/tests/twisted/olpc/test-olpc-bundle.py
index 12776c8..9b8928e 100644
--- a/tests/twisted/olpc/test-olpc-bundle.py
+++ b/tests/twisted/olpc/test-olpc-bundle.py
@@ -55,9 +55,6 @@ def test(q, bus, conn, stream):
assert c_nodes is not None
assert len(c_nodes) == 1
- c_node = c_nodes[0]
- assert c_node['ext'] == 'olpc1'
-
# send diso request
m = domish.Element(('', 'iq'))
m['from'] = 'alice at jabber.laptop.org'
--
1.5.6.3
More information about the Telepathy-commits
mailing list