I am trying to use this library but I cannot find any documenation on it. The examples that are provided on the GitHub page do not work.
I have a Strophe connection stored uin an object and it is initialised like this:
login: function()
{
var conn = new Strophe.Connection("http://<<MYSERVER>>/http-bind");
var jid = document.getElementById("jid").value;
var password = document.getElementById("password").value;
conn.connect(jid, password , function (status) {
if (status === Strophe.Status.CONNECTED) {
app.on_connected();
} else if (status === Strophe.Status.DISCONNECTED) {
alert("Disconnected");
} else if (status === Strophe.Status.ERROR) {
alert('status ERROR');
} else if (status === Strophe.Status.CONNECTING) {
} else if (status === Strophe.Status.CONNFAIL) {
alert('status CONNFAIL');
} else if (status === Strophe.Status.AUTHENTICATING) {
} else if (status === Strophe.Status.AUTHFAIL) {
alert('status AUTHFAIL');
}
});
app.current_user = jid;
app.connection = conn;
}
I then try to initialise the archive library like this
app.connection.archive.init(app.connection);
and them make this call
app.connection.archive.listCollections(app.current_user, rsm, function (collections, responseRsm) {
//get last collection
var lastCollection = collections[collections.length - 1];
//get last 10 msgs (or all if you please)
rsm = new Strophe.RSM({ 'max': 10, 'before': '' });
lastCollection.retrieveMessages(rsm, function (messages, responseRsm) {
alert("Messages!");
});
});
But nothing happens. What am I doing wrong?
What are the parameters that are passed into 'listCollections'? Is it the currently logged in users JID or the persons who chat history you are trying to fetch?