for (Iterator<Element> elements = chat.getTranscript().elementIterator(); elements.hasNext();) {
Element element = elements.next();
// Only add Messages to the index (Presences are discarded)
if ("message".equals(element.getName())) {
// TODO Index XHTML bodies?
String body = element.elementTextTrim("body");
String from = element.attributeValue("from");
String to = element.attributeValue("to");
String fromNickname = new JID(from).getResource();
String toNickname = new JID(to).getResource();