Search in sources :

Example 1 with Modified

use of com.xabber.xmpp.archive.Modified in project xabber-android by redsolution.

the class MessageArchiveManager method requestModified.

private void requestModified(String account, String before) {
    Modified packet = new Modified();
    packet.setType(Type.get);
    Set rsm = new Set();
    rsm.setMax(RSM_MAX);
    rsm.setBefore(before);
    packet.setRsm(rsm);
    packet.setStart(modificationStorages.get(account).getLastRequest());
    try {
        ConnectionManager.getInstance().sendRequest(account, packet, new OnResponseListener() {

            @Override
            public void onReceived(String account, String packetId, IQ iq) {
                if (iq instanceof Modified && ((Modified) iq).isValid())
                    onModifiedReceived(account, (Modified) iq);
                else
                    onError(account, packetId, iq);
            }

            @Override
            public void onError(String account, String packetId, IQ iq) {
                onModifiedAvailable(account);
            }

            @Override
            public void onTimeout(String account, String packetId) {
                onError(account, packetId, null);
            }

            @Override
            public void onDisconnect(String account, String packetId) {
            }
        });
    } catch (NetworkException e) {
    }
}
Also used : Modified(com.xabber.xmpp.archive.Modified) Set(com.xabber.xmpp.rsm.Set) OnResponseListener(com.xabber.android.data.connection.OnResponseListener) IQ(org.jivesoftware.smack.packet.IQ) NetworkException(com.xabber.android.data.NetworkException)

Aggregations

NetworkException (com.xabber.android.data.NetworkException)1 OnResponseListener (com.xabber.android.data.connection.OnResponseListener)1 Modified (com.xabber.xmpp.archive.Modified)1 Set (com.xabber.xmpp.rsm.Set)1 IQ (org.jivesoftware.smack.packet.IQ)1