diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-10-05 22:00:43 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-10-05 22:00:43 +0000 |
commit | 587801d2451732592cf746db42d8b194e4fcb141 (patch) | |
tree | 7c90597a97839853f242906c56060869034bb165 /res | |
parent | b457523ef34e5b223cbabd90ac61957088858ca1 (diff) |
Fixes chan_gtalk to work with gmail client
This patch was written by Philippe Sultan (phsultan). Thanks
for keeping this up to date!
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@290479 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_jabber.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c index ccf9d3d30..6b737e70b 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -569,8 +569,16 @@ static struct aji_resource *aji_find_resource(struct aji_buddy *buddy, char *nam static int gtalk_yuck(iks *node) { if (iks_find_with_attrib(node, "c", "node", "http://www.google.com/xmpp/client/caps")) { + ast_debug(1, "Found resource with Googletalk voice capabilities\n"); + return 1; + } else if (iks_find_with_attrib(node, "caps:c", "ext", "pmuc-v1 sms-v1 camera-v1 video-v1 voice-v1")) { + ast_debug(1, "Found resource with Gmail voice/video chat capabilities\n"); + return 1; + } else if (iks_find_with_attrib(node, "caps:c", "ext", "pmuc-v1 sms-v1 video-v1 voice-v1")) { + ast_debug(1, "Found resource with Gmail voice/video chat capabilities (no camera)\n"); return 1; } + return 0; } @@ -1577,6 +1585,23 @@ static int aji_act_hook(void *data, int type, iks *node) pak = iks_packet(node); + /* work around iksemel's impossibility to recognize node names + * containing a semicolon. Set the namespace of the corresponding + * node accordingly. */ + if (iks_has_children(node) && strchr(iks_name(iks_child(node)), ':')) { + char *node_ns = NULL; + char attr[AJI_MAX_ATTRLEN]; + char *node_name = iks_name(iks_child(node)); + char *aux = strchr(node_name, ':') + 1; + snprintf(attr, strlen("xmlns:") + (strlen(node_name) - strlen(aux)), "xmlns:%s", node_name); + node_ns = iks_find_attrib(iks_child(node), attr); + if (node_ns) { + pak->ns = node_ns; + pak->query = iks_child(node); + } + } + + if (!client->component) { /*client */ switch (type) { case IKS_NODE_START: @@ -2405,7 +2430,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak) if (gtalk_yuck(pak->x)) { /* gtalk should do discover */ found->cap->jingle = 1; } - if (found->cap->jingle && option_debug > 4) { + if (found->cap->jingle) { ast_debug(1, "Special case for google till they support discover.\n"); } else { iks *iq, *query; |