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
This commit is contained in:
Anthony Minessale 2006-04-14 18:10:24 +00:00
parent d0a103a343
commit 0e0e1e3673
2 changed files with 16 additions and 7 deletions

View File

@ -245,9 +245,11 @@ base => dc=freeswitch,dc=org
debug => 0 debug => 0
codec_prefs => PCMU codec_prefs => PCMU
; *NOTE* your resource (after the /) MUST contain the string "talk" (upper or lower case is ok)
[interface] [interface]
name => google name => google
login => myjabberid@myjabberserver.com/me login => myjabberid@myjabberserver.com/talk
password => mypass password => mypass
dialplan => demo dialplan => demo
message => Jingle all the way message => Jingle all the way

View File

@ -33,7 +33,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <iksemel.h> #include <iksemel.h>
#include <apr.h> #include <apr.h>
#include <apr_network_io.h> #include <apr_network_io.h>
@ -394,15 +394,22 @@ static int on_presence(void *user_data, ikspak *pak)
ldl_handle_t *handle = user_data; ldl_handle_t *handle = user_data;
char *from = iks_find_attrib(pak->x, "from"); char *from = iks_find_attrib(pak->x, "from");
char id[1024]; char id[1024];
char *p; char *resource;
struct ldl_buffer *buffer; struct ldl_buffer *buffer;
size_t x;
apr_cpystrn(id, from, sizeof(id)); apr_cpystrn(id, from, sizeof(id));
if ((p = strchr(id, '/'))) { if ((resource = strchr(id, '/'))) {
*p = '\0'; *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); apr_cpystrn(buffer->buf, from, buffer->len);
buffer->hit = 1; buffer->hit = 1;
} }