powered by Jive Software

Know if a room is full!

How do I know if a room is full before trying to connect?

If the room is correctly configured, you can discover the nicknames of the users inside. So can you count these, and if you have a limited size room, you’‘ll be able to say "this room is a 2 user room, I count 1 user, this room isn’'t full"

now the code (because I now you’'re waiting for it )

import org.jivesoftware.xiff.core.Browser;

import org.jivesoftware.xiff.data.disco.ItemDiscoExtension;

bro:Browser=new Browser(connection);

function service_result( resultIQ:IQ ):Void

{

var ext:ItemDiscoExtension = resultIQ.getAllExtensionsByNS( ItemDiscoExtension.NS )[0];

var newItems = ext.items;

trace(“this room is occupied by “newItems.length” players of chess”);

};

var yourRoomJID=“chess007@conference.YOURDOMAIN.DTC”;

/i

And when you are ready to send it, just execute this line

bro.getServiceItems(yourRoomJID,“service_result”,_root);[/i]

Put this code in your root or change the callback object (the “root”) and try, I think i didn’'t forgot things…

If someone have an other version, it interests me…

I used to work with the “browseItem” function, which was returning the room occupation, but it doesn’'t work since I replaced my old jabber 1.4.3 by a Jive Messenger

Hi there!

I was just looking on the web and noticed these posts:

http://mail.jabber.org/pipermail/standards-jig/2005-January/006925.html

http://www.oreilly.com/catalog/jabber/chapter/ch05.html

(Search for Table 5-3)

It looks like a 405 error will be thrown if you try and join a room that is too full… So i’'m assuming that there will be an error received in XIFF that will let you see that this has happened!

Hope it helps!

Brad.