2013-10-25 15:19:00 +00:00
|
|
|
/*
|
2013-12-20 19:25:49 +00:00
|
|
|
* This is the source code of Telegram for Android v. 1.3.2.
|
2013-10-25 15:19:00 +00:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
|
|
|
* Copyright Nikolai Kudashov, 2013.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.messenger;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
public class RPCRequest {
|
|
|
|
public interface RPCRequestDelegate {
|
|
|
|
void run(TLObject response, TLRPC.TL_error error);
|
|
|
|
}
|
|
|
|
public interface RPCProgressDelegate {
|
|
|
|
void progress(int length, int progress);
|
|
|
|
}
|
|
|
|
public interface RPCQuickAckDelegate {
|
|
|
|
void quickAck();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int RPCRequestClassGeneric = 1;
|
|
|
|
public static int RPCRequestClassDownloadMedia = 2;
|
|
|
|
public static int RPCRequestClassUploadMedia = 4;
|
|
|
|
public static int RPCRequestClassEnableUnauthorized = 8;
|
|
|
|
public static int RPCRequestClassFailOnServerErrors = 16;
|
2014-02-04 18:36:55 +00:00
|
|
|
public static int RPCRequestClassCanCompress = 32;
|
2014-05-20 20:22:44 +00:00
|
|
|
public static int RPCRequestClassPush = 64;
|
2013-10-25 15:19:00 +00:00
|
|
|
|
|
|
|
static int RPCRequestClassTransportMask = (RPCRequestClassGeneric | RPCRequestClassDownloadMedia | RPCRequestClassUploadMedia);
|
|
|
|
|
|
|
|
long token;
|
|
|
|
boolean cancelled;
|
|
|
|
|
|
|
|
int serverFailureCount;
|
|
|
|
int flags;
|
2014-02-04 18:36:55 +00:00
|
|
|
public int retryCount = 0;
|
2013-10-25 15:19:00 +00:00
|
|
|
|
|
|
|
TLObject rawRequest;
|
|
|
|
TLObject rpcRequest;
|
|
|
|
int serializedLength;
|
|
|
|
|
|
|
|
RPCRequestDelegate completionBlock;
|
|
|
|
RPCProgressDelegate progressBlock;
|
|
|
|
RPCQuickAckDelegate quickAckBlock;
|
|
|
|
|
|
|
|
boolean requiresCompletion;
|
|
|
|
|
|
|
|
long runningMessageId;
|
|
|
|
int runningMessageSeqNo;
|
|
|
|
int runningDatacenterId;
|
|
|
|
int transportChannelToken;
|
|
|
|
|
|
|
|
int runningStartTime;
|
|
|
|
int runningMinStartTime;
|
|
|
|
|
|
|
|
boolean confirmed;
|
|
|
|
|
2013-12-26 11:43:37 +00:00
|
|
|
boolean initRequest = false;
|
|
|
|
|
2013-10-25 15:19:00 +00:00
|
|
|
ArrayList<Long> respondsToMessageIds = new ArrayList<Long>();
|
|
|
|
|
|
|
|
public void addRespondMessageId(long messageId) {
|
|
|
|
respondsToMessageIds.add(messageId);
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean respondsToMessageId(long messageId) {
|
|
|
|
return runningMessageId == messageId || respondsToMessageIds.contains(messageId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|