当前位置: 首页>>代码示例>>Java>>正文


Java TLRPC.Updates方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:MessagesController.java

示例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;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:30,代码来源:MessagesController.java

示例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);
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:45,代码来源:MessagesController.java


注:本文中的org.telegram.tgnet.TLRPC.Updates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。