diff options
author | <robert.mcqueen@collabora.co.uk> | 2006-05-10 11:15:52 +0000 |
---|---|---|
committer | <robert.mcqueen@collabora.co.uk> | 2006-05-10 11:15:52 +0000 |
commit | eb37758642ef790b96ab37e9f9d1e804b870aaa7 (patch) | |
tree | c33adf37f09131edd382841b45b0dea7af38b039 /src | |
parent | 67055b5426415319c51e6475c6335374c47baf83 (diff) |
refactor voice resource finding so that we find voice-v1 if there are multiple caps, and don't hardwire for google's client
Diffstat (limited to 'src')
-rw-r--r-- | src/gabble-presence-cache.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/src/gabble-presence-cache.c b/src/gabble-presence-cache.c index d29163fac..35e4fb6ad 100644 --- a/src/gabble-presence-cache.c +++ b/src/gabble-presence-cache.c @@ -36,28 +36,44 @@ _presence_has_google_voice (LmMessageNode *pres_node) for (node = pres_node->children; node; node = node->next) { - const gchar *cap_node, *cap_ext, *cap_xmlns; + const gchar *cap_xmlns, *cap_ext; if (strcmp (node->name, "c") != 0) continue; - cap_node = lm_message_node_get_attribute (node, "node"); - cap_ext = lm_message_node_get_attribute (node, "ext"); cap_xmlns = lm_message_node_get_attribute (node, "xmlns"); - - if (!cap_node || !cap_ext || !cap_xmlns) - continue; - - if (strcmp (cap_node, "http://www.google.com/xmpp/client/caps") != 0) + if (NULL == cap_xmlns || + 0 != strcmp (cap_xmlns, "http://jabber.org/protocol/caps")) continue; - if (strcmp (cap_ext, "voice-v1") != 0) - continue; - - if (strcmp (cap_xmlns, "http://jabber.org/protocol/caps") != 0) - continue; - - return TRUE; + cap_ext = lm_message_node_get_attribute (node, "ext"); + if (NULL != cap_ext) + { + gchar **features, **tmp; + gboolean found = FALSE; + + features = g_strsplit (cap_ext, " ", 0); + + for (tmp = features; *tmp; tmp++) + { + if (0 == strcmp (*tmp, "voice-v1")) + { + found = TRUE; + break; + } + } + + g_strfreev (features); + + if (found) + { + return TRUE; + } + } + else + { + continue; + } } return FALSE; |