如何获得ejabberd / XMPP中所有在线用户的列表? [英] How do I get a list of all online users in ejabberd/XMPP?
问题描述
假设我是管理员且XEP-133无法正常工作并且不在他们的名单中,我如何在XMPP中获取所有在线用户的列表?
How do I get a list of all users online in XMPP assuming that I'm an admin and XEP-133 does not work and I'm not in their roster?
推荐答案
XEP-133中的大多数命令 do 与ejabberd都可以正常工作。
Most commands in XEP-133 do work fine with ejabberd.
您确实对某些特定命令不起作用(包括使在线用户成功)是正确的:我发现,尽管有针对ejabberd的非标准替代方法:
You are indeed right about some particular commands not working including getting the online-users: I discovered though there are non-standard alternatives specific to ejabberd:
如果您在主机上运行 disco#items
可以查询一些有趣的项目:
If you run a disco#items
on the host you get some interesting items you can query:
<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>
现在,如果您需要在线用户,则:
Now in you case you need the "Online Users" so:
<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>
将像护身符;)
这篇关于如何获得ejabberd / XMPP中所有在线用户的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!