Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
001c552e
提交
001c552e
authored
3月 30, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
doh
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@4812
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
9a194513
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
54 行增加
和
0 行删除
+54
-0
libdingaling.c
libs/libdingaling/src/libdingaling.c
+5
-0
libdingaling.h
libs/libdingaling/src/libdingaling.h
+49
-0
没有找到文件。
libs/libdingaling/src/libdingaling.c
浏览文件 @
001c552e
...
@@ -761,6 +761,11 @@ static void do_presence(ldl_handle_t *handle, char *from, char *to, char *type,
...
@@ -761,6 +761,11 @@ static void do_presence(ldl_handle_t *handle, char *from, char *to, char *type,
from
=
buf
;
from
=
buf
;
}
}
if
(
ldl_test_flag
(
handle
,
LDL_FLAG_COMPONENT
)
&&
ldl_jid_domcmp
(
from
,
to
))
{
globals
.
logger
(
DL_LOG_ERR
,
"Refusal to send presence from and to the same domain in component mode [%s][%s]
\n
"
,
from
,
to
);
return
;
}
if
((
pres
=
iks_new
(
"presence"
)))
{
if
((
pres
=
iks_new
(
"presence"
)))
{
iks_insert_attrib
(
pres
,
"xmlns"
,
"jabber:client"
);
iks_insert_attrib
(
pres
,
"xmlns"
,
"jabber:client"
);
if
(
from
)
{
if
(
from
)
{
...
...
libs/libdingaling/src/libdingaling.h
浏览文件 @
001c552e
...
@@ -179,6 +179,55 @@ typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level,
...
@@ -179,6 +179,55 @@ typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level,
#define ldl_yield(ms) apr_sleep(ms * 10); apr_thread_yield();
#define ldl_yield(ms) apr_sleep(ms * 10); apr_thread_yield();
/*!
\brief Test for a common domain in 2 jid
\param id_a the first id
\param id_b the second id
\return 1 if the domains match 0 if they dont or -1 if either id is invalid
\note the id may or may not contain a user and/or resource
*/
static
inline
int
ldl_jid_domcmp
(
char
*
id_a
,
char
*
id_b
)
{
char
*
id_a_host
,
*
id_b_host
,
*
id_a_r
,
*
id_b_r
;
if
((
id_a_host
=
strchr
(
id_a
,
'@'
)))
{
id_a_host
++
;
}
else
{
id_a_host
=
id_a
;
}
if
((
id_b_host
=
strchr
(
id_b
,
'@'
)))
{
id_b_host
++
;
}
else
{
id_b_host
=
id_b
;
}
if
(
id_a_host
&&
id_b_host
)
{
int
id_a_len
=
0
,
id_b_len
=
0
,
len
=
0
;
if
((
id_a_r
=
strchr
(
id_a_host
,
'/'
)))
{
id_a_len
=
id_a_r
-
id_a_host
;
}
else
{
id_a_len
=
strlen
(
id_a_host
);
}
if
((
id_b_r
=
strchr
(
id_b_host
,
'/'
)))
{
id_b_len
=
id_b_r
-
id_b_host
;
}
else
{
id_b_len
=
strlen
(
id_b_host
);
}
if
(
id_a_len
>
id_b_len
)
{
len
=
id_b_len
;
}
else
{
len
=
id_a_len
;
}
printf
(
"[%s][%s][%d]
\n
"
,
id_a_host
,
id_b_host
,
len
);
return
strncasecmp
(
id_a_host
,
id_b_host
,
len
)
?
0
:
1
;
}
return
-
1
;
}
/*!
/*!
\brief Test for the existance of a flag on an arbitary object
\brief Test for the existance of a flag on an arbitary object
\param obj the object to test
\param obj the object to test
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论