gpt4 book ai didi

xmpp - 发现 MUC 房间的成员作为占用者

转载 作者:行者123 更新时间:2023-12-01 19:06:50 24 4
gpt4 key购买 nike

作为占用者/成员,我需要了解 ejabberd-14.x 房间中的所有“成员”

我关注了http://xmpp.org/extensions/xep-0045.html#getmemberlist

我因以下节而被禁止 (401) - 需要管理员权限

<iq from='crone1@shakespeare.lit/desktop'
id='member3'
to='coven@chat.shakespeare.lit'
type='get'>
<query xmlns='http://jabber.org/protocol/muc#admin'>
<item affiliation='member'/>
</query>
</iq>

如果我改变

<query xmlns='http://jabber.org/protocol/muc#admin'> 

从管理员到用户命名空间,然后我收到状态代码 501 - 功能未实现

您知道如何才能成为房间的成员或成员吗?

在此用例中我不是管理员/版主。

XEP-0045 确实说:

Note: A service SHOULD also return the member list to any occupant in a members-only room; i.e., it SHOULD NOT generate a error when a member in the room requests the member list. This functionality can assist clients in showing all the existing members even if some of them are not in the room, e.g. to help a member determine if another user should be invited. A service SHOULD also allow any member to retrieve the member list even if not yet an occupant.

最佳答案

您自己至少需要成为成员(member)才能访问附属列表。您当前是否是居住者(即在房间内)并不重要。

请注意,从属关系(例如“成员”)是一种持久设置,需要明确指定给人员,否则默认为“无”。在正常的不受限制的房间里,this setting doesn't have any other effect than allowing you to retrieve the member list 。成员列表与占用者列表无关。

(如果您只想知道当前谁在房间里,您应该发送带有命名空间 http://jabber.org/protocol/disco#items 而不是 的查询muc#admin。)

示例(刚刚在我的 ejabberd 服务器上尝试过)。尝试使用非关联帐户查询列表:

<iq from='crone1@shakespeare.lit/desktop'
id='member3'
to='coven@chat.shakespeare.lit'
type='get'>
<query xmlns='http://jabber.org/protocol/muc#admin'>
<item affiliation='member'/>
</query>
</iq>
<iq from='coven@chat.shakespeare.lit'
to='crone1@shakespeare.lit/desktop'
type='error'
id='member3'>
<query xmlns='http://jabber.org/protocol/muc#admin'>
<item affiliation='member'/>
</query>
<error code='403' type='auth'>
<forbidden/>
<text>Administrator privileges required</text>
</error>
</iq>

使用特权(房间所有者)帐户授予第一个帐户成员权限:

<iq from='admin@shakespeare.lit/desktop'
type='set'
to='coven@chat.shakespeare.lit'
id='member4'>
<query xmlns='http://jabber.org/protocol/muc#admin'>
<item jid='crone1@shakespeare.lit' affiliation='member'/>
</query>
</iq>

<iq to='admin@shakespeare.lit/desktop'
from='coven@chat.shakespeare.lit'
type='result' id='member4'/>

再试一次:

<iq from='crone1@shakespeare.lit/desktop' 
type='get'
to='coven@chat.shakespeare.lit'
id='member5'>
<query xmlns='http://jabber.org/protocol/muc#admin'>
<item affiliation='member'/>
</query>
</iq>

<iq to='crone1@shakespeare.lit/desktop'
from='coven@chat.shakespeare.lit'
type='result'
id='member5'>
<query xmlns='http://jabber.org/protocol/muc#admin'>
<item jid='crone1@shakespeare.lit' affiliation='member'/>
</query>
</iq>

关于xmpp - 发现 MUC 房间的成员作为占用者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27393540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com