Package org.jivesoftware.smackx.xevent
Class MessageEventManager
- java.lang.Object
-
- org.jivesoftware.smack.Manager
-
- org.jivesoftware.smackx.xevent.MessageEventManager
-
public final class MessageEventManager extends org.jivesoftware.smack.ManagerManages 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 voidaddMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)Adds a message event notification listener.voidaddMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)Adds a message event request listener.static voidaddNotificationsRequests(org.jivesoftware.smack.packet.Message message, boolean offline, boolean delivered, boolean displayed, boolean composing)Adds event notification requests to a message.static MessageEventManagergetInstanceFor(org.jivesoftware.smack.XMPPConnection connection)voidremoveMessageEventNotificationListener(MessageEventNotificationListener messageEventNotificationListener)Removes a message event notification listener.voidremoveMessageEventRequestListener(MessageEventRequestListener messageEventRequestListener)Removes a message event request listener.voidsendCancelledNotification(org.jxmpp.jid.Jid to, java.lang.String packetID)Sends the notification that the receiver of the message has cancelled composing a reply.voidsendComposingNotification(org.jxmpp.jid.Jid to, java.lang.String packetID)Sends the notification that the receiver of the message is composing a reply.voidsendDeliveredNotification(org.jxmpp.jid.Jid to, java.lang.String packetID)Sends the notification that the message was delivered to the sender of the original message.voidsendDisplayedNotification(org.jxmpp.jid.Jid to, java.lang.String packetID)Sends the notification that the message was displayed to the sender of the original message.
-
-
-
Method Detail
-
getInstanceFor
public static MessageEventManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
-
addNotificationsRequests
public static void addNotificationsRequests(org.jivesoftware.smack.packet.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,trueshould 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(org.jxmpp.jid.Jid to, java.lang.String packetID) throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedExceptionSends 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:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
sendDisplayedNotification
public void sendDisplayedNotification(org.jxmpp.jid.Jid to, java.lang.String packetID) throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedExceptionSends 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:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
sendComposingNotification
public void sendComposingNotification(org.jxmpp.jid.Jid to, java.lang.String packetID) throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedExceptionSends 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:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
sendCancelledNotification
public void sendCancelledNotification(org.jxmpp.jid.Jid to, java.lang.String packetID) throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedExceptionSends 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:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
-