X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.h;h=68047db5c993876fb2c5f1761e282fe71e9326e6;hp=baa884654ea983dd6fdb99300829fc5e0f5af812;hb=cd122ca8e0d2c0ffc5397e0a813c75d791a7e6e3;hpb=2ee32e7f7707349d12c98181bbe6842f6d19f60e diff --git a/src/common/message.h b/src/common/message.h index baa88465..68047db5 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -21,43 +21,58 @@ #ifndef _MESSAGE_H_ #define _MESSAGE_H_ +#include #include #include +#include "bufferinfo.h" #include "global.h" class Message { + Q_DECLARE_TR_FUNCTIONS(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 }; enum Flags { None = 0, Self = 1, PrivMsg = 2, Highlight = 4 }; - Message(BufferId buffer = BufferId(), Type type = Plain, QString text = "", QString sender = "", quint8 flags = None); + Message(BufferInfo buffer = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", quint8 flags = None); - Message(QDateTime ts, BufferId buffer = BufferId(), 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); MsgId msgId() const; void setMsgId(MsgId id); - BufferId buffer() const; + BufferInfo buffer() const; QString text() const; QString sender() const; Type type() const; quint8 flags() const; QDateTime timeStamp() const; + QString formattedTimeStamp(); + QString formattedSender(); + QString formattedText(); + + //static QString formattedToHtml(const QString &); + + void format(); + private: QDateTime _timeStamp; MsgId _msgId; - BufferId _buffer; + BufferInfo _buffer; QString _text; QString _sender; Type _type; quint8 _flags; - friend QDataStream &operator>>(QDataStream &in, Message &msg); + QString _formattedTimeStamp, _formattedSender, _formattedText; // cache + + /** Convert mIRC control codes to our own */ + QString mircToInternal(QString); + friend QDataStream &operator>>(QDataStream &in, Message &msg); }; QDataStream &operator<<(QDataStream &out, const Message &msg);