Cómo enumerar solo usuarios en línea en Facebook con xmpp framework

He integrado xmpp en mi aplicación y puedo enumerar a todos los usuarios en una vista de tabla, pero solo quiero mostrar los usuarios en línea y luego quiero implementar la función para enviar y recibir mensajes a mis amigos en línea ...

Por favor sugiérame algún código útil ...

Aquí está mi código, ejecutado después de iniciar sesión en Facebook.

    - (void)fbDidLogin
{
    NSLog(@"logged in.....................");
    [appDelegate.facebook requestWithGraphPath:@"me" andDelegate:self]; 

    DDLogVerbose(@"%s accessToken: %@ expirationDate: %@",__PRETTY_FUNCTION__,appDelegate.facebook.accessToken,appDelegate.facebook.expirationDate);
    self.accessToken = appDelegate.facebook.accessToken;

    if (xmppStreamFB) {  
        [xmppStreamFB release];  
        xmppStreamFB = nil;  
    }
    xmppStreamFB = [[XMPPStreamFacebook alloc] init];
    xmpReconnect = [[XMPPReconnect alloc] initWithStream:xmppStreamFB];  

    if (xmppRosterStorage) {  
        [xmppRosterStorage release];  
        xmppRosterStorage = nil;  
    }
    xmppRosterStorage = [[XMPPRosterCoreDataStorage alloc] init];

    if (xmppRoster) {  
        [xmppRoster release];  
        xmppRoster = nil;  
    } 
    xmppRoster = [[XMPPRoster alloc] initWithStream:xmppStreamFB rosterStorage:xmppRosterStorage];

    [xmppStreamFB addDelegate:self];
    [xmppRoster addDelegate:self];
    [xmppRoster setAutoRoster:YES];

    xmppStreamFB.myJID = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@chat.facebook.com", uid]];

    // You may need to alter these settings depending on the server you're connecting to
    allowSelfSignedCertificates = NO;
    allowSSLHostNameMismatch = YES;

    // Uncomment me when the proper information has been entered above.
    NSError *error = nil;
    if (![xmppStreamFB connect:&error]) 
        NSLog(@"Error connecting: %@", error);

    if(!tableView)
    {
        tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0, 480, 320) style:UITableViewStylePlain];
    }
    [tableView setFrame:CGRectMake(0,0, 480, 320)];
    [tableView setTag:2];
    [tableView setDelegate:self];
    [tableView setDataSource:self];
    [tableView setHidden:NO];
    [tableView setBackgroundColor:[UIColor clearColor]];
    [tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    [tableView setAlpha:1.0];

    [self.view addSubview:tableView];

    [self.tableView reloadData];
    [self showTopBar];

}

No conozco el flujo real del marco xmpp para mostrar a los usuarios en línea e implementar la función de chat ...

i have the following delegate methods as well..

    - (void)xmppStreamDidSecure:(XMPPStreamFacebook *)sender
{
    NSLog(@"---------- xmppStreamDidSecure: ----------");
}

- (void)xmppStreamDidConnect:(XMPPStreamFacebook *)sender
{
    NSLog(@"---------- xmppStreamDidConnect: ----------");

    isOpen = YES;

    NSError *error = nil;

    if (![self.xmppStreamFB authenticateWithAppId:_APP_ID accessToken:self.accessToken error:&error])
    {
        NSLog(@"Error authenticating: %@", error);
    }
    else {
        NSLog(@"NO Error authenticating:");
        /*
        ChatViewController *cvc = [[ChatViewController alloc] init];
        [self.view addSubview:cvc.view];*/
    }

}
- (void)xmppStreamDidAuthenticate:(XMPPStream *)sender
{
    NSLog(@"---------- xmppStreamDidAuthenticate: ----------");

    [self goOnline];
}

- (void)xmppStream:(XMPPStream *)sender didNotAuthenticate:(NSXMLElement *)error
{
    NSLog(@"---------- xmppStream:didNotAuthenticate: ----------");
}

- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
    NSLog(@"---------- xmppStream:didReceiveIQ: ----------");
    /*
    ChatViewController *cvc = [[ChatViewController alloc] init];
    [self.view addSubview:cvc.view];*/

    return NO;
}

- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
{
    NSLog(@"---------- xmppStream:didReceiveMessage: ----------");
}

- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
{
    NSLog(@"---------- xmppStream:didReceivePresence: ----------");

}

- (void)xmppStream:(XMPPStream *)sender didReceiveError:(id)error
{
    NSLog(@"---------- xmppStream:didReceiveError: ----------");
}

- (void)xmppStreamDidDisconnect:(XMPPStream *)sender
{
    NSLog(@"---------- xmppStreamDidDisconnect: ----------");

    if (!isOpen)
    {
        NSLog(@"Unable to connect to server. Check xmppStream.hostName");
    }
}

Y los dos métodos para la presencia de usuarios en línea y fuera de línea, pero no sé cómo modificarlos para mi tarea:

    - (void)goOnline
{
    NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"];

    [[self xmppStream] sendElement:presence];
}

- (void)goOffline
{
    NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"];
    [presence addAttributeWithName:@"type" stringValue:@"unavailable"];

    [[self xmppStream] sendElement:presence];
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta