X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fmessage.h;h=9bb1c9c8851536ddf614e4cc349dc9ccd502093c;hb=4986a5a3ba71fe17c4a31c269a215cac1c7a4b06;hp=08c70c6fe5b34cdf0bdfd99867accbd55679a1e6;hpb=a23256347cc47605dd0660127052846427bc998d;p=quassel.git diff --git a/src/common/message.h b/src/common/message.h index 08c70c6f..9bb1c9c8 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -48,50 +48,41 @@ public: Error = 0x1000 }; - enum Flags { - None = 0, - Self = 1, - Highlight = 2, - Redirected = 4 + // DO NOT CHANGE without knowing what you do, some of these flags are stored in the database + enum Flag { + None = 0x00, + Self = 0x01, + Highlight = 0x02, + Redirected = 0x04, + Backlog = 0x80 }; - 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); - - QString formattedTimestamp(); - QString formattedSender(); - QString formattedText(); - - //static QString formattedToHtml(const QString &); - - /** Convert mIRC control codes to our own */ - static QString mircToInternal(QString); - - void format(); + void setFlags(Flags flags); private: QDateTime _timestamp; MsgId _msgId; BufferInfo _bufferInfo; - QString _text; + QString _contents; QString _sender; Type _type; - quint8 _flags; + Flags _flags; QString _formattedTimestamp, _formattedSender, _formattedText; // cache @@ -103,6 +94,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