I\'m reading http://xmpp.org/extensions/xep-0313.html to query Ejabberd for messages archived with a certain user.
This is the xml that I\'m sending:
People who would like to use Smack to fetch this can use below code
public MamManager.MamQueryResult getArchivedMessages(String jid, int maxResults) {
MamManager mamManager = MamManager.getInstanceFor(connection);
try {
DataForm form = new DataForm(DataForm.Type.submit);
FormField field = new FormField(FormField.FORM_TYPE);
field.setType(FormField.Type.hidden);
field.addValue(MamElements.NAMESPACE);
form.addField(field);
FormField formField = new FormField("with");
formField.addValue(jid);
form.addField(formField);
// "" empty string for before
RSMSet rsmSet = new RSMSet(maxResults, "", RSMSet.PageDirection.before);
MamManager.MamQueryResult mamQueryResult = mamManager.page(form, rsmSet);
return mamQueryResult;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}