public final class Addresses
extends java.lang.Object
The implementation of the <addresses/>
element in the http://jabber.org/protocol/address
namespace..
Use this class to add extended address information to a stanza.
Address address = new Address(Address.Type.CC, Jid.of("juliet@example.net"));
Addresses addresses = new Addresses(Arrays.asList(address));
Message message = new Message(Jid.of("romeo@example.net"));
message.addExtension(addresses);
To create a reply use createReply(Message, Message)
:
Message replyMessage = new Message();
boolean replyGenerated = Addresses.createReply(originalMessage, replyMessage);
This will append an address extension to the reply message according to the business rules.
This class is immutable.
Address
Constructor and Description |
---|
Addresses(Address... address)
Creates an address extension.
|
Addresses(java.util.Collection<Address> addresses)
Creates an address extension.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
createReply(Message original,
Message reply)
Creates a reply for a message.
|
Addresses |
deliveredAndWithoutBlindCarbonCopies()
Creates a copy of this addresses extension, but without any BCC addresses.
|
java.util.List<Address> |
getAddresses()
Gets the addresses.
|
boolean |
shouldNotReply()
If a noreply address is specified, a reply SHOULD NOT be generated.
|
public Addresses(java.util.Collection<Address> addresses)
Creates an address extension.
addresses
- The addresses.public Addresses(Address... address)
Creates an address extension.
address
- The addresses.public final java.util.List<Address> getAddresses()
Gets the addresses.
public final Addresses deliveredAndWithoutBlindCarbonCopies()
Creates a copy of this addresses extension, but without any BCC addresses. This is useful for server processing (multicast usage).
public final boolean shouldNotReply()
If a noreply address is specified, a reply SHOULD NOT be generated.
public static boolean createReply(Message original, Message reply)
Creates a reply for a message. If the original message contains address information, a new address extension is created based on the original one and added to the reply.
This method return false, if either no address information is found on the original message or it contains either Address.Type.NOREPLY
or Address.Type.REPLYROOM
addresses.
original
- The original message.reply
- The reply message.Copyright © 2014–2019 XMPP.rocks. All rights reserved.