Search in sources :

Example 1 with RequestDeleteMessage

use of im.actor.core.api.rpc.RequestDeleteMessage in project actor-platform by actorapp.

the class MessageDeleteActor method performDelete.

public void performDelete(final Peer peer, final List<Long> rids) {
    final ApiOutPeer outPeer = buidOutPeer(peer);
    final ApiPeer apiPeer = buildApiPeer(peer);
    request(new RequestDeleteMessage(outPeer, rids), new RpcCallback<ResponseSeq>() {

        @Override
        public void onResult(ResponseSeq response) {
            if (deleteStorage.getPendingDeletions().containsKey(peer)) {
                deleteStorage.getPendingDeletions().get(peer).getRids().removeAll(rids);
                saveStorage();
            }
            updates().onUpdateReceived(new SeqUpdate(response.getSeq(), response.getState(), UpdateMessageDelete.HEADER, new UpdateMessageDelete(apiPeer, rids).toByteArray()));
        }

        @Override
        public void onError(RpcException e) {
        }
    });
}
Also used : SeqUpdate(im.actor.core.api.base.SeqUpdate) RequestDeleteMessage(im.actor.core.api.rpc.RequestDeleteMessage) ResponseSeq(im.actor.core.api.rpc.ResponseSeq) RpcException(im.actor.core.network.RpcException) UpdateMessageDelete(im.actor.core.api.updates.UpdateMessageDelete) ApiOutPeer(im.actor.core.api.ApiOutPeer) ApiPeer(im.actor.core.api.ApiPeer)

Aggregations

ApiOutPeer (im.actor.core.api.ApiOutPeer)1 ApiPeer (im.actor.core.api.ApiPeer)1 SeqUpdate (im.actor.core.api.base.SeqUpdate)1 RequestDeleteMessage (im.actor.core.api.rpc.RequestDeleteMessage)1 ResponseSeq (im.actor.core.api.rpc.ResponseSeq)1 UpdateMessageDelete (im.actor.core.api.updates.UpdateMessageDelete)1 RpcException (im.actor.core.network.RpcException)1