Skip to content Skip to sidebar Skip to footer

How To Retrieve Chat History From Open Fire In Android

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...

Solution 1:

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 :)


Post a Comment for "How To Retrieve Chat History From Open Fire In Android"