After upgrading to beta3 I found the roster example no longer works.
There’'s a fix by guido in function fetchRoster_result
but it actually breaks the code.
there’'s a new line (line 458)
var item = newItems
just under a commented line (line 457)
var item = newItems[ i ]
that’'s the code breaker!
I think the code should be something like this:
/** * */
private function fetchRoster_result( resultIQ:IQ ):Void
{
// Clear out the old roster
rosterItems.removeAll();
// Go through the result IQ and add each item
var ext:RosterExtension = resultIQ.getAllExtensionsByNS( RosterExtension.NS )[0];
var newItems = ext.getAllItems();
for( var i=0; i < newItems.length; i++ ) {
var item = newItems[ i ];
if( item.getGroups().length > 0 ){
//if a user is in several groups, add it as item for each group. Fix by guido
for (var j=0; j < item.getGroups().length;j++) {
addRosterItem( item.jid, item.name, RosterExtension.SHOW_UNAVAILABLE, "Offline", item.getGroups()[j], item.subscription.toLowerCase() );
}
}else{
addRosterItem( item.jid, item.name, RosterExtension.SHOW_UNAVAILABLE, "Offline", "General", item.subscription.toLowerCase() );
}
}
}
/** * */
am I correct ?
grtz
Gepatto