提交 90ddec83 authored 作者: Anthony Minessale's avatar Anthony Minessale

tweak

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3493 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 f5e183cb
Thu Nov 16 16:09:31 UTC 2006 Thu Nov 30 15:25:59 UTC 2006
...@@ -497,17 +497,20 @@ static int on_disco_info(void *user_data, ikspak *pak) ...@@ -497,17 +497,20 @@ static int on_disco_info(void *user_data, ikspak *pak)
struct ldl_buffer *buffer; struct ldl_buffer *buffer;
size_t x; size_t x;
apr_cpystrn(id, from, sizeof(id));
if ((resource = strchr(id, '/'))) {
*resource++ = '\0';
}
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) { if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
iks *msg; iks *msg;
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker); 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...."); msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling....");
apr_queue_push(handle->queue, msg); apr_queue_push(handle->queue, msg);
} }
apr_cpystrn(id, from, sizeof(id));
if ((resource = strchr(id, '/'))) {
*resource++ = '\0';
}
if (resource) { if (resource) {
for (x = 0; x < strlen(resource); x++) { for (x = 0; x < strlen(resource); x++) {
...@@ -705,20 +708,23 @@ static int on_presence(void *user_data, ikspak *pak) ...@@ -705,20 +708,23 @@ static int on_presence(void *user_data, ikspak *pak)
if (!status) { if (!status) {
status = type; status = type;
} }
apr_cpystrn(id, from, sizeof(id));
lowercase(id);
if ((resource = strchr(id, '/'))) {
*resource++ = '\0';
}
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) { if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
iks *msg; iks *msg;
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker); 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...."); msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling....");
apr_queue_push(handle->queue, msg); apr_queue_push(handle->queue, msg);
} }
apr_cpystrn(id, from, sizeof(id));
lowercase(id);
if ((resource = strchr(id, '/'))) {
*resource++ = '\0';
}
if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { 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);
...@@ -811,14 +817,25 @@ static int on_subscribe(void *user_data, ikspak *pak) ...@@ -811,14 +817,25 @@ static int on_subscribe(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 *to = iks_find_attrib(pak->x, "to"); 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)) { if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) {
iks_insert_attrib(msg, "from", to); iks_insert_attrib(msg, "from", to);
} }
apr_queue_push(handle->queue, msg); 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)) { if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) {
iks_insert_attrib(msg, "from", to); iks_insert_attrib(msg, "from", to);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论