powered by Jive Software

Buddy information

Hey people,

how can I get information about the user that is connected(myRoster)? I want to print the user display name in my interface.

Tks.

Luis

Message was edited by:

lgrweb

//import stuff

import org.jivesoftware.xiff.data.im.RosterExtension;

import org.jivesoftware.xiff.data.im.RosterItem;

//enable the extension, dont forget it

RosterExtension.enable();

//make an iq, notice the handler and add the roster extension

var iq:IQ = new IQ(null, IQ.GET_TYPE, null, “handleIQRoster”, this);

var ext:RosterExtension = new RosterExtension();

iq.addExtension(ext);

connection.send( iq );

//event handler that gets called when the server reply’'s

function handleIQRoster(iq:IQ) {

//find the roster extension in the reply

var ext:RosterExtension = iq.getAllExtensionsByNS(RosterExtension.NS)[0]

var myItems:Array = ext.getAllItems();

for (var i = 0; i < myItems.length; i++) {

var item:RosterItem = myItems[i];

// do something with the items

trace(item.name);

}

}