1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 07:42:06 +01:00

[mam] Improve MamResultExtension: use MessageView in from() and add QNAME

This commit is contained in:
Florian Schmaus 2020-08-28 09:47:54 +02:00
parent 1aab0b8aac
commit 99297e5a76

View file

@ -18,9 +18,11 @@ package org.jivesoftware.smackx.mam.element;
import java.util.List;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.MessageView;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
@ -54,6 +56,11 @@ public class MamElements {
*/
public static final String ELEMENT = "result";
/**
* The qualified name of the MAM result extension element.
*/
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
/**
* id of the result.
*/
@ -139,8 +146,8 @@ public class MamElements {
return xml;
}
public static MamResultExtension from(Message message) {
return (MamResultExtension) message.getExtensionElement(ELEMENT, NAMESPACE);
public static MamResultExtension from(MessageView message) {
return message.getExtension(MamResultExtension.class);
}
}