Smack

org.jivesoftware.smackx
Class MultipleRecipientManager

java.lang.Object
  extended by org.jivesoftware.smackx.MultipleRecipientManager

public class MultipleRecipientManager
extends Object

A MultipleRecipientManager allows to send packets to multiple recipients by making use of JEP-33: Extended Stanza Addressing. It also allows to send replies to packets that were sent to multiple recipients.

Author:
Gaston Dombiak

Constructor Summary
MultipleRecipientManager()
           
 
Method Summary
static MultipleRecipientInfo getMultipleRecipientInfo(Packet packet)
          Returns the MultipleRecipientInfo contained in the specified packet or null if none was found.
static void reply(Connection connection, Message original, Message reply)
          Sends a reply to a previously received packet that was sent to multiple recipients.
static void send(Connection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc)
          Sends the specified packet to the list of specified recipients using the specified connection.
static void send(Connection connection, Packet packet, List<String> to, List<String> cc, List<String> bcc, String replyTo, String replyRoom, boolean noReply)
          Sends the specified packet to the list of specified recipients using the specified connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleRecipientManager

public MultipleRecipientManager()
Method Detail

send

public static void send(Connection connection,
                        Packet packet,
                        List<String> to,
                        List<String> cc,
                        List<String> bcc)
                 throws XMPPException
Sends the specified packet to the list of specified recipients using the specified connection. If the server has support for JEP-33 then only one packet is going to be sent to the server with the multiple recipient instructions. However, if JEP-33 is not supported by the server then the client is going to send the packet to each recipient.

Parameters:
connection - the connection to use to send the packet.
packet - the packet to send to the list of recipients.
to - the list of JIDs to include in the TO list or null if no TO list exists.
cc - the list of JIDs to include in the CC list or null if no CC list exists.
bcc - the list of JIDs to include in the BCC list or null if no BCC list exists.
Throws:
XMPPException - if server does not support JEP-33: Extended Stanza Addressing and some JEP-33 specific features were requested.

send

public static void send(Connection connection,
                        Packet packet,
                        List<String> to,
                        List<String> cc,
                        List<String> bcc,
                        String replyTo,
                        String replyRoom,
                        boolean noReply)
                 throws XMPPException
Sends the specified packet to the list of specified recipients using the specified connection. If the server has support for JEP-33 then only one packet is going to be sent to the server with the multiple recipient instructions. However, if JEP-33 is not supported by the server then the client is going to send the packet to each recipient.

Parameters:
connection - the connection to use to send the packet.
packet - the packet to send to the list of recipients.
to - the list of JIDs to include in the TO list or null if no TO list exists.
cc - the list of JIDs to include in the CC list or null if no CC list exists.
bcc - the list of JIDs to include in the BCC list or null if no BCC list exists.
replyTo - address to which all replies are requested to be sent or null indicating that they can reply to any address.
replyRoom - JID of a MUC room to which responses should be sent or null indicating that they can reply to any address.
noReply - true means that receivers should not reply to the message.
Throws:
XMPPException - if server does not support JEP-33: Extended Stanza Addressing and some JEP-33 specific features were requested.

reply

public static void reply(Connection connection,
                         Message original,
                         Message reply)
                  throws XMPPException
Sends a reply to a previously received packet that was sent to multiple recipients. Before attempting to send the reply message some checkings are performed. If any of those checkings fail 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 packet that was sent to multiple recipients.
reply - the new message to send as a reply.
Throws:
XMPPException - if the original message was not sent to multiple recipients, or the original message cannot be replied or reply should be sent to a room.

getMultipleRecipientInfo

public static MultipleRecipientInfo getMultipleRecipientInfo(Packet packet)
Returns the MultipleRecipientInfo contained in the specified packet or null if none was found. Only packets sent to multiple recipients will contain such information.

Parameters:
packet - the packet to check.
Returns:
the MultipleRecipientInfo contained in the specified packet or null if none was found.

Smack

Copyright © 2003-2007 Jive Software.