How to retrieve chat history from open fire in android

后端 未结 1 1453
伪装坚强ぢ
伪装坚强ぢ 2021-01-01 06:40

I have a chat app in which I want to retrieve chat history between two users, I have a stanza for retrieving chat messages and that is...

    

        
相关标签:
1条回答
  • 2021-01-01 07:12
    NSXMLElement *iQ = [NSXMLElement elementWithName:@"iq"];
    [iQ addAttributeWithName:@"type" stringValue:@"get"];
    [iQ addAttributeWithName:@"id" stringValue:@"987654321"];
    
    NSXMLElement *list = [NSXMLElement elementWithName:@"list"];
    [list addAttributeWithName:@"xmlns" stringValue:@"urn:xmpp:archive"];
    [list addAttributeWithName:@"with" stringValue:@"bhushan@mydomain.com"];
    
    
    
    NSXMLElement *set = [NSXMLElement elementWithName:@"set"];
    [set addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/rsm"];
    
    NSXMLElement *max = [NSXMLElement elementWithName:@"max"];
    [max addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/rsm"];
    max.stringValue = @"30";
    
    [set addChild:max];
    
    [list addChild:set];
    [iQ addChild:list];
    [[[self appDelegate] xmppStream] sendElement:iQ];
    

    You can call like this. Hope this helps :)

    0 讨论(0)
提交回复
热议问题