diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-07 15:18:23 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-11 11:20:56 +0100 |
commit | fbfa8c138da1a4f00c74af4bda98e858a203a58b (patch) | |
tree | 2837a5b5ae7aceddba23291eb0014efa0349979d | |
parent | 1866bc54eecf2fa6ce00b37d196cd904f8a0203b (diff) |
Add Google camera-v1 as a first-class caps bundle
This is partly a point of principle - given any caps bundle that we have
ever advertised support for, we should be prepared to define when asked -
but mainly a workaround for the iChat bug mentioned in commit af55ea3d.
If we return an error, it will keep disco'ing us repeatedly in a loop.
This leaves us with the problem of finding out what the bundle contains.
In Google's usage it is only its name that is important (ignoring that
XEP-0115 explicitly makes bundle names opaque), but replying to disco
requests for it requires us to be able to turn it into a set of 0 or
more capability URIs. Because of the Google server bug mentioned in
commit cd0da0a8, we can't just ask a Google client, because they're
all on Google servers, so they can't usefully be disco'd.
We assume here that it behaves like the voice-v1 and video-v1 bundles
in containing exactly one URI, and that that URI corresponds to the
bundle name in the same way.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54634
-rw-r--r-- | gabble/capabilities.h | 1 | ||||
-rw-r--r-- | src/capabilities.c | 13 | ||||
-rw-r--r-- | src/connection.c | 3 | ||||
-rw-r--r-- | src/namespaces.h | 1 | ||||
-rw-r--r-- | src/presence-cache.c | 3 |
5 files changed, 21 insertions, 0 deletions
diff --git a/gabble/capabilities.h b/gabble/capabilities.h index 81c8c2546..dd0a0c901 100644 --- a/gabble/capabilities.h +++ b/gabble/capabilities.h @@ -65,6 +65,7 @@ const GabbleCapabilitySet *gabble_capabilities_get_olpc_notify (void); const GabbleCapabilitySet *gabble_capabilities_get_bundle_share_v1 (void); const GabbleCapabilitySet *gabble_capabilities_get_bundle_voice_v1 (void); const GabbleCapabilitySet *gabble_capabilities_get_bundle_video_v1 (void); +const GabbleCapabilitySet *gabble_capabilities_get_bundle_camera_v1 (void); /* Return the capabilities we always have */ const GabbleCapabilitySet *gabble_capabilities_get_fixed_caps (void); diff --git a/src/capabilities.c b/src/capabilities.c index 14a396a6e..d2b25f57f 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -77,6 +77,7 @@ static const Feature self_advertised_features[] = { FEATURE_OPTIONAL, NS_GOOGLE_FEAT_SHARE }, { FEATURE_OPTIONAL, NS_GOOGLE_FEAT_VOICE }, { FEATURE_OPTIONAL, NS_GOOGLE_FEAT_VIDEO }, + { FEATURE_OPTIONAL, NS_GOOGLE_FEAT_CAMERA }, { FEATURE_OPTIONAL, NS_JINGLE_DESCRIPTION_AUDIO }, { FEATURE_OPTIONAL, NS_JINGLE_DESCRIPTION_VIDEO }, { FEATURE_OPTIONAL, NS_JINGLE_RTP }, @@ -103,6 +104,7 @@ static GabbleCapabilitySet *legacy_caps = NULL; static GabbleCapabilitySet *share_v1_caps = NULL; static GabbleCapabilitySet *voice_v1_caps = NULL; static GabbleCapabilitySet *video_v1_caps = NULL; +static GabbleCapabilitySet *camera_v1_caps = NULL; static GabbleCapabilitySet *any_audio_caps = NULL; static GabbleCapabilitySet *any_video_caps = NULL; static GabbleCapabilitySet *any_audio_video_caps = NULL; @@ -138,6 +140,12 @@ gabble_capabilities_get_bundle_video_v1 (void) } const GabbleCapabilitySet * +gabble_capabilities_get_bundle_camera_v1 (void) +{ + return camera_v1_caps; +} + +const GabbleCapabilitySet * gabble_capabilities_get_any_audio (void) { return any_audio_caps; @@ -271,6 +279,9 @@ gabble_capabilities_init (gpointer conn) video_v1_caps = gabble_capability_set_new (); gabble_capability_set_add (video_v1_caps, NS_GOOGLE_FEAT_VIDEO); + camera_v1_caps = gabble_capability_set_new (); + gabble_capability_set_add (camera_v1_caps, NS_GOOGLE_FEAT_CAMERA); + any_audio_caps = gabble_capability_set_new (); gabble_capability_set_add (any_audio_caps, NS_JINGLE_RTP_AUDIO); gabble_capability_set_add (any_audio_caps, NS_JINGLE_DESCRIPTION_AUDIO); @@ -335,6 +346,7 @@ gabble_capabilities_finalize (gpointer conn) gabble_capability_set_free (share_v1_caps); gabble_capability_set_free (voice_v1_caps); gabble_capability_set_free (video_v1_caps); + gabble_capability_set_free (camera_v1_caps); gabble_capability_set_free (any_audio_caps); gabble_capability_set_free (any_video_caps); gabble_capability_set_free (any_audio_video_caps); @@ -350,6 +362,7 @@ gabble_capabilities_finalize (gpointer conn) share_v1_caps = NULL; voice_v1_caps = NULL; video_v1_caps = NULL; + camera_v1_caps = NULL; any_audio_caps = NULL; any_video_caps = NULL; any_audio_video_caps = NULL; diff --git a/src/connection.c b/src/connection.c index c1e5946c5..316af96ee 100644 --- a/src/connection.c +++ b/src/connection.c @@ -2707,6 +2707,9 @@ iq_disco_cb (WockyPorter *porter, if (!tp_strdiff (suffix, BUNDLE_VIDEO_V1)) features = gabble_capabilities_get_bundle_video_v1 (); + + if (!tp_strdiff (suffix, BUNDLE_CAMERA_V1)) + features = gabble_capabilities_get_bundle_camera_v1 (); } if (data_forms != NULL) diff --git a/src/namespaces.h b/src/namespaces.h index 4f8415c84..13ae5dbb6 100644 --- a/src/namespaces.h +++ b/src/namespaces.h @@ -35,6 +35,7 @@ #define NS_GOOGLE_FEAT_SHARE "http://google.com/xmpp/protocol/share/v1" #define NS_GOOGLE_FEAT_VOICE "http://www.google.com/xmpp/protocol/voice/v1" #define NS_GOOGLE_FEAT_VIDEO "http://www.google.com/xmpp/protocol/video/v1" +#define NS_GOOGLE_FEAT_CAMERA "http://www.google.com/xmpp/protocol/camera/v1" #define NS_GOOGLE_JINGLE_INFO "google:jingleinfo" #define NS_GOOGLE_ROSTER "google:roster" #define NS_GOOGLE_QUEUE "google:queue" diff --git a/src/presence-cache.c b/src/presence-cache.c index 31a301215..72901a057 100644 --- a/src/presence-cache.c +++ b/src/presence-cache.c @@ -522,6 +522,7 @@ gabble_presence_cache_add_bundles (GabblePresenceCache *cache) */ GOOGLE_BUNDLE ("voice-v1", NS_GOOGLE_FEAT_VOICE); GOOGLE_BUNDLE ("video-v1", NS_GOOGLE_FEAT_VIDEO); + GOOGLE_BUNDLE ("camera-v1", NS_GOOGLE_FEAT_CAMERA); /* File transfer support */ GOOGLE_BUNDLE ("share-v1", NS_GOOGLE_FEAT_SHARE); @@ -550,6 +551,8 @@ gabble_presence_cache_add_bundles (GabblePresenceCache *cache) NS_GABBLE_CAPS "#" BUNDLE_VIDEO_V1, NS_GOOGLE_FEAT_VIDEO); gabble_presence_cache_add_bundle_caps (cache, NS_GABBLE_CAPS "#" BUNDLE_SHARE_V1, NS_GOOGLE_FEAT_SHARE); + gabble_presence_cache_add_bundle_caps (cache, + NS_GABBLE_CAPS "#" BUNDLE_CAMERA_V1, NS_GOOGLE_FEAT_CAMERA); } static GObject * |