You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I am using ejabberd source code version 16.2, and using following lines of code to retrieve archived messages.
```
var toJid = 'toJid' + '@' + xmpp_ServerConnection.domain;
var fromJid = 'fromJid' + '@' + xmpp_ServerConnection.domain;
var iq = $iq({ type: 'get', id: fromJid })
.c('query', { xmlns: 'urn:xmpp:mam:1' })
.c('field', { 'var': 'with' })
.c('value')
.t(toJid);
xmpp_ServerConnection.sendIQ(iq, function (message) {
try {
var id = message.querySelector('result').getAttribute('id');
var fwd = message.querySelector('forwarded');
var d = fwd.querySelector('delay').getAttribute('stamp');
var msg = fwd.querySelector('message');
var msg_data = {
id: id,
with:Strophe.getBareJidFromJid(msg.getAttribute('to')),
timestamp: (new Date(d)),
timestamp_orig: d,
from:Strophe.getBareJidFromJid(msg.getAttribute('from')),
to: Strophe.getBareJidFromJid(msg.getAttribute('to')),
type: msg.getAttribute('type'),
body: msg.getAttribute('body'),
message:Strophe.getText(msg.getElementsByTagName('body')[0])
};
archive.val(archive.val() + msg_data.from + ":" +
msg_data.message + "\n" + msg_data.to + ":" + msg_data.message + "\n");
archive.scrollTop(archive[0].scrollHeight - archive.height());
console.log('xmpp.history.message', msg_data.message);
} catch (err) {
if (typeof (err) == 'TypeError') {
try {
console.log(err.stack)
} catch (err2) {
console.log(err, err2);
}
}
}
console.log(iq);
}
},function (error) {
});
but doesn't get anything on message i got following object in the response success callback.
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.
I am using ejabberd source code version 16.2, and using following lines of code to retrieve archived messages.
but doesn't get anything on message i got following object in the response success callback.
Can anyone help me.
The text was updated successfully, but these errors were encountered: