gpt4 book ai didi

xmpp - 如何获取 ejabberd/XMPP 中所有在线用户的列表?

转载 作者:行者123 更新时间:2023-12-02 13:40:32 24 4
gpt4 key购买 nike

假设我是管理员并且 XEP-133 不起作用并且我不在他们的名册中,如何获取 XMPP 中所有在线用户的列表?

最佳答案

XEP-133 中的大多数命令都可以在 ejabberd 中正常工作。

关于某些特定命令不起作用(包括获取在线用户)的说法,您确实是正确的:我发现虽然有特定于 ejabberd 的非标准替代方案:

如果您在主机上运行 disco#items,您会得到一些可以查询的有趣项目:

<iq to="localhost" type="get" id="123">
<query xmlns='http://jabber.org/protocol/disco#items' />
</iq>


<iq from="localhost" type="result" to="admin@localhost/jarnas" id="123">
<query xmlns="http://jabber.org/protocol/disco#items">
<item jid="conference.localhost" />
<item jid="pubsub.localhost" />
<item jid="riot.localhost" />
<item jid="vjud.localhost" />
<item node="announce" name="Announcements" jid="localhost" />
<item node="config" name="Configuration" jid="localhost" />
<item node="user" name="User Management" jid="localhost" />
<item node="online users" name="Online Users" jid="localhost" />
<item node="all users" name="All Users" jid="localhost" />
<item node="outgoing s2s" name="Outgoing s2s Connections" jid="localhost" />
<item node="running nodes" name="Running Nodes" jid="localhost" />
<item node="stopped nodes" name="Stopped Nodes" jid="localhost" />
</query>
</iq>

现在,在您的情况下,您需要“在线用户”,因此:

<iq to="localhost" type="get" id="234">
<query xmlns='http://jabber.org/protocol/disco#items' node="online users"/>
</iq>

<iq from="localhost" type="result" to="admin@localhost/jarnas" id="234" >
<query xmlns="http://jabber.org/protocol/disco#items" node="online users" >
<item name="admin@localhost" jid="admin@localhost/auto-CdB67NUOie" />
<item name="admin@localhost" jid="admin@localhost/jarnas" />
</query>
</iq>

会像魅力一样发挥作用;)

关于xmpp - 如何获取 ejabberd/XMPP 中所有在线用户的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9610091/

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