假设我是管理员,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>