【发布时间】:2016-05-30 23:48:11
【问题描述】:
如何只允许我名单上的联系人向我发送消息? 是否有任何 XEP 负责这样做?还是我需要在客户端做这个?
【问题讨论】:
-
我很确定默认情况下 converse.js 不会显示从不在您名册中的用户收到的消息。
标签: xmpp openfire converse.js
如何只允许我名单上的联系人向我发送消息? 是否有任何 XEP 负责这样做?还是我需要在客户端做这个?
【问题讨论】:
标签: xmpp openfire converse.js
是的,OpenFire 支持XEP-0016: Privacy Lists(参见this question),可用于根据各种标准阻止节。
您无法明确阻止不在您名册中的联系人的节,但您可以通过订阅状态none 阻止,这或多或少可以实现相同的目标。您可以发送如下内容:
<iq from='romeo@example.net/orchard' type='set' id='msg3'>
<query xmlns='jabber:iq:privacy'>
<list name='message-sub-example'>
<item type='subscription'
value='none'
action='deny'
order='5'>
<message/>
</item>
</list>
</query>
</iq>
这将创建一个名为 message-sub-example 的隐私列表,其中包含一条规则,用于阻止订阅类型为 none 的联系人发送的任何消息,包括不在名册中的联系人。要使此列表生效,您需要将其设为活动列表:
<iq from='romeo@example.net/orchard' type='set' id='active1'>
<query xmlns='jabber:iq:privacy'>
<active name='message-sub-example'/>
</query>
</iq>
【讨论】:
none、to、from 和 both。与其他 IM 系统不同,状态订阅不一定是对称的:如果 X 可以看到 Y,Y 可能会也可能不会看到 X。