git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3493 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-11-30 15:27:37 +00:00
parent f5e183cb48
commit 90ddec83d9
2 changed files with 33 additions and 16 deletions

View File

@ -1 +1 @@
Thu Nov 16 16:09:31 UTC 2006
Thu Nov 30 15:25:59 UTC 2006

View File

@ -497,18 +497,21 @@ static int on_disco_info(void *user_data, ikspak *pak)
struct ldl_buffer *buffer;
size_t x;
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
iks *msg;
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "Ding A Ling....");
apr_queue_push(handle->queue, msg);
}
apr_cpystrn(id, from, sizeof(id));
if ((resource = strchr(id, '/'))) {
*resource++ = '\0';
}
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
iks *msg;
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling....");
apr_queue_push(handle->queue, msg);
}
if (resource) {
for (x = 0; x < strlen(resource); x++) {
resource[x] = (char)tolower((int)resource[x]);
@ -705,13 +708,7 @@ static int on_presence(void *user_data, ikspak *pak)
if (!status) {
status = type;
}
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
iks *msg;
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "Ding A Ling....");
apr_queue_push(handle->queue, msg);
}
apr_cpystrn(id, from, sizeof(id));
lowercase(id);
@ -720,6 +717,15 @@ static int on_presence(void *user_data, ikspak *pak)
*resource++ = '\0';
}
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
iks *msg;
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling....");
apr_queue_push(handle->queue, msg);
}
if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
apr_cpystrn(buffer->buf, from, buffer->len);
fflush(stderr);
@ -811,14 +817,25 @@ static int on_subscribe(void *user_data, ikspak *pak)
ldl_handle_t *handle = user_data;
char *from = iks_find_attrib(pak->x, "from");
char *to = iks_find_attrib(pak->x, "to");
iks *msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "Ding A Ling....");
iks *msg = NULL;
char *id = strdup(from);
char *r;
if (!id) {
return -1;
}
if ((r = strchr(from, '/'))) {
*r++;
}
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling....");
if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) {
iks_insert_attrib(msg, "from", to);
}
apr_queue_push(handle->queue, msg);
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, from, "Ding A Ling....");
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, "Ding A Ling....");
if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) {
iks_insert_attrib(msg, "from", to);