Class Forwarded<S extends org.jivesoftware.smack.packet.Stanza>
java.lang.Object
org.jivesoftware.smackx.forward.packet.Forwarded<S>
- All Implemented Interfaces:
org.jivesoftware.smack.packet.Element,org.jivesoftware.smack.packet.ExtensionElement,org.jivesoftware.smack.packet.NamedElement,org.jivesoftware.smack.packet.XmlElement,org.jivesoftware.smack.packet.XmlLangElement
public class Forwarded<S extends org.jivesoftware.smack.packet.Stanza>
extends Object
implements org.jivesoftware.smack.packet.ExtensionElement
Stanza extension for XEP-0297: Stanza Forwarding.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionForwarded(DelayInformation delay, S forwardedStanza) Deprecated.Creates a new Forwarded stanza extension.Forwarded(S forwardedStanza, DelayInformation delay) Creates a new Forwarded stanza extension. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.jivesoftware.smack.packet.Message>extractMessagesFrom(Collection<Forwarded<org.jivesoftware.smack.packet.Message>> forwardedCollection) Extract messages in a collection of forwarded elements.static Forwarded<?>from(org.jivesoftware.smack.packet.Stanza packet) Get the forwarded extension.get the timestamp of the forwarded packet.Get the forwarded Stanza found in this extension.booleanisForwarded(Class<? extends org.jivesoftware.smack.packet.Stanza> stanzaClass) Check if this is forwarding a stanza of the provided class.org.jivesoftware.smack.util.XmlStringBuildertoXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jivesoftware.smack.packet.Element
toXML, toXMLMethods inherited from interface org.jivesoftware.smack.packet.XmlElement
getLanguage, getQName
-
Field Details
-
NAMESPACE
- See Also:
-
ELEMENT
- See Also:
-
QNAME
-
-
Constructor Details
-
Forwarded
Deprecated.useForwarded(Stanza, DelayInformation)instead.Creates a new Forwarded stanza extension.- Parameters:
delay- an optionalDelayInformationtimestamp of the packet.forwardedStanza- the stanza that is forwarded (required).
-
Forwarded
Creates a new Forwarded stanza extension.- Parameters:
fwdPacket- the stanza that is forwarded (required).
-
Forwarded
Creates a new Forwarded stanza extension.- Parameters:
forwardedStanza- the stanza that is forwarded (required).delay- an optionalDelayInformationtimestamp of the packet.
-
-
Method Details
-
getElementName
- Specified by:
getElementNamein interfaceorg.jivesoftware.smack.packet.NamedElement
-
getNamespace
- Specified by:
getNamespacein interfaceorg.jivesoftware.smack.packet.XmlElement
-
toXML
public org.jivesoftware.smack.util.XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) - Specified by:
toXMLin interfaceorg.jivesoftware.smack.packet.Element
-
getForwardedStanza
Get the forwarded Stanza found in this extension.- Returns:
- the
Stanza(typically a message) that was forwarded.
-
getDelayInformation
get the timestamp of the forwarded packet.- Returns:
- the
DelayInformationrepresenting the time when the original stanza was sent. May be null.
-
isForwarded
Check if this is forwarding a stanza of the provided class.- Parameters:
stanzaClass- the class to check for.- Returns:
trueif this is forwarding a stanza of the provided class.- Since:
- 4.4
-
from
Get the forwarded extension.- Parameters:
packet- TODO javadoc me please- Returns:
- the Forwarded extension or null
-
extractMessagesFrom
public static List<org.jivesoftware.smack.packet.Message> extractMessagesFrom(Collection<Forwarded<org.jivesoftware.smack.packet.Message>> forwardedCollection) Extract messages in a collection of forwarded elements. Note that it is required that theForwardedin the given collection only containMessagestanzas.- Parameters:
forwardedCollection- the collection to extract from.- Returns:
- a list a the extracted messages.
- Since:
- 4.3.0
-
Forwarded(Stanza, DelayInformation)instead.