本文整理汇总了Java中org.telegram.tgnet.TLRPC.Updates方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.Updates方法的具体用法?Java TLRPC.Updates怎么用?Java TLRPC.Updates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.Updates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUpdateSeq
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private int getUpdateSeq(TLRPC.Updates updates) {
if (updates instanceof TLRPC.TL_updatesCombined) {
return updates.seq_start;
} else {
return updates.seq;
}
}
示例2: isValidUpdate
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private int isValidUpdate(TLRPC.Updates updates, int type) {
if (type == 0) {
int seq = getUpdateSeq(updates);
if (MessagesStorage.lastSeqValue + 1 == seq || MessagesStorage.lastSeqValue == seq) {
return 0;
} else if (MessagesStorage.lastSeqValue < seq) {
return 1;
} else {
return 2;
}
} else if (type == 1) {
if (updates.pts <= MessagesStorage.lastPtsValue) {
return 2;
} else if (MessagesStorage.lastPtsValue + updates.pts_count == updates.pts) {
return 0;
} else {
return 1;
}
} else if (type == 2) {
if (updates.pts <= MessagesStorage.lastQtsValue) {
return 2;
} else if (MessagesStorage.lastQtsValue + updates.updates.size() == updates.pts) {
return 0;
} else {
return 1;
}
}
return 0;
}
示例3: processNewChannelDifferenceParams
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
protected void processNewChannelDifferenceParams(int pts, int pts_count, int channelId) {
FileLog.e("tmessages", "processNewChannelDifferenceParams pts = " + pts + " pts_count = " + pts_count + " channeldId = " + channelId);
TLRPC.TL_dialog dialog = dialogs_dict.get((long) -channelId);
if (!DialogObject.isChannel(dialog)) {
return;
}
Integer channelPts = channelsPts.get(channelId);
if (channelPts == null) {
channelPts = MessagesStorage.getInstance().getChannelPtsSync(channelId);
if (channelPts == 0) {
channelPts = 1;
}
channelsPts.put(channelId, channelPts);
}
if (channelPts + pts_count == pts) {
FileLog.e("tmessages", "APPLY CHANNEL PTS");
channelsPts.put(channelId, pts);
MessagesStorage.getInstance().saveChannelPts(channelId, pts);
} else if (channelPts != pts) {
Long updatesStartWaitTime = updatesStartWaitTimeChannels.get(channelId);
Boolean gettingDifferenceChannel = gettingDifferenceChannels.get(channelId);
if (gettingDifferenceChannel == null) {
gettingDifferenceChannel = false;
}
if (gettingDifferenceChannel || updatesStartWaitTime == null || Math.abs(System.currentTimeMillis() - updatesStartWaitTime) <= 1500) {
FileLog.e("tmessages", "ADD CHANNEL UPDATE TO QUEUE pts = " + pts + " pts_count = " + pts_count);
if (updatesStartWaitTime == null) {
updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis());
}
UserActionUpdatesPts updates = new UserActionUpdatesPts();
updates.pts = pts;
updates.pts_count = pts_count;
updates.chat_id = channelId;
ArrayList<TLRPC.Updates> arrayList = updatesQueueChannels.get(channelId);
if (arrayList == null) {
arrayList = new ArrayList<>();
updatesQueueChannels.put(channelId, arrayList);
}
arrayList.add(updates);
} else {
getChannelDifference(channelId);
}
}
}