Hello I'm using the muc plugin and trying to get the muc user with the affiliation of 'owner'. i have tried doing this using the onRoster call back which is added when joining a muc.
$scope.XMPPConnection.muc.join(room, $scope.facebookId, onMessage, onPresence, onRoster, '', {maxstanzas : 0} );
function onRoster(roster) {
if($scope.justConnected)
{
$scope.owner = getOwner(roster);
getTrackList();
$scope.justConnected = false;
}
}
function getOwner(data)
{
console.log(data);
console.log("getting the owner");
for (var p in data) {
console.log(p + "are you the owner? ")
if( data[p].affiliation === 'owner') {
return ( p + '@xmpp.url.com' );
}
}
console.log("finishing the owner");
}
When printing the roster data to the console I get all of it but I only get one with a message saying that it is a snapshot. When expanded it has all the occupants.
Object {422733867925336: Occupant}
Am I going about this the right way. It seems like the object isn't fully populated when I try to get the owner and is missing so occupants. Why is this?