示例#1
0
void Session::workUpdateShortMessage(InboundPkt &inboundPkt, qint64 msgId) {
    qCDebug(TG_CORE_SESSION) << "workUpdateShortMessage: msgId =" << QString::number(msgId, 16);
    Q_UNUSED(msgId)
    UpdatesType upd(&inboundPkt);
    bool unread = (upd.flags() & 0x1);
    bool out = (upd.flags() & 0x2);
    Q_EMIT updateShortMessage(upd.id(), upd.userId(), upd.message(), upd.pts(), upd.ptsCount(), upd.date(), upd.fwdFromId(), upd.fwdDate(), upd.replyToMsgId(), unread, out);
}
void Session::workUpdateShortMessage(InboundPkt &inboundPkt, qint64 msgId) {
    qCDebug(TG_CORE_SESSION) << "workUpdateShortMessage: msgId =" << QString::number(msgId, 16);
    mAsserter.check(inboundPkt.fetchInt() == (qint32)TL_UpdateShortMessage);
    qint32 flags = inboundPkt.fetchInt();
    qint32 id = inboundPkt.fetchInt();
    qint32 userId = inboundPkt.fetchInt();
    QString message = inboundPkt.fetchQString();
    qint32 pts = inboundPkt.fetchInt();
    qint32 ptsCount = 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 updateShortMessage(id, userId, message, pts, ptsCount, date, fwd_from_id, fwd_date, reply_to_msg_id, unread, out);
}