如何过滤iOS中接收到的XMPP状态?

如何过滤iOS中接收到的XMPP状态?,ios,xmpp,xmppframework,user-presence,Ios,Xmpp,Xmppframework,User Presence,我能够成功地在iOS XMPP客户端中接收用户的状态信息。但是在这个状态中有一些我想提取的额外信息。此信息在发送时作为子项添加到状态 以下是我在发送时如何扩展状态: - (void)updatePresence:(NSNotification *)notification { XMPPPresence *presence = [XMPPPresence presence]; NSString *string = [notification object]; // object c

我能够成功地在iOS XMPP客户端中接收用户的状态信息。但是在这个状态中有一些我想提取的额外信息。此信息在发送时作为子项添加到状态

以下是我在发送时如何扩展状态:

- (void)updatePresence:(NSNotification *)notification
{
    XMPPPresence *presence = [XMPPPresence presence];
    NSString *string = [notification object]; // object contains some random string.
    NSXMLElement *status = [NSXMLElement elementWithName:@"status" stringValue:string];
    [presence addChild:status];
    NSLog(@"presence info :- %@",presence);
    [[self xmppStream] sendElement:presence];
}
现在,当我接收到临在时,我想要找回临在的这个扩展部分。怎样才能做到呢

这就是我如何接受存在的方式:

- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
{
    NSString *presenceType = [presence type]; // online / offline
    NSString *myUsername = [[sender myJID] user];
    NSString *presenceFromUser = [[presence from] user];
    NSString *presenceString=[presence fromStr];
    NSString *string = @"@company.com";

    if ([presenceString rangeOfString:string].location == NSNotFound)
    {
        if (![presenceFromUser isEqualToString:myUsername])
        {
            if ([presenceType isEqualToString:@"available"])
            {
                NSMutableDictionary *buddy=[[NSMutableDictionary alloc]init];
                [buddy setObject:presenceFromUser forKey:@"name"];
                [buddy setObject:[presence fromStr] forKey:@"jid"];

                [_chatDelegate newBuddyOnline:buddy];
            }
            else if ([presenceType isEqualToString:@"unavailable"])
            {
                NSMutableDictionary *buddy=[[NSMutableDictionary alloc]init];
                [buddy setObject:presenceFromUser forKey:@"name"];
                [buddy setObject:[presence fromStr] forKey:@"jid"];
                [_chatDelegate buddyWentOffline:buddy];
            }
        }
    }
}

我看起来像这样

    //    <presence xmlns="jabber:client" 
    //    id="Jothb-6" 
    //    from="sender@domain.com/resource" 
    //    to="receiver@domain.com">
    //    <status>Online</status>
    //    <show>presence message</show>
    //    <priority>1</priority>
    //    </presence>

我看起来像这样

    //    <presence xmlns="jabber:client" 
    //    id="Jothb-6" 
    //    from="sender@domain.com/resource" 
    //    to="receiver@domain.com">
    //    <status>Online</status>
    //    <show>presence message</show>
    //    <priority>1</priority>
    //    </presence>

请用NSLOgpresence信息给出您获得的输出:-mngmbhjSo您希望接收的扩展部分是什么?@Sushrut检查我的答案是否对您有帮助。请用NSLOgpresence信息给出您获得的输出:-mngmbhjSo您希望接收的扩展部分是什么?@Sushrut检查我的答案是否对您有帮助。@bhumeshwar-您能发送图像吗和视频通过XMPP@bhumeshwar-你能通过XMPP发送图像和视频吗