powered by Jive Software

How can I get the user data of a user in roster?

My question is similar to thread http://www.jivesoftware.org/community/thread.jspa?messageID=105390

but the answer to that one didn’'t satisfy me.

If I use this code:

//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);

}

}

… I get all the items in the roster, right? Well, I need to get the item that the user has clicked on ( selected ) in the roster. If it is possible at all, how can I do that?

Ok, found the solution - had to use roster.selectedItem.jid.

Case closed.