Kabali
Kabali

Reputation: 129

How to fetch room list from openfire?

I am using openfire server and XMPP protocol for chatting and i got success in it.

Now i want to implement room chatting. I google lots about it, what i get is 'Joing Room', 'Create Room' but first i want to get list of all room name from conferrance.

i have conferance and room in it :

#define CONFERENCE_ROOM_SERVER      @"chatroomforfriends"
#define CONFERENCE_ROOM_NAME        @"cr1"

'chatroomforfriends' is conferance name and it contain 'cr1' room.

How do i fetch all room name in iOS ?

Upvotes: 1

Views: 937

Answers (1)

Shoaib Ahmad Gondal
Shoaib Ahmad Gondal

Reputation: 646

As per MUC XEP (0045) you can get list of all rooms by querying:

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

and you get the response as:

<iq from='chat.shakespeare.lit'
  id='zb8q41f4' to='[email protected]/pda' type='result'>
  <query xmlns='http://jabber.org/protocol/disco#items'>
    <item jid='[email protected]'
      name='A Lonely Heath'/>
    <item jid='[email protected]'
      name='A Dark Cave'/>
    <item jid='[email protected]'
      name='The Palace'/>
    <item jid='[email protected]'
      name='Macbeth&apos;s Castle'/>
  </query>
</iq>

Details are mentioned in XEP-0045

This method returns all public rooms hosted by MUC Service. To get private rooms, or to get rooms of a specific user, you will have to write a plugin to handle your custom query (XMPP Way) or you can write a servlet (HTTP Way) in Openfire for this.

Upvotes: 1

Related Questions