{"action":"created","issue":{"url":"https://api.github.com/repos/strophe/strophejs/issues/278","repository_url":"https://api.github.com/repos/strophe/strophejs","labels_url":"https://api.github.com/repos/strophe/strophejs/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/strophe/strophejs/issues/278/comments","events_url":"https://api.github.com/repos/strophe/strophejs/issues/278/events","html_url":"https://github.com/strophe/strophejs/issues/278","id":283482567,"number":278,"title":"Get archived messages using StropheJs","user":{"login":"Veerbhadra277","id":8426382,"avatar_url":"https://avatars1.githubusercontent.com/u/8426382?v=4","gravatar_id":"","url":"https://api.github.com/users/Veerbhadra277","html_url":"https://github.com/Veerbhadra277","followers_url":"https://api.github.com/users/Veerbhadra277/followers","following_url":"https://api.github.com/users/Veerbhadra277/following{/other_user}","gists_url":"https://api.github.com/users/Veerbhadra277/gists{/gist_id}","starred_url":"https://api.github.com/users/Veerbhadra277/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Veerbhadra277/subscriptions","organizations_url":"https://api.github.com/users/Veerbhadra277/orgs","repos_url":"https://api.github.com/users/Veerbhadra277/repos","events_url":"https://api.github.com/users/Veerbhadra277/events{/privacy}","received_events_url":"https://api.github.com/users/Veerbhadra277/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-20T08:20:04Z","updated_at":"2017-12-20T10:57:49Z","closed_at":"2017-12-20T10:57:49Z","author_association":"NONE","body":"I am trying to show the conversation between the two users even after the users logout and login. I mean when user1 logged out and again logged in, he should see the conversations made with the user2. I am using Ejabberd XMPP server and Strophe Js to retrive the messages.\r\n\r\nI am using ejabberd source code version 16.2, and using following lines of code to retrieve archived messages.\r\n\r\n        ```\r\n                       var toJid = 'toJid' + '@' + xmpp_ServerConnection.domain;\r\n\t\t\t\tvar fromJid = 'fromJid' + '@' + xmpp_ServerConnection.domain;\r\n\t\t\t\tvar iq = $iq({ type: 'get', id: fromJid })\r\n\t\t\t\t\t\t.c('query', { xmlns: 'urn:xmpp:mam:1' })\r\n\t\t\t\t\t\t.c('field', { 'var': 'with' })\r\n\t\t\t\t\t\t.c('value')\r\n\t\t\t\t\t\t.t(toJid);\r\n\r\n\t\t\t\txmpp_ServerConnection.sendIQ(iq, function (message) {\r\n```\r\ntry {\r\n\t\t\t\t\t\t\t\t\tvar id = message.querySelector('result').getAttribute('id');\r\n\t\t\t\t\t\t\t\t\tvar fwd = message.querySelector('forwarded');\r\n\t\t\t\t\t\t\t\t\tvar d = fwd.querySelector('delay').getAttribute('stamp');\r\n\t\t\t\t\t\t\t\t\tvar msg = fwd.querySelector('message');\r\n\t\t\t\t\t\t\t\t\tvar msg_data = {\r\n\t\t\t\t\t\t\t\t\t\tid: id,\r\n\t\t\t\t\t\t\t\t\t\twith:Strophe.getBareJidFromJid(msg.getAttribute('to')),\r\n\t\t\t\t\t\t\t\t\t\ttimestamp: (new Date(d)),\r\n\t\t\t\t\t\t\t\t\t\ttimestamp_orig: d,\t\t\t\t\t\t\t\t\t\t\r\n                                                                           from:Strophe.getBareJidFromJid(msg.getAttribute('from')),\r\n\t\t\t\t\t\t\t\t\t\tto: Strophe.getBareJidFromJid(msg.getAttribute('to')),\r\n\t\t\t\t\t\t\t\t\t\ttype: msg.getAttribute('type'),\r\n\t\t\t\t\t\t\t\t\t\tbody: msg.getAttribute('body'),\t\t\t\t\t\t\t\t\t\t\r\n                                                               message:Strophe.getText(msg.getElementsByTagName('body')[0])\r\n\t\t\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\t\tarchive.val(archive.val() + msg_data.from + \":\" + \r\n                                               msg_data.message + \"\\n\" + msg_data.to + \":\" + msg_data.message + \"\\n\");\r\n\t\t\t\t\t\t\t\t\tarchive.scrollTop(archive[0].scrollHeight - archive.height());\r\n\t\t\t\t\t\t\t\t\tconsole.log('xmpp.history.message', msg_data.message);\r\n\t\t\t\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t\t\t\tif (typeof (err) == 'TypeError') {\r\n\t\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t\tconsole.log(err.stack)\r\n\t\t\t\t\t\t\t\t\t\t} catch (err2) {\r\n\t\t\t\t\t\t\t\t\t\t\tconsole.log(err, err2);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\tconsole.log(iq);\r\n\t\t\t\t}\r\n                                        },function (error) {\r\n\r\n});\r\n```\r\n\r\n\r\nbut doesn't get anything on message i got following object in the response success callback.\r\n\r\n```\r\n<iq\r\n\txmlns=\"jabber:client\" from=\"fromJid\" to=\"fromJid\" id=\"fromJid\" type=\"result\">\r\n\t<fin\r\n\t\txmlns=\"urn:xmpp:mam:1\" complete=\"false\">\r\n\t\t<set\r\n\t\t\txmlns=\"http://jabber.org/protocol/rsm\">\r\n\t\t\t<first>1509351242923055</first>\r\n\t\t\t<last>1510224166687524</last>\r\n\t\t\t<count>96</count>\r\n\t\t</set>\r\n\t</fin>\r\n</iq>\r\n```\r\n\r\nCan anyone help me."},"comment":{"url":"https://api.github.com/repos/strophe/strophejs/issues/comments/353032455","html_url":"https://github.com/strophe/strophejs/issues/278#issuecomment-353032455","issue_url":"https://api.github.com/repos/strophe/strophejs/issues/278","id":353032455,"user":{"login":"jcbrand","id":683911,"avatar_url":"https://avatars1.githubusercontent.com/u/683911?v=4","gravatar_id":"","url":"https://api.github.com/users/jcbrand","html_url":"https://github.com/jcbrand","followers_url":"https://api.github.com/users/jcbrand/followers","following_url":"https://api.github.com/users/jcbrand/following{/other_user}","gists_url":"https://api.github.com/users/jcbrand/gists{/gist_id}","starred_url":"https://api.github.com/users/jcbrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcbrand/subscriptions","organizations_url":"https://api.github.com/users/jcbrand/orgs","repos_url":"https://api.github.com/users/jcbrand/repos","events_url":"https://api.github.com/users/jcbrand/events{/privacy}","received_events_url":"https://api.github.com/users/jcbrand/received_events","type":"User","site_admin":false},"created_at":"2017-12-20T10:57:48Z","updated_at":"2017-12-20T10:57:48Z","author_association":"NONE","body":"Duplicate of https://github.com/strophe/strophejs-plugin-mam/issues/7"}}
{"actor":{"display_login":"jcbrand"}}