Package org.jivesoftware.smackx.address
Class MultipleRecipientManager
- java.lang.Object
-
- org.jivesoftware.smackx.address.MultipleRecipientManager
-
public class MultipleRecipientManager extends Object
A MultipleRecipientManager allows to send packets to multiple recipients by making use of XEP-33: Extended Stanza Addressing. It also allows to send replies to packets that were sent to multiple recipients.
-
-
Constructor Summary
Constructors Constructor Description MultipleRecipientManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MultipleRecipientInfo
getMultipleRecipientInfo(Stanza packet)
Returns theMultipleRecipientInfo
contained in the specified stanza ornull
if none was found.static void
reply(XMPPConnection connection, Message original, Message reply)
Sends a reply to a previously received stanza that was sent to multiple recipients.static void
send(XMPPConnection connection, Stanza packet, Collection<? extends Jid> to, Collection<? extends Jid> cc, Collection<? extends Jid> bcc)
Sends the specified stanza to the collection of specified recipients using the specified connection.static void
send(XMPPConnection connection, Stanza packet, Collection<? extends Jid> to, Collection<? extends Jid> cc, Collection<? extends Jid> bcc, Jid replyTo, Jid replyRoom, boolean noReply)
Sends the specified stanza to the collection of specified recipients using the specified connection.
-
-
-
Constructor Detail
-
MultipleRecipientManager
public MultipleRecipientManager()
-
-
Method Detail
-
send
public static void send(XMPPConnection connection, Stanza packet, Collection<? extends Jid> to, Collection<? extends Jid> cc, Collection<? extends Jid> bcc) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.FeatureNotSupportedException, SmackException.NotConnectedException, InterruptedException
Sends the specified stanza to the collection of specified recipients using the specified connection. If the server has support for XEP-33 then only one stanza is going to be sent to the server with the multiple recipient instructions. However, if XEP-33 is not supported by the server then the client is going to send the stanza to each recipient.- Parameters:
connection
- the connection to use to send the packet.packet
- the stanza to send to the list of recipients.to
- the collection of JIDs to include in the TO list ornull
if no TO list exists.cc
- the collection of JIDs to include in the CC list ornull
if no CC list exists.bcc
- the collection of JIDs to include in the BCC list ornull
if no BCC list exists.- Throws:
SmackException.FeatureNotSupportedException
- if special XEP-33 features where requested, but the server does not support them.XMPPException.XMPPErrorException
- if server does not support XEP-33: Extended Stanza Addressing and some XEP-33 specific features were requested.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
send
public static void send(XMPPConnection connection, Stanza packet, Collection<? extends Jid> to, Collection<? extends Jid> cc, Collection<? extends Jid> bcc, Jid replyTo, Jid replyRoom, boolean noReply) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.FeatureNotSupportedException, SmackException.NotConnectedException, InterruptedException
Sends the specified stanza to the collection of specified recipients using the specified connection. If the server has support for XEP-33 then only one stanza is going to be sent to the server with the multiple recipient instructions. However, if XEP-33 is not supported by the server then the client is going to send the stanza to each recipient.- Parameters:
connection
- the connection to use to send the packet.packet
- the stanza to send to the list of recipients.to
- the collection of JIDs to include in the TO list ornull
if no TO list exists.cc
- the collection of JIDs to include in the CC list ornull
if no CC list exists.bcc
- the collection of JIDs to include in the BCC list ornull
if no BCC list exists.replyTo
- address to which all replies are requested to be sent ornull
indicating that they can reply to any address.replyRoom
- JID of a MUC room to which responses should be sent ornull
indicating that they can reply to any address.noReply
- true means that receivers should not reply to the message.- Throws:
XMPPException.XMPPErrorException
- if server does not support XEP-33: Extended Stanza Addressing and some XEP-33 specific features were requested.SmackException.NoResponseException
- if there was no response from the server.SmackException.FeatureNotSupportedException
- if special XEP-33 features where requested, but the server does not support them.SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
reply
public static void reply(XMPPConnection connection, Message original, Message reply) throws XMPPException.XMPPErrorException, InterruptedException, SmackException.NotConnectedException, SmackException.NoResponseException, SmackException.FeatureNotSupportedException
Sends a reply to a previously received stanza that was sent to multiple recipients. Before attempting to send the reply message some checks are performed. If any of those checks fails, then an XMPPException is going to be thrown with the specific error detail.- Parameters:
connection
- the connection to use to send the reply.original
- the previously received stanza that was sent to multiple recipients.reply
- the new message to send as a reply.- Throws:
XMPPException.XMPPErrorException
- if there was an XMPP error returned.InterruptedException
- if the calling thread was interrupted.SmackException.NotConnectedException
- if the XMPP connection is not connected.SmackException.FeatureNotSupportedException
- if a requested feature is not supported by the remote entity.SmackException.NoResponseException
- if there was no response from the remote entity.
-
getMultipleRecipientInfo
public static MultipleRecipientInfo getMultipleRecipientInfo(Stanza packet)
Returns theMultipleRecipientInfo
contained in the specified stanza ornull
if none was found. Only packets sent to multiple recipients will contain such information.- Parameters:
packet
- the stanza to check.- Returns:
- the MultipleRecipientInfo contained in the specified stanza or
null
if none was found.
-
-