use of im.actor.core.api.ApiOutPeer 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) {
}
});
}
use of im.actor.core.api.ApiOutPeer in project actor-platform by actorapp.
the class SenderActor method performSendApiContent.
private void performSendApiContent(final Peer peer, final long rid, ApiMessage message, final WakeLock wakeLock) {
final ApiOutPeer outPeer = buidOutPeer(peer);
final ApiPeer apiPeer = buildApiPeer(peer);
if (outPeer == null || apiPeer == null) {
return;
}
request(new RequestSendMessage(outPeer, rid, message, null, null), new RpcCallback<ResponseSeqDate>() {
@Override
public void onResult(ResponseSeqDate response) {
self().send(new MessageSent(peer, rid));
updates().onUpdateReceived(new SeqUpdate(response.getSeq(), response.getState(), UpdateMessageSent.HEADER, new UpdateMessageSent(apiPeer, rid, response.getDate()).toByteArray()));
wakeLock.releaseLock();
}
@Override
public void onError(RpcException e) {
self().send(new MessageError(peer, rid));
wakeLock.releaseLock();
}
});
}
Aggregations