Getting a listing of existing rooms in a conference server

A few months back, there was this post:

which had some incomplete code to list rooms. Is it really this complicated to list rooms, or is there now some sort of listRooms() function in the XIFF library now (AS3 library)?

At the very least, any listRooms() function would require a callback function similar to what was described in that message, since looking up the rooms is an asynchronous process. That code is 98% of the way there, it should be relatively simple to adapt it for your purposes.

How would one do that in AS3 ?

connection = new XMPPConnection();

browser = new Browser(connection);

browser.getServiceItems(conferenceServer, “serviceItemsCall”, this);

public function serviceItemsCall(iq:IQ):void {

var itemExt:ItemDiscoExtension = iq.getAllExtensions()[0];

trace("serviceItemsCall. itemExt.items.length: " + itemExt.items.length);

for( var i:uint = 0; i < itemExt.items.length; i++) {

            trace("serviceItemsCall: " + itemExt.items[i].name + " [" + itemExt.items[http://i].jid + "|http://i].jid + "]");

}

}

Of cource then you need to define the settings for your connection and there is also a variable “conferenceServer” used here which should have a proper value.

Good luck, that is needed.

public var connection:XMPPConnection = new XMPPConnection;
public var browser:Browser = new Browser(connection);
public var server:JID = new JID(“conference.tcloi”);

    public function getRoom():void       
    {   
       browser.getServiceItems(server, "browser_result", this);          
    }
    public function browser_result(iq:IQ):void
    {
        //Alert.show("called");
        var itemExt:ItemDiscoExtension = iq.getAllExtensions()[0];

trace(“browser_result.itemExt.items.length:” + itemExt.items.length);

for (var i:int = 0; i <= itemExt.items.length; i++)
{
trace(“browser_result:” + itemExt.items[i].name + “[” + itemExt.items[i].jid + “]”);
}
}

When I run program, call functiion getRoom() but It not call function browser_result().

fix code help me. thank so much