Class CarbonExtension

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.FullyQualifiedElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlLangElement

    public class CarbonExtension
    extends java.lang.Object
    implements org.jivesoftware.smack.packet.ExtensionElement
    Stanza extension for XEP-0280: Message Carbons. The extension XEP-0280 is meant to synchronize a message flow to multiple presences of a user.

    It accomplishes this by wrapping a Forwarded stanza in a sent or received element

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NAMESPACE  
    • Constructor Summary

      Constructors 
      Constructor Description
      CarbonExtension​(CarbonExtension.Direction dir, org.jivesoftware.smackx.forward.packet.Forwarded<org.jivesoftware.smack.packet.Message> fwd)
      Construct a Carbon message extension.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static CarbonExtension from​(org.jivesoftware.smack.packet.Message msg)
      Obtain a Carbon from a message, if available.
      CarbonExtension.Direction getDirection()
      Get the direction (sent or received) of the carbon.
      java.lang.String getElementName()  
      org.jivesoftware.smackx.forward.packet.Forwarded<org.jivesoftware.smack.packet.Message> getForwarded()
      Get the forwarded packet.
      static CarbonExtension getFrom​(org.jivesoftware.smack.packet.Message msg)
      Deprecated.
      use from(Message) instead
      java.lang.String getNamespace()  
      org.jivesoftware.smack.util.XmlStringBuilder toXML​(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.jivesoftware.smack.packet.Element

        toXML, toXML
      • Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement

        getLanguage, getQName
    • Constructor Detail

      • CarbonExtension

        public CarbonExtension​(CarbonExtension.Direction dir,
                               org.jivesoftware.smackx.forward.packet.Forwarded<org.jivesoftware.smack.packet.Message> fwd)
        Construct a Carbon message extension.
        Parameters:
        dir - Determines if the carbon is being sent/received
        fwd - The forwarded message.
    • Method Detail

      • getForwarded

        public org.jivesoftware.smackx.forward.packet.Forwarded<org.jivesoftware.smack.packet.Message> getForwarded()
        Get the forwarded packet.
        Returns:
        the Forwarded message contained in this Carbon.
      • getElementName

        public java.lang.String getElementName()
        Specified by:
        getElementName in interface org.jivesoftware.smack.packet.NamedElement
      • getNamespace

        public java.lang.String getNamespace()
        Specified by:
        getNamespace in interface org.jivesoftware.smack.packet.FullyQualifiedElement
      • toXML

        public org.jivesoftware.smack.util.XmlStringBuilder toXML​(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
        Specified by:
        toXML in interface org.jivesoftware.smack.packet.Element
      • getFrom

        @Deprecated
        public static CarbonExtension getFrom​(org.jivesoftware.smack.packet.Message msg)
        Deprecated.
        use from(Message) instead
        Obtain a Carbon from a message, if available.

        Only Message instances can contain a Carbon extensions.

        Parameters:
        msg - Message object to check for carbons
        Returns:
        a Carbon if available, null otherwise.
      • from

        public static CarbonExtension from​(org.jivesoftware.smack.packet.Message msg)
        Obtain a Carbon from a message, if available.

        Only Message instances can contain a Carbon extensions.

        Parameters:
        msg - Message object to check for carbons
        Returns:
        a Carbon if available, null otherwise.