public class DeliveryReceiptManager extends Manager implements PacketListener
DeliveryReceipt
support, enabling and disabling of
automatic DeliveryReceipt transmission.Modifier and Type | Method and Description |
---|---|
static String |
addDeliveryReceiptRequest(Message m)
Add a delivery receipt request to an outgoing packet.
|
void |
addReceiptReceivedListener(ReceiptReceivedListener listener)
Get informed about incoming delivery receipts with a
ReceiptReceivedListener . |
void |
disableAutoReceipts()
Helper method to disable automatic DeliveryReceipt transmission.
|
void |
enableAutoReceipts()
Helper method to enable automatic DeliveryReceipt transmission.
|
boolean |
getAutoReceiptsEnabled()
Check if AutoReceipts are enabled on this connection.
|
static DeliveryReceiptManager |
getInstanceFor(XMPPConnection connection)
Obtain the DeliveryReceiptManager responsible for a connection.
|
static boolean |
hasDeliveryReceiptRequest(Packet p)
Test if a packet requires a delivery receipt.
|
boolean |
isSupported(String jid)
Returns true if Delivery Receipts are supported by a given JID
|
void |
processPacket(Packet packet)
Process the next packet sent to this packet listener.
|
void |
removeReceiptReceivedListener(ReceiptReceivedListener listener)
Stop getting informed about incoming delivery receipts.
|
void |
setAutoReceiptsEnabled(boolean new_state)
Configure whether the
DeliveryReceiptManager should automatically
reply to incoming DeliveryReceipt s. |
connection, schedule
public static DeliveryReceiptManager getInstanceFor(XMPPConnection connection)
connection
- the connection object.public boolean isSupported(String jid) throws SmackException, XMPPException
jid
- SmackException
- if there was no response from the server.XMPPException
public void processPacket(Packet packet) throws SmackException.NotConnectedException
PacketListener
A single thread is responsible for invoking all listeners, so it's very important that implementations of this method not block for any extended period of time.
processPacket
in interface PacketListener
packet
- the packet to process.SmackException.NotConnectedException
public void setAutoReceiptsEnabled(boolean new_state)
DeliveryReceiptManager
should automatically
reply to incoming DeliveryReceipt
s. By default, this feature is off.new_state
- whether automatic transmission of
DeliveryReceipts should be enabled or disabledpublic void enableAutoReceipts()
public void disableAutoReceipts()
public boolean getAutoReceiptsEnabled()
public void addReceiptReceivedListener(ReceiptReceivedListener listener)
ReceiptReceivedListener
.listener
- the listener to be informed about new receiptspublic void removeReceiptReceivedListener(ReceiptReceivedListener listener)
listener
- the listener to be removedpublic static boolean hasDeliveryReceiptRequest(Packet p)
p
- Packet object to check for a DeliveryReceiptRequestpublic static String addDeliveryReceiptRequest(Message m)
m
- Message object to add a request to