powered by Jive Software

Conference room name and the number of occupants

Im looking to get the names of all the conference rooms

on a server and the number of occupants in each room.

I am sending the following packet to my server:

<iq type=’‘get’’ to=’‘conference.hellboy.com’’><query xmlns=’‘jabber:iq:browse’’/>

and it returns back the following(the following output is from the smack debugger)

<iq type=’‘result’’ to=’‘hellboy@localserver/Smack’’ from=’‘conference.hellboy.com’’><item xmlns=’‘jabber:iq:browse’’ category=’‘conference’’ type=’‘public’’ jid=’‘conference.hellboy.com’’ name=’‘Public Chatrooms’’>http://jabber.org/protocol/muchttp://jabber.org/protocol/discojabber:iq:browsejabber:iq:versionjabber:iq:time< ns>jabber:iq:lastvcard-temp<item category=’‘conference’’ type=’‘public’’ jid=’‘work@conference.hellboy.com’’ name=’‘work (1/30)’’/><item category=’‘conference’’ type=’‘public’’ jid=’‘notcool@conference.hellboy.com’’ name=’‘notcool (1/30)’’/><item category=’‘conference’’ type=’‘public’’ jid=’‘thezip@conference.hellboy.com’’ name=’‘thezip (1/30)’’/><item category=’‘conference’’ type=’‘public’’ jid=’‘cool@conference.hellboy.com’’ name=’‘cool (2/30)’’/><item category=’‘conference’’ type=’‘public’’ jid=’‘pizza@conference.hellboy.com’’ name=’‘pizza (2/30)’’/>

my question is how do I access: name=’‘notcool(1/30)’’,

name=’‘cool(2/30)’’ etc…?

I followed all the steps in the post by: bjiggs

Topic: Getting a list of conference rooms

with no luck…

this is the iqProvider im trying to use

conference

jabber:iq:browse

org.jivesoftware.smackx.packet.Browse

and here is Browse class

package org.jivesoftware.smackx.packet;

import org.jivesoftware.smack.packet.IQ;

public class Browse extends IQ

{

private String conference;

/**

  • Creates a new instance of Browse

*/

public Browse()

{

setType(IQ.Type.GET);

}

public String getChildElementXML()

{

return null;

}

protected void setConference(String conf)

{

this.conference = conf;

}

protected String getConference()

{

return conference;

}

}

I used a “addPacketListener” grab packets which are

filtered by Type.RESULT and getfrom

all unfiltered packets I print with:

System.out.println("XML: " + iqPacket.toXML() + “\n”);

Here is what the final output is:

for some reason I am missing alot of the raw data

Thanks for your help and time

Scott

You shouldn’'t be using jabber:iq:browse to discover the rooms within a server. Instead use disco (service discovery) which replaced browsing.

Follow this other thread to get an idea of how to get the available rooms. http://www.jivesoftware.com/jive/thread.jspa?threadID=12970&tstart=30

A MUC implementation is not required to provide the number of occupants of a given room. Instead you can try to get the list of occupants within a room.

Regards,

– Gato

Thank you for responding so quickly.

My original implementation was done using the service discovery, but I couldind a way to get the number of occupants of a given room without implementing a MUC and using m_muc.getParticipantCount().

If I’'m reading this right:

"A MUC implementation is not required to provide the number of occupants of a given room. Instead you can try to get the list of occupants within a room.

I can get a list of the occupants of a given conference room without joining it and using getParticipantCount() and than leaving.

If this is so can you please tell me how?

This is the code I’'m using to discover all the conference rooms on my server.

ServiceDiscoveryManager sDM;

sDM = new ServiceDiscoveryManager(connection);

// Discover the room hosted by the service

DiscoverItems result = sDM.discoverItems(“hellboy.com”);

// Print to the console the room JID of each room

Iterator items = result.getItems();

while (items.hasNext())

{

System.out.println(“Room JID:” + ((DiscoverItems.Item) items.next()).getEntityID());

}

}

Thanks again

Scott

Scott,

Your code is sending a disco#items request to the MUC service itself which will return the public rooms. Instead, you could try to send a disco#items request to a given public MUC room which will return the list of existing occupants if that information is publicly available.

Regards,

– Gato

Gato,

I’'m using the code below to discover item of a give MUC and there does not seem to be any items to discover because I never make it into the while

loop…

ServiceDiscoveryManager sDM;

sDM = new ServiceDiscoveryManager(connection);

     DiscoverItems result = sDM.discoverItems("pizza@conference.hellboy.com");

Iterator items = result.getItems();

while (items.hasNext())

{

System.out.println(“WHILE LOOP”);

DiscoverItems.Item currentItem = (DiscoverItems.Item) items.next();

System.out.println(“Room JID:” + currentItem.getEntityID());

System.out.println("Name: " + currentItem.getName());

System.out.println("Node: " + currentItem.getNode());

}

Why can I see the number of people in a conference room

in the raw received data of the debugger when using jabber:iq:browse, but with disco#items I receive the following

raw recieved data

<iq to=’‘hellboy@localhost/Smack’’ type=’‘result’’ from=’‘pizza@conference.hellboy.com’’><query xmlns=’‘http://jabber.org/protocol/disco#items’’/>

Thanks for your help,

Scott

Scott,

Unfortunately there isn’'t much you can do. It seems that the room does not have that information available for the public or the MUC implementation on the server does not support that feature.

FYI, the MUC specification says that a server must support service discover (disco). Besides, service discovery is a replacement for browsing (jabber:iq:browse). So if you are implementing a client that you want it to work with any kind of server, you can only rely on disco. But if you know that you are ONLY going to work with the server that you are currently using, you can try to use browsing to get the information you need.

Regards,

– Gato

Gato,

I just wanted to say thanks for all your help…

Scott

Scott,

One thing you can try to get the number of occupants of a given room is check if the MUC implementation on the server provides that information when asked for the room info. That is, check if the response of a disco#info sent to a given room includes a data form. It’'s possible that the number of occupants is included in the dataform.

Regards,

– Gato