void Session::workUpdateShortChatMessage(InboundPkt &inboundPkt, qint64 msgId) {
    qCDebug(TG_CORE_SESSION) << "workUpdateShortChatMessage: msgId =" << QString::number(msgId, 16);
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_UpdateShortChatMessage);
    qint32 flags = inboundPkt.fetchInt();
    qint32 id = inboundPkt.fetchInt();
    qint32 fromId = inboundPkt.fetchInt();
    qint32 chatId = inboundPkt.fetchInt();
    QString message = inboundPkt.fetchQString();
    qint32 pts = inboundPkt.fetchInt();
    qint32 pts_count = inboundPkt.fetchInt();
    qint32 date = inboundPkt.fetchInt();
    qint32 fwd_from_id = 0;
    qint32 fwd_date = 0;
    qint32 reply_to_msg_id = 0;
    bool unread = (flags & 1<<0);
    bool out = (flags & 1<<1);
    if(flags & (1<<2)) {
        fwd_from_id = inboundPkt.fetchInt();
        fwd_date = inboundPkt.fetchInt();
    }
    if(flags & (1<<3)) {
        reply_to_msg_id = inboundPkt.fetchInt();
    }
    Q_EMIT updateShortChatMessage(id, fromId, chatId, message, pts, pts_count, date, fwd_from_id, fwd_date, reply_to_msg_id, unread, out);
}
Beispiel #2
0
void Session::queryOnError(InboundPkt &inboundPkt, qint64 msgId) {
    mAsserter.check(inboundPkt.fetchInt() == TL_RpcError);
    qint32 errorCode = inboundPkt.fetchInt();
    QString errorText = inboundPkt.fetchQString();
    qCDebug(TG_CORE_SESSION) << "error for query" << QString::number(msgId, 16) << " :" << errorCode << " :" << errorText;

    Query *q = m_pendingQueries.take(msgId);
    if (!q) {
        qCWarning(TG_CORE_SESSION) << "No such query";
    } else {
        q->setAcked(true);
        Q_EMIT errorReceived(q, errorCode, errorText);
    }
}