use of de.pixart.messenger.xmpp.stanzas.AbstractStanza in project Pix-Art-Messenger by kriztan.
the class AbstractParser method parseTimestamp.
public static Long parseTimestamp(Element element, Long d, boolean ignoreCsiAndSm) {
long min = Long.MAX_VALUE;
boolean returnDefault = true;
final Jid to;
if (ignoreCsiAndSm && element instanceof AbstractStanza) {
to = ((AbstractStanza) element).getTo();
} else {
to = null;
}
for (Element child : element.getChildren()) {
if ("delay".equals(child.getName()) && "urn:xmpp:delay".equals(child.getNamespace())) {
final Jid f = to == null ? null : child.getAttributeAsJid("from");
if (f != null && (to.toBareJid().equals(f) || to.getDomainpart().equals(f.toString()))) {
continue;
}
final String stamp = child.getAttribute("stamp");
if (stamp != null) {
try {
min = Math.min(min, AbstractParser.parseTimestamp(stamp));
returnDefault = false;
} catch (Throwable t) {
// ignore
}
}
}
}
if (returnDefault) {
return d;
} else {
return min;
}
}
Aggregations