I'm developing an iOS Chat Application using XMPP and i'm trying to retrieve chat history in it. For that I'm doing code as below
let newAllData = "my JID"
let value = DDXMLElement(name: "value", stringValue: newAllData)
let child = DDXMLElement(name: "field")
child.addChild(value)
child.addAttribute(withName: "var", stringValue: "with")
let set = XMPPResultSet(max: 5, before: "")
xmppMAM = XMPPMessageArchiveManagement()
xmppStream = XMPPStream()
xmppMAM.activate(xmppNewController.xmppStream)
xmppMAM.retrieveMessageArchive(at: nil, withFields: [child], with: set)
xmppMAM.addDelegate(self, delegateQueue: DispatchQueue.main)
however i'm passing max 5 into XMPPResultSet , i'm getting total messages count instead of 5 messages in XMPPMessageArchiveManagementDelegate methods as below.
func xmppMessageArchiveManagement(_ xmppMessageArchiveManagement: XMPPMessageArchiveManagement, didReceiveMAMMessage message: XMPPMessage) { print("All Data = (message)") }
func xmppMessageArchiveManagement(_ xmppMessageArchiveManagement: XMPPMessageArchiveManagement, didFinishReceivingMessagesWith resultSet: XMPPResultSet) {
}
in didFinishReceivingMessagesWith , i'm getting resultset count but how can i parse that using swift to retrieve history using this method.
or if you have any other way to find XMPP Chat History then also let me know in solution. I'm using ejjaberd with XMPP.
Any help with this would be appreciated. Thanks.