X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.cpp;h=34990c6442bca5a44b98db8ec41be8445dab9f22;hp=873458f26bd6b460fb113ebc32634fccaf021d17;hb=458c3278a4b9102bcc470d48816fac379492a588;hpb=88ce73ff525535c00cc979fff357fbe4cb8cdc2b diff --git a/src/common/message.cpp b/src/common/message.cpp index 873458f2..34990c64 100644 --- a/src/common/message.cpp +++ b/src/common/message.cpp @@ -52,10 +52,19 @@ Message::Message(const QDateTime &ts, const BufferInfo &bufferInfo, Type type, c QDataStream &operator<<(QDataStream &out, const Message &msg) { + Q_ASSERT(SignalProxy::current()); + Q_ASSERT(SignalProxy::current()->targetPeer()); + // We do not serialize the sender prefixes until we have a new protocol or client-features implemented - out << msg.msgId() - << (quint32) msg.timestamp().toTime_t() - << (quint32) msg.type() + out << msg.msgId(); + + if (SignalProxy::current()->targetPeer()->hasFeature(Quassel::Feature::LongMessageTime)) { + out << (quint64) msg.timestamp().toMSecsSinceEpoch(); + } else { + out << (quint32) msg.timestamp().toTime_t(); + } + + out << (quint32) msg.type() << (quint8) msg.flags() << msg.bufferInfo() << msg.sender().toUtf8(); @@ -70,11 +79,20 @@ QDataStream &operator<<(QDataStream &out, const Message &msg) QDataStream &operator>>(QDataStream &in, Message &msg) { + Q_ASSERT(SignalProxy::current()); + Q_ASSERT(SignalProxy::current()->sourcePeer()); + in >> msg._msgId; - quint32 timeStamp; - in >> timeStamp; - msg._timestamp = QDateTime::fromTime_t(timeStamp); + if (SignalProxy::current()->sourcePeer()->hasFeature(Quassel::Feature::LongMessageTime)) { + quint64 timeStamp; + in >> timeStamp; + msg._timestamp = QDateTime::fromMSecsSinceEpoch(timeStamp); + } else { + quint32 timeStamp; + in >> timeStamp; + msg._timestamp = QDateTime::fromTime_t(timeStamp); + } quint32 type; in >> type;