X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.h;h=c6f4e3ba63734c7cc30f34e1cb506a6f45d0731f;hp=0c9c3d36528b24919408dbfc151e2a36af8b85e0;hb=858cba7fac9928549219de070397be65e1b92cde;hpb=9d12f8189a0dfd8ac76e41aea86ac56bdf907fde diff --git a/src/common/message.h b/src/common/message.h index 0c9c3d36..c6f4e3ba 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -33,31 +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 + 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(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; } @@ -66,16 +68,23 @@ 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); + +#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; @@ -84,12 +93,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); }; @@ -98,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