From 0e0e1e3673f5751cf9b305202b61748bf4b34611 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 14 Apr 2006 18:10:24 +0000 Subject: [PATCH] make dingaling need talk in the resource to clear up collisions git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1159 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- conf/freeswitch.conf | 4 +++- libs/libdingaling/src/libdingaling.c | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/conf/freeswitch.conf b/conf/freeswitch.conf index 94614bf964..81887b8da6 100644 --- a/conf/freeswitch.conf +++ b/conf/freeswitch.conf @@ -245,9 +245,11 @@ base => dc=freeswitch,dc=org debug => 0 codec_prefs => PCMU +; *NOTE* your resource (after the /) MUST contain the string "talk" (upper or lower case is ok) + [interface] name => google - login => myjabberid@myjabberserver.com/me + login => myjabberid@myjabberserver.com/talk password => mypass dialplan => demo message => Jingle all the way diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 22bce68423..9b1fd0981a 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -33,7 +33,7 @@ #include #include #include - +#include #include #include #include @@ -394,15 +394,22 @@ static int on_presence(void *user_data, ikspak *pak) ldl_handle_t *handle = user_data; char *from = iks_find_attrib(pak->x, "from"); char id[1024]; - char *p; + char *resource; struct ldl_buffer *buffer; + size_t x; apr_cpystrn(id, from, sizeof(id)); - if ((p = strchr(id, '/'))) { - *p = '\0'; + if ((resource = strchr(id, '/'))) { + *resource++ = '\0'; } - - if ((buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { + + if (resource) { + for (x = 0; x < strlen(resource); x++) { + resource[x] = tolower(resource[x]); + } + } + + if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { apr_cpystrn(buffer->buf, from, buffer->len); buffer->hit = 1; }