MySpace Developer Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Does the Online_Friends filter work??

Last post 05-12-2008 4:33 AM by Go Snowball. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 05-12-2008 4:33 AM

    Does the Online_Friends filter work??

     

    Hi,

    I am trying to display the list of friends which are currently online, but the filter does not seem to be working and results in only showing the complete list of friends. The appropriate functions are below. Does the ONLINE_FRIENDS filter work? and if so, what is wrong with my code? Alternatively, is there another way to display the list of online friends?

    Thanks in advance. 

    function getFriendDetails() {
      var os = opensocial.Container.get(); 
      var dataReqObj = os.newDataRequest();  
     //Request Online Friends   
      var onlineFriends_Params = {};        
      onlineFriends_Params[opensocial.DataRequest.PeopleRequestFields.FILTER] =MyOpenSpace.DataRequest.FilterType.ONLINE_FRIENDS; 
      
      var viewerFriendsReq =os.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS,onlineFriends_Params);
      
      dataReqObj.add(viewerFriendsReq,'OnlineFriends');
      dataReqObj.send(dataLoadCallback);
     }

     

     

    // CALL BACK FUNCTION 

    function dataLoadCallback(dataResponse) { 
      if (dataResponse.hadError()) {    
       ...  }
      else {   
       var friendsData = dataResponse.get('OnlineFriends').getData();  
       var friend;
       friendsData.each(    
        function(friendData) {        
         
         /* Store the details of my friends in an array of objects. This facilitates displaying their details
            in the panel at bottom of the screen */
         friend=new Object;
         friend.name=friendData.getField(opensocial.Person.Field.NAME);
         friend.thumb=friendData.getField(opensocial.Person.Field.THUMBNAIL_URL); 
         friend.id=friendData.getField(opensocial.Person.Field.ID); 

    // Display friend details here

        }   
        );

      } 

    }

     

     

Page 1 of 1 (1 items)