Class ExplicitMessageEncryptionElement
- java.lang.Object
-
- org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement
-
- 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 ExplicitMessageEncryptionElement extends java.lang.Object implements org.jivesoftware.smack.packet.ExtensionElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol
-
Constructor Summary
Constructors Constructor Description ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace)
ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace, java.lang.String name)
ExplicitMessageEncryptionElement(ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExplicitMessageEncryptionElement
from(org.jivesoftware.smack.packet.Message message)
java.lang.String
getElementName()
java.lang.String
getEncryptionNamespace()
java.lang.String
getName()
Get the optional name of the encryption method.java.lang.String
getNamespace()
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol
getProtocol()
static boolean
hasProtocol(org.jivesoftware.smack.packet.MessageView message, java.lang.String protocolNamespace)
Return true, if themessage
already contains an EME element with the specifiedprotocolNamespace
.static boolean
hasProtocol(org.jivesoftware.smack.packet.MessageView message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Return true, if themessage
already contains an EME element with the specified protocol namespace.static void
set(org.jivesoftware.smack.packet.MessageBuilder message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Add an EME element containing the specifiedprotocol
namespace to the message.org.jivesoftware.smack.util.XmlStringBuilder
toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
-
-
-
Field Detail
-
ELEMENT
public static final java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
QNAME
public static final javax.xml.namespace.QName QNAME
-
-
Constructor Detail
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace)
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace, java.lang.String name)
-
-
Method Detail
-
getProtocol
public ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol getProtocol()
-
getEncryptionNamespace
public java.lang.String getEncryptionNamespace()
-
getName
public java.lang.String getName()
Get the optional name of the encryption method.- Returns:
- the name of the encryption method or
null
.
-
getElementName
public java.lang.String getElementName()
- Specified by:
getElementName
in interfaceorg.jivesoftware.smack.packet.NamedElement
-
getNamespace
public java.lang.String getNamespace()
- Specified by:
getNamespace
in interfaceorg.jivesoftware.smack.packet.FullyQualifiedElement
-
toXML
public org.jivesoftware.smack.util.XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
- Specified by:
toXML
in interfaceorg.jivesoftware.smack.packet.Element
-
from
public static ExplicitMessageEncryptionElement from(org.jivesoftware.smack.packet.Message message)
-
hasProtocol
public static boolean hasProtocol(org.jivesoftware.smack.packet.MessageView message, java.lang.String protocolNamespace)
Return true, if themessage
already contains an EME element with the specifiedprotocolNamespace
.- Parameters:
message
- messageprotocolNamespace
- namespace- Returns:
- true if message has EME element for that namespace, otherwise false
-
hasProtocol
public static boolean hasProtocol(org.jivesoftware.smack.packet.MessageView message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Return true, if themessage
already contains an EME element with the specified protocol namespace.- Parameters:
message
- messageprotocol
- protocol- Returns:
- true if message has EME element for that namespace, otherwise false
-
set
public static void set(org.jivesoftware.smack.packet.MessageBuilder message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Add an EME element containing the specifiedprotocol
namespace to the message. In case there is already an element with that protocol, we do nothing.- Parameters:
message
- a message builder.protocol
- encryption protocol
-
-