Smack

org.jivesoftware.smackx.receipts
Class DeliveryReceiptManager

java.lang.Object
  extended by org.jivesoftware.smackx.receipts.DeliveryReceiptManager
All Implemented Interfaces:
PacketListener

public class DeliveryReceiptManager
extends java.lang.Object
implements PacketListener

Manager for XEP-0184: Message Delivery Receipts. This class implements the manager for DeliveryReceipt support, enabling and disabling of automatic DeliveryReceipt transmission.

Author:
Georg Lukas

Method Summary
static void 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(Connection connection)
          Obtain the DeliveryReceiptManager responsible for a connection.
static boolean hasDeliveryReceiptRequest(Packet p)
          Test if a packet requires a delivery receipt.
 boolean isSupported(java.lang.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 DeliveryReceipts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstanceFor

public static DeliveryReceiptManager getInstanceFor(Connection connection)
Obtain the DeliveryReceiptManager responsible for a connection.

Parameters:
connection - the connection object.
Returns:
the DeliveryReceiptManager instance for the given connection

isSupported

public boolean isSupported(java.lang.String jid)
Returns true if Delivery Receipts are supported by a given JID

Parameters:
jid -
Returns:
true if supported

processPacket

public void processPacket(Packet packet)
Description copied from interface: PacketListener
Process the next packet sent to this packet listener.

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.

Specified by:
processPacket in interface PacketListener
Parameters:
packet - the packet to process.

setAutoReceiptsEnabled

public void setAutoReceiptsEnabled(boolean new_state)
Configure whether the DeliveryReceiptManager should automatically reply to incoming DeliveryReceipts. By default, this feature is off.

Parameters:
new_state - whether automatic transmission of DeliveryReceipts should be enabled or disabled

enableAutoReceipts

public void enableAutoReceipts()
Helper method to enable automatic DeliveryReceipt transmission.


disableAutoReceipts

public void disableAutoReceipts()
Helper method to disable automatic DeliveryReceipt transmission.


getAutoReceiptsEnabled

public boolean getAutoReceiptsEnabled()
Check if AutoReceipts are enabled on this connection.


addReceiptReceivedListener

public void addReceiptReceivedListener(ReceiptReceivedListener listener)
Get informed about incoming delivery receipts with a ReceiptReceivedListener.

Parameters:
listener - the listener to be informed about new receipts

removeReceiptReceivedListener

public void removeReceiptReceivedListener(ReceiptReceivedListener listener)
Stop getting informed about incoming delivery receipts.

Parameters:
listener - the listener to be removed

hasDeliveryReceiptRequest

public static boolean hasDeliveryReceiptRequest(Packet p)
Test if a packet requires a delivery receipt.

Parameters:
p - Packet object to check for a DeliveryReceiptRequest
Returns:
true if a delivery receipt was requested

addDeliveryReceiptRequest

public static void addDeliveryReceiptRequest(Message m)
Add a delivery receipt request to an outgoing packet. Only message packets may contain receipt requests as of XEP-0184, therefore only allow Message as the parameter type.

Parameters:
m - Message object to add a request to

Smack

Copyright © 2003-2007 Jive Software.