X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.h;h=9070b05ec2fabd0d1dfd4d382c51cecb140a83a8;hp=77fde33fe765ba1061f45cd1f3aafa0277a6f136;hb=f3fc0324c8860dff6af722dafbeb05fcb69a0c41;hpb=cab361607b686847ee0df2e605f8f05598b65f99 diff --git a/src/common/message.h b/src/common/message.h index 77fde33f..9070b05e 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -33,32 +33,33 @@ class Message { public: /** The different types a message can have for display */ enum Type { - Plain, - Notice, - Action, - Nick, - Mode, - Join, - Part, - Quit, - Kick, - Kill, - Server, - Info, - Error + Plain = 0x0001, + Notice = 0x0002, + Action = 0x0004, + Nick = 0x0008, + Mode = 0x0010, + Join = 0x0020, + Part = 0x0040, + Quit = 0x0080, + Kick = 0x0100, + Kill = 0x0200, + Server = 0x0400, + Info = 0x0800, + Error = 0x1000 }; - enum Flags { + enum Flag { None = 0, Self = 1, - Highlight = 2 + 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(BufferInfo bufferInfo = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", Flags flags = None); - Message(QDateTime ts, BufferInfo buffer = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", quint8 flags = None); + Message(QDateTime ts, BufferInfo buffer = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", Flags flags = None); inline MsgId msgId() const { return _msgId; } inline void setMsgId(MsgId id) { _msgId = id; } @@ -67,15 +68,20 @@ public: inline QString text() const { return _text; } 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(Flags 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(); private: @@ -85,12 +91,10 @@ private: QString _text; 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); }; @@ -99,6 +103,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