Smack

org.jivesoftware.smackx
Class MessageEventManager

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

public class MessageEventManager
extends Object

Manages message events requests and notifications. A MessageEventManager provides a high level access to request for notifications and send event notifications. It also provides an easy way to hook up custom logic when requests or notifications are received.

Author:
Gaston Dombiak

Constructor Summary
MessageEventManager(XMPPConnection con)
          Creates a new message event manager.
 
Method Summary
 void addMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)
          Adds a message event notification listener.
 void addMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)
          Adds a message event request listener.
static void addNotificationsRequests(Message message, boolean offline, boolean delivered, boolean displayed, boolean composing)
          Adds event notification requests to a message.
 void destroy()
           
 void finalize()
           
 void removeMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)
          Removes a message event notification listener.
 void removeMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)
          Removes a message event request listener.
 void sendCancelledNotification(String to, String packetID)
          Sends the notification that the receiver of the message has cancelled composing a reply.
 void sendComposingNotification(String to, String packetID)
          Sends the notification that the receiver of the message is composing a reply
 void sendDeliveredNotification(String to, String packetID)
          Sends the notification that the message was delivered to the sender of the original message
 void sendDisplayedNotification(String to, String packetID)
          Sends the notification that the message was displayed to the sender of the original message
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageEventManager

public MessageEventManager(XMPPConnection con)
Creates a new message event manager.

Parameters:
con - an XMPPConnection.
Method Detail

addNotificationsRequests

public static void addNotificationsRequests(Message message,
                                            boolean offline,
                                            boolean delivered,
                                            boolean displayed,
                                            boolean composing)
Adds event notification requests to a message. For each event type that the user wishes event notifications from the message recepient for, true should be passed in to this method.

Parameters:
message - the message to add the requested notifications.
offline - specifies if the offline event is requested.
delivered - specifies if the delivered event is requested.
displayed - specifies if the displayed event is requested.
composing - specifies if the composing event is requested.

addMessageEventRequestListener

public void addMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)
Adds a message event request listener. The listener will be fired anytime a request for event notification is received.

Parameters:
messageEventRequestListener - a message event request listener.

removeMessageEventRequestListener

public void removeMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)
Removes a message event request listener. The listener will be fired anytime a request for event notification is received.

Parameters:
messageEventRequestListener - a message event request listener.

addMessageEventNotificationListener

public void addMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)
Adds a message event notification listener. The listener will be fired anytime a notification event is received.

Parameters:
messageEventNotificationListener - a message event notification listener.

removeMessageEventNotificationListener

public void removeMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)
Removes a message event notification listener. The listener will be fired anytime a notification event is received.

Parameters:
messageEventNotificationListener - a message event notification listener.

sendDeliveredNotification

public void sendDeliveredNotification(String to,
                                      String packetID)
Sends the notification that the message was delivered to the sender of the original message

Parameters:
to - the recipient of the notification.
packetID - the id of the message to send.

sendDisplayedNotification

public void sendDisplayedNotification(String to,
                                      String packetID)
Sends the notification that the message was displayed to the sender of the original message

Parameters:
to - the recipient of the notification.
packetID - the id of the message to send.

sendComposingNotification

public void sendComposingNotification(String to,
                                      String packetID)
Sends the notification that the receiver of the message is composing a reply

Parameters:
to - the recipient of the notification.
packetID - the id of the message to send.

sendCancelledNotification

public void sendCancelledNotification(String to,
                                      String packetID)
Sends the notification that the receiver of the message has cancelled composing a reply.

Parameters:
to - the recipient of the notification.
packetID - the id of the message to send.

destroy

public void destroy()

finalize

public void finalize()
Overrides:
finalize in class Object

Smack

Copyright © 2003-2007 Jive Software.