Package org.jivesoftware.smackx.xevent
Class MessageEventManager
- java.lang.Object
-
- org.jivesoftware.smack.Manager
-
- org.jivesoftware.smackx.xevent.MessageEventManager
-
public final class MessageEventManager extends Manager
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.- See Also:
- XEP-22: Message Events
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.static MessageEventManager
getInstanceFor(XMPPConnection connection)
void
removeMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)
Removes a message event notification listener.void
removeMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)
Removes a message event request listener.void
sendCancelledNotification(Jid to, String packetID)
Sends the notification that the receiver of the message has cancelled composing a reply.void
sendComposingNotification(Jid to, String packetID)
Sends the notification that the receiver of the message is composing a reply.void
sendDeliveredNotification(Jid to, String packetID)
Sends the notification that the message was delivered to the sender of the original message.void
sendDisplayedNotification(Jid to, String packetID)
Sends the notification that the message was displayed to the sender of the original message.-
Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
-
-
-
Method Detail
-
getInstanceFor
public static MessageEventManager getInstanceFor(XMPPConnection connection)
-
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 recipient 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(Jid to, String packetID) throws SmackException.NotConnectedException, InterruptedException
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.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
sendDisplayedNotification
public void sendDisplayedNotification(Jid to, String packetID) throws SmackException.NotConnectedException, InterruptedException
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.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
sendComposingNotification
public void sendComposingNotification(Jid to, String packetID) throws SmackException.NotConnectedException, InterruptedException
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.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
sendCancelledNotification
public void sendCancelledNotification(Jid to, String packetID) throws SmackException.NotConnectedException, InterruptedException
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.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
-