XMPPFramework icon indicating copy to clipboard operation
XMPPFramework copied to clipboard

mam not sort message from query

Open dan085 opened this issue 3 years ago • 3 comments

  let xmppDateString = NSDate().xmppDateTimeString
        
        var fields: [XMLElement] = []
        let start = XMPPMessageArchiveManagement.field(withVar: "end", type: nil, andValue: xmppDateString)
        fields.append(start)
        
        
        print(self.mam_info.entityBareId+ServiceName_arroa)
         let value = DDXMLElement(name: NTConstants.value, stringValue: self.mam_info.entityBareId+ServiceName_arroa)
        let child = DDXMLElement(name: NTConstants.field)
        child.addChild(value)
        child.addAttribute(withName: NTConstants.varXMPP, stringValue: NTConstants.with)
        let set = XMPPResultSet(max: 40, before:  "")
        xmmpMessageArchiveManagement!.retrieveMessageArchive(at: XMPPJID(string: self.mam_info.entityBareId+ServiceName_arroa), withFields: fields, with: set)

dan085 avatar Oct 11 '20 03:10 dan085

hi

I try to retrieve chat history from XMPP. I am also done this code in my project but its not working.

please clarify this issue.

Abishekt97 avatar Nov 07 '20 07:11 Abishekt97

@Abishekt97 Hi , It worked for me to obtain the historial, I have to review it .. there we could talk about it and help us too

dan085 avatar Nov 09 '20 15:11 dan085

hi @dverdugo85 thanks for your replay

My code

let xmppDateString = NSDate().xmppDateTimeString var fields: [XMLElement] = [] let start = XMPPMessageArchiveManagement.field(withVar: "end", type: nil, andValue: xmppDateString) fields.append(start) let value = DDXMLElement(name: "value", stringValue: user) let child = DDXMLElement(name: "field") child.addChild(value) child.addAttribute(withName: "var", stringValue: "with") let set = XMPPResultSet(max: 20, before: "") fields.append(child) xmppMAM?.retrieveMessageArchive(at: XMPPJID(string: user), withFields: fields, with: set)

But its not working. please visit my stack overflow question and if you know please answer https://stackoverflow.com/questions/64749713/issue-on-retrieve-the-xmpp-archived-message-from-ejabberd-serverchat-history

Abishekt97 avatar Nov 10 '20 04:11 Abishekt97