public class OfflineMessageManager
extends java.lang.Object
Once the session that made the offline messages request has been closed and the user becomes offline in all the resources then the server will resume storing the messages offline and will send all the offline messages to the user when he becomes online. Therefore, the server will flood the user when he becomes online unless the user uses this class to manage his offline messages.
Constructor and Description |
---|
OfflineMessageManager(org.jivesoftware.smack.XMPPConnection connection) |
Modifier and Type | Method and Description |
---|---|
void |
deleteMessages()
Deletes all offline messages of the user.
|
void |
deleteMessages(java.util.List<java.lang.String> nodes)
Deletes the specified list of offline messages.
|
java.util.List<OfflineMessageHeader> |
getHeaders()
Returns a List of
OfflineMessageHeader that keep information about the
offline message. |
int |
getMessageCount()
Returns the number of offline messages for the user of the connection.
|
java.util.List<org.jivesoftware.smack.packet.Message> |
getMessages()
Returns a List of Messages with all the offline
Messages of the user. |
java.util.List<org.jivesoftware.smack.packet.Message> |
getMessages(java.util.List<java.lang.String> nodes)
Returns a List of the offline
Messages whose stamp matches the specified
request. |
boolean |
supportsFlexibleRetrieval()
Returns true if the server supports Flexible Offline Message Retrieval.
|
public OfflineMessageManager(org.jivesoftware.smack.XMPPConnection connection)
public boolean supportsFlexibleRetrieval() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public int getMessageCount() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<OfflineMessageHeader> getHeaders() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
OfflineMessageHeader
that keep information about the
offline message. The OfflineMessageHeader includes a stamp that could be used to retrieve
the complete message or delete the specific message.OfflineMessageHeader
that keep information about the offline
message.org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<org.jivesoftware.smack.packet.Message> getMessages(java.util.List<java.lang.String> nodes) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Messages
whose stamp matches the specified
request. The request will include the list of stamps that uniquely identifies
the offline messages to retrieve. The returned offline messages will not be deleted
from the server. Use deleteMessages(java.util.List)
to delete the messages.nodes
- the list of stamps that uniquely identifies offline message.Messages
that were received as part of
this request.org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<org.jivesoftware.smack.packet.Message> getMessages() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Messages
of the user. The returned offline
messages will not be deleted from the server. Use deleteMessages(java.util.List)
to delete the messages.Messages
of the user.org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void deleteMessages(java.util.List<java.lang.String> nodes) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
nodes
- the list of stamps that uniquely identifies offline message.org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void deleteMessages() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.