X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.cpp;h=cfe162efa8cc07789abac8fe077a0e81229e1d16;hp=3ad6e87df7fb12ab027a9b2bf0c956aaf3101eb6;hb=097f625c4bd147f4127573ad8ab48555f9dc62d3;hpb=c1cf157116de7fc3da96203aa6f03c38c7ebb650 diff --git a/src/common/message.cpp b/src/common/message.cpp index 3ad6e87d..cfe162ef 100644 --- a/src/common/message.cpp +++ b/src/common/message.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,18 +18,23 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include "message.h" - #include #include +#include "message.h" #include "peer.h" #include "signalproxy.h" #include "util.h" -Message::Message( - BufferInfo bufferInfo, Type type, QString contents, QString sender, QString senderPrefixes, QString realName, QString avatarUrl, Flags flags) +Message::Message(BufferInfo bufferInfo, + Type type, + QString contents, + QString sender, + QString senderPrefixes, + QString realName, + QString avatarUrl, + Flags flags) : _timestamp(QDateTime::currentDateTime().toUTC()) , _bufferInfo(std::move(bufferInfo)) , _contents(std::move(contents)) @@ -66,18 +71,20 @@ 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(); if (SignalProxy::current()->targetPeer()->hasFeature(Quassel::Feature::LongTime)) { // toMSecs returns a qint64, signed rather than unsigned - out << (qint64)msg.timestamp().toMSecsSinceEpoch(); + out << (qint64) msg.timestamp().toMSecsSinceEpoch(); } else { - out << (quint32)msg.timestamp().toTime_t(); + out << (quint32) msg.timestamp().toTime_t(); } - out << (quint32)msg.type() << (quint8)msg.flags() << msg.bufferInfo() << msg.sender().toUtf8(); + out << (quint32) msg.type() + << (quint8) msg.flags() + << msg.bufferInfo() + << msg.sender().toUtf8(); if (SignalProxy::current()->targetPeer()->hasFeature(Quassel::Feature::SenderPrefixes)) out << msg.senderPrefixes().toUtf8(); @@ -147,9 +154,14 @@ QDataStream& operator>>(QDataStream& in, Message& msg) QDebug operator<<(QDebug dbg, const Message& msg) { - dbg.nospace() << qPrintable(QString("Message(MsgId:")) << msg.msgId() << qPrintable(QString(",")) << msg.timestamp() - << qPrintable(QString(", Type:")) << msg.type() << qPrintable(QString(", RealName:")) << msg.realName() - << qPrintable(QString(", AvatarURL:")) << msg.avatarUrl() << qPrintable(QString(", Flags:")) << msg.flags() - << qPrintable(QString(")")) << msg.senderPrefixes() << msg.sender() << ":" << msg.contents(); + dbg.nospace() << qPrintable(QString("Message(MsgId:")) << msg.msgId() + << qPrintable(QString(",")) << msg.timestamp() + << qPrintable(QString(", Type:")) << msg.type() + << qPrintable(QString(", RealName:")) << msg.realName() + << qPrintable(QString(", AvatarURL:")) << msg.avatarUrl() + << qPrintable(QString(", Flags:")) << msg.flags() + << qPrintable(QString(")")) + << msg.senderPrefixes() << msg.sender() << ":" + << msg.contents(); return dbg; }