+
+QDataStream &operator>>(QDataStream &in, Message &msg)
+{
+ quint8 f;
+ quint32 t;
+ quint32 ts;
+ QByteArray s, m;
+ BufferInfo buf;
+ in >> msg._msgId >> ts >> t >> f >> buf >> s >> m;
+ msg._type = (Message::Type)t;
+ msg._flags = (Message::Flags)f;
+ msg._bufferInfo = buf;
+ msg._timestamp = QDateTime::fromTime_t(ts);
+ msg._sender = QString::fromUtf8(s);
+ msg._contents = QString::fromUtf8(m);
+ return in;
+}
+
+
+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(", Flags:")) << msg.flags() << qPrintable(QString(")"))
+ << msg.sender() << ":" << msg.contents();
+ return dbg;
+}