コード例 #1
0
void Session::workUpdates(InboundPkt &inboundPkt, qint64 msgId) {
    qCDebug(TG_CORE_SESSION) << "workUpdates: msgId =" << QString::number(msgId, 16);
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_Updates);
    //updates
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_Vector);
    qint32 n = inboundPkt.fetchInt();
    QList<Update> updatesList;
    for (qint32 i = 0; i < n; i++) {
        updatesList.append(inboundPkt.fetchUpdate());
    }
    //users
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_Vector);
    n = inboundPkt.fetchInt();
    QList<User> users;
    for (qint32 i = 0; i < n; i++) {
        users.append(inboundPkt.fetchUser());
    }
    //chats
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_Vector);
    n = inboundPkt.fetchInt();
    QList<Chat> chats;
    for (qint32 i = 0; i < n; i++) {
        chats.append(inboundPkt.fetchChat());
    }
    qint32 date = inboundPkt.fetchInt();
    qint32 seq = inboundPkt.fetchInt();
    Q_EMIT updates(updatesList, users, chats, date, seq);
}
コード例 #2
0
void Session::workUpdateShort(InboundPkt &inboundPkt, qint64 msgId) {
    qCDebug(TG_CORE_SESSION) << "workUpdateShort: msgId =" << QString::number(msgId, 16);
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_UpdateShort);
    Update update = inboundPkt.fetchUpdate();
    qint32 date = inboundPkt.fetchInt();
    Q_EMIT updateShort(update, date);
}