public class OfflineMessageManager extends 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(XMPPConnection connection) |
Modifier and Type | Method and Description |
---|---|
void |
deleteMessages()
Deletes all offline messages of the user.
|
void |
deleteMessages(List<String> nodes)
Deletes the specified list of offline messages.
|
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.
|
List<Message> |
getMessages()
Returns an Iterator with all the offline Messages of the user.
|
List<Message> |
getMessages(List<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(XMPPConnection connection)
public boolean supportsFlexibleRetrieval() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
XMPPException.XMPPErrorException
- If the user is not allowed to make this request.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public int getMessageCount() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public List<OfflineMessageHeader> getHeaders() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public List<Message> getMessages(List<String> nodes) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
deleteMessages(java.util.List)
to delete the messages.nodes
- the list of stamps that uniquely identifies offline message.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public List<Message> getMessages() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
deleteMessages(java.util.List)
to delete the messages.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public void deleteMessages(List<String> nodes) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
nodes
- the list of stamps that uniquely identifies offline message.XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public void deleteMessages() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
XMPPException.XMPPErrorException
- If the user is not allowed to make this request or the server does
not support offline message retrieval.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException