简体   繁体   中英

How to fetch private room list using ejabberd (using their API and/or using XML)?

I know I can retrieve a list of public rooms from my server using:

<iq from='hag66@shakespeare.lit/pda'
    id='zb8q41f4'
    to='chat.shakespeare.lit'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>

XEP-0045 - Discovering Rooms

However, I need a list of all rooms, regardless whether is public or private, and if is online of not.

Any suggestions, specially through XML?

They are not public. I know that using that code above I'm not supposed to retrieve that list. What i need is a way to retrieve the private ones.

When a MUC admin requests the list of rooms, he gets all the rooms, including the private ones.

You can also get the full list of rooms with this ejabberd command:

$ ejabberdctl muc_online_rooms muc.localhost
privateroomcreatedbyuser1@muc.localhost
privateroomcreatedbyuser3@muc.localhost
publicroomcreatedbyuser1@muc.localhost
publicroomcreatedbyuser3@muc.localhost

Those commands can be executed with XML-RPC or ReST calls if you enable the corresponding modules.

If you are using Muc-Sub , then in ejabberd 21.04 there is a new api /api/get_user_subscriptions to get all the subscribed rooms list of a user. You can see Api Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM