X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.h;h=797e28b755f7ad78a61ba8222777a681c7ef945d;hp=b262b97a2af6c5f258c826c49de0742d74b53501;hb=c2a02924342a5d9a0ebbc1794e9f7df4ca13c50d;hpb=5b560ec1a01349562ac58051ca7e7fa899d4b994 diff --git a/src/common/message.h b/src/common/message.h index b262b97a..797e28b7 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -48,52 +48,55 @@ public: Error = 0x1000 }; - enum Flags { + enum Flag { None = 0, Self = 1, Highlight = 2, Redirected = 4 }; - Q_DECLARE_FLAGS(MessageFlags, Flags) + Q_DECLARE_FLAGS(Flags, Flag) - Message(BufferInfo bufferInfo = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", quint8 flags = None); - - Message(QDateTime ts, BufferInfo buffer = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", quint8 flags = None); + Message(const BufferInfo &bufferInfo = BufferInfo(), Type type = Plain, const QString &contents = "", const QString &sender = "", Flags flags = None); + Message(const QDateTime &ts, const BufferInfo &buffer = BufferInfo(), Type type = Plain, + const QString &contents = "", const QString &sender = "", Flags flags = None); inline MsgId msgId() const { return _msgId; } inline void setMsgId(MsgId id) { _msgId = id; } inline BufferInfo bufferInfo() const { return _bufferInfo; } - inline QString text() const { return _text; } + inline QString contents() const { return _contents; } inline QString sender() const { return _sender; } inline Type type() const { return _type; } - inline quint8 flags() const { return _flags; } + inline Flags flags() const { return _flags; } inline QDateTime timestamp() const { return _timestamp; } - void setFlags(quint8 flags); + void setFlags(Flags flags); +#ifndef SPUTDEV QString formattedTimestamp(); QString formattedSender(); QString formattedText(); //static QString formattedToHtml(const QString &); + /** Convert mIRC control codes to our own */ + static QString mircToInternal(QString); + void format(); +#endif private: QDateTime _timestamp; MsgId _msgId; BufferInfo _bufferInfo; - QString _text; + QString _contents; QString _sender; Type _type; - quint8 _flags; + Flags _flags; QString _formattedTimestamp, _formattedSender, _formattedText; // cache - /** Convert mIRC control codes to our own */ - QString mircToInternal(QString); friend QDataStream &operator>>(QDataStream &in, Message &msg); }; @@ -102,6 +105,6 @@ QDataStream &operator<<(QDataStream &out, const Message &msg); QDataStream &operator>>(QDataStream &in, Message &msg); Q_DECLARE_METATYPE(Message); -Q_DECLARE_OPERATORS_FOR_FLAGS(Message::MessageFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(Message::Flags) #endif