Xmpp 如何防止用户向某个组发送消息,但保持从该组接收消息(只读)?
我使用Ejabberd20.03和MucSub方法Xmpp 如何防止用户向某个组发送消息,但保持从该组接收消息(只读)?,xmpp,ejabberd,Xmpp,Ejabberd,我使用Ejabberd20.03和MucSub方法 我试图设置affiliation='none',但用户仍然可以向muc发送消息。详情: ejabberd.yml: ... modules: mod_adhoc: {} mod_admin_extra: {} mod_announce: access: announce mod_avatar: {} mod_blocking: {} mod_bosh: {} mod_caps: {} mod_carbon
我试图设置affiliation='none',但用户仍然可以向muc发送消息。详情: ejabberd.yml:
...
modules:
mod_adhoc: {}
mod_admin_extra: {}
mod_announce:
access: announce
mod_avatar: {}
mod_blocking: {}
mod_bosh: {}
mod_caps: {}
mod_carboncopy: {}
mod_client_state: {}
mod_configure: {}
mod_disco: {}
mod_fail2ban:
c2s_auth_ban_lifetime: 10
mod_http_api: {}
mod_http_upload:
put_url: https://@HOST@:5443/upload
mod_last: {}
mod_mam:
## Mnesia is limited to 2GB, better to use an SQL backend
## For small servers SQLite is a good fit and is very easy
## to configure. Uncomment this when you have SQL configured:
db_type: sql
assume_mam_usage: true
default: always
mod_mqtt: {}
mod_muc:
access:
- allow
access_admin:
- allow: admin
access_create: muc_create
access_persistent: muc_create
access_mam:
- allow
default_room_options:
allow_query_users: false
allow_subscription: true # enable MucSub
mam: true
persistent: true
public: false
public_list: false
mod_muc_admin: {}
mod_offline:
access_max_user_messages: max_user_offline_messages
mod_privacy: {}
mod_private: {}
mod_proxy65:
access: local
max_connections: 5
mod_pubsub:
access_createnode: pubsub_createnode
plugins:
- flat
- pep
force_node_config:
## Avoid buggy clients to make their bookmarks public
storage:bookmarks:
access_model: whitelist
mod_push: {}
mod_push_keepalive: {}
mod_register:
## Only accept registration requests from the "trusted"
## network (see access_rules section above).
## Think twice before enabling registration from any
## address. See the Jabber SPAM Manifesto for details:
## https://github.com/ge0rg/jabber-spam-fighting-manifesto
ip_access: trusted_network
mod_roster:
versioning: true
mod_s2s_dialback: {}
mod_shared_roster: {}
mod_stream_mgmt:
resend_on_timeout: if_offline
mod_vcard: {}
mod_vcard_xupdate: {}
mod_version:
show_os: false
房间设置:
[{title,<<"500">>},
{description,<<"500">>},
{allow_change_subj,false},
{allow_query_users,false},
{allow_private_messages,false},
{allow_private_messages_from_visitors,anyone},
{allow_visitor_status,true},
{allow_visitor_nickchange,true},
{public,false},
{public_list,false},
{persistent,true},
{moderated,true},
{members_by_default,true},
{members_only,true},
{allow_user_invites,false},
{password_protected,true},
{captcha_protected,false},
{password,<<"_500_">>},
{anonymous,false},
{logging,false},
{max_users,200},
{allow_voice_requests,true},
{allow_subscription,true},
{mam,true},
{presence_broadcast,[moderator,participant,visitor]},
{voice_request_min_interval,1800},
{vcard,<<"
<vCard
xmlns='vcard-temp'>
<TITLE>Room Title</TITLE>
<DESC>Room Description</DESC>
</vCard>">>},
{vcard_xupdate,<<>>},
{pubsub,<<>>},
{lang,<<"en">>},
{captcha_whitelist,[]},
{affiliations,[{{<<"21112">>,<<"domain.com">>,<<>>},
{admin,<<>>}},
{{<<"21247">>,<<"domain.com">>,<<>>},
{member,<<>>}},
{{<<"21966">>,<<"domain.com">>,<<>>},
{member,<<>>}},
{{<<"admin">>,<<"domain.com">>,<<>>},
{owner,<<>>}}]},
{subject,[]},
{subject_author,<<>>}]
[{title,},
{说明,},
{allow_change_subc,false},
{allow_query_users,false},
{allow_private_messages,false},
{允许来自访客、任何人的私人消息},
{allow_visitor_status,true},
{allow_visitor_nickchange,true},
{public,false},
{public_list,false},
{持久,正确},
{温和,正确},
{members\u默认为true},
{仅限成员,对},
{允许用户邀请,false},
{密码受保护,为true},
{验证码受保护,错误},
{密码,},
{匿名,假},
{logging,false},
{max_users,200},
{允许语音请求,true},
{allow_subscription,true},
{mam,true},
{现场直播,[主持人、参与者、访客]},
{语音请求最小间隔,1800},
{vcard,>},
{vcard_xupdate,},
{pubsub,},
{lang,},
{验证码白名单,[]},
{隶属关系,[{,,},
{admin,}},
{{,,},
{成员,}},
{{,,},
{成员,}},
{{,,},
{所有者,}}]},
{主题,[]},
{主题作者,}]
我希望用户21112(房间管理员)能够将用户21247(房间成员)设置为阻止21247向房间发送消息的状态,但21247仍然可以从房间接收消息。我试过:
并收到一个错误:
<iq
xmlns='jabber:client' xml:lang='en'
to='21112@domain.com/14965894906297405984175442'
from='500@conference.domain.com'
type='error'
id='revoke_voice_c4ec85d0-7f14-11ea-8f19-77e4dd9aaad8'>
<query
xmlns='http://jabber.org/protocol/muc#admin'>
<item nick='21247' role='visitor'/>
</query>
<error code='405' type='cancel'>
<not-allowed
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xml:lang='en'
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Changing role/affiliation is not allowed
</text>
</error>
</iq>
不允许更改角色/从属关系
我不知道为什么上面的错误会被返回。我已经阅读了房间配置和MucSub方法,我想知道这是否是因为MucSub实现。我不知道。然后我只是将用户21247 affiliation设置为“none”,但他仍然能够向房间发送消息。诗节:
<iq from="21112@domain.com/14965894906297405984175442"
id="change_affiliation"
to="500@conference.domain.com"
type="set"
xmlns="jabber:client">
<query
xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="none" jid="21247@domain.com" nick="21247"/>
</query>
</iq>
据我所知,由于我将affiliation设置为'none',我希望用户21247不能向聊天室发送消息,但仍然可以接收新消息,因为他是聊天室(MucSub)的订户。有人有实现我目标的想法吗?啊,我明白你的意思。您是对的,使用当前的MucSub实现,没有办法限制订阅者向会议室发送消息 我已经填写了一期解释案例并提供了补丁。使用该补丁,有一个房间配置,允许订阅者接收消息,但不发送消息 如果您能够应用修补程序,请编译并安装ejabberd:
我试图设置从属关系='none',我应该用更多的细节来编辑这个问题。现在就做。@Badlop,我根据XEP-0045第9.5节设置了发送一节的从属关系。谢谢,我会尝试的!这是我掌握ejabberd源代码和工作流程的好机会。现在(紧急需要),我会阻止客户。
<iq from="21112@domain.com/14965894906297405984175442"
id="change_affiliation"
to="500@conference.domain.com"
type="set"
xmlns="jabber:client">
<query
xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="none" jid="21247@domain.com" nick="21247"/>
</query>
</iq>
<iq
xmlns='jabber:client'
xml:lang='en'
to='21112@domain.com/14965894906297405984175442'
from='500@conference.domain.com'
type='result'
id='change_affiliation'/>